A client library for accessing elasticdash
Project description
ElasticDash Python SDK
Installation
pip install elasticdash
Then set your ElasticDash credentials as environment variables so the SDK knows who you are.
ELASTICDASH_SECRET_KEY = "sk-lf-..."
ELASTICDASH_PUBLIC_KEY = "pk-lf-..."
ELASTICDASH_BASE_URL = "https://devserver-logger.elasticdash.com"
At the moment, the Secret Key and Public Key will be provided by ElasticDash directly.
Usage
OpenAI SDK
Swap the regular OpenAI import to Langfuse’s OpenAI drop-in. It behaves like the regular OpenAI client while also recording each call for you.
from elasticdash.openai import openai
Use the OpenAI SDK as you normally would. The wrapper captures the prompt, model and output and forwards everything to ElasticDash.
completion = openai.chat.completions.create(
name="test-chat",
model="gpt-4o",
messages=[
{"role": "system", "content": "You are a very accurate calculator. You output only the result of the calculation."},
{"role": "user", "content": "1 + 1 = "}],
metadata={"someMetadataKey": "someValue"},
)
Manual Observation
This can help you cover the LLM models that we are not currently supporting.
from elasticdash import get_client
elasticdash = get_client()
# Create a span using a context manager
with elasticdash.start_as_current_observation(as_type="span", name="process-request") as span:
# Your processing logic here
span.update(output="Processing complete")
# Create a nested generation for an LLM call
with elasticdash.start_as_current_observation(as_type="generation", name="llm-response", model="gpt-3.5-turbo") as generation:
# Your LLM call logic here
generation.update(output="Generated response")
# All spans are automatically closed when exiting their context blocks
# Flush events in short-lived applications
elasticdash.flush()
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file elasticdash-0.0.3.tar.gz.
File metadata
- Download URL: elasticdash-0.0.3.tar.gz
- Upload date:
- Size: 223.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
69fc2c6adfb8bc5888b1445a585cdf50deae9f6eebbf0dea91e4b2b1cf4731e8
|
|
| MD5 |
8c5a0c3015452c14aea983755e2ab782
|
|
| BLAKE2b-256 |
43d9bd069bc08c1f4844d760420cbba4be101d7b5901c34806a6a405ed064f7a
|
File details
Details for the file elasticdash-0.0.3-py3-none-any.whl.
File metadata
- Download URL: elasticdash-0.0.3-py3-none-any.whl
- Upload date:
- Size: 420.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5674d931d2230fb1bc61150af10462daba45ece91558cc13bd8cfd0703e74c0c
|
|
| MD5 |
70f122bc74bd80056141aa83d56f0d56
|
|
| BLAKE2b-256 |
edda8fe083c00701c21498b610521885f760a55db4c652c9aa626957d5394eb7
|