Skip to main content

A client library for accessing elasticdash

Project description

ElasticDash Python SDK

MIT License PyPI Version

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(input="Llm input here")
 
    # 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:
        generation.update(input="Llm input here")
        # Your LLM call logic here
        span.update(output="Processing complete")
        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

elasticdash-0.0.4.tar.gz (223.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

elasticdash-0.0.4-py3-none-any.whl (420.9 kB view details)

Uploaded Python 3

File details

Details for the file elasticdash-0.0.4.tar.gz.

File metadata

  • Download URL: elasticdash-0.0.4.tar.gz
  • Upload date:
  • Size: 223.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.16

File hashes

Hashes for elasticdash-0.0.4.tar.gz
Algorithm Hash digest
SHA256 0cb02955766b0cc4120866b520827ddcf134087008b265fc619d18fe6d00ab07
MD5 398134f7477f1b7e801f446700ec3e72
BLAKE2b-256 a3a09a325f8a8ab1cdf9aae1a0d825f91a5e6d100858aaca7e7cc23553d43381

See more details on using hashes here.

File details

Details for the file elasticdash-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: elasticdash-0.0.4-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

Hashes for elasticdash-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 6fc8892820d303182c63392bd446f7198feaeb79011c1a07d4e267cafcc8ff57
MD5 d4b0867423922727f50c561aacc127fa
BLAKE2b-256 6c8caf0e9ee143cd8a38770026ef7dc516e08e8b045df8151d8bfdf8b81f3b2b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page