Skip to main content

DSPy OpenTelemetry Integration

Overview

This integration provides support for using OpenTelemetry with the DSPy framework. It enables tracing and monitoring of applications built with DSPy.

Installation

  1. Install traceAI DSPy
pip install traceAI-DSPy
  1. Install DSPy
pip install dspy

Set Environment Variables

Set up your environment variables to authenticate with FutureAGI

import os

os.environ["FI_API_KEY"] = FI_API_KEY
os.environ["FI_SECRET_KEY"] = FI_SECRET_KEY

Quickstart

Register Tracer Provider

Set up the trace provider to establish the observability pipeline. The trace provider:

from fi_instrumentation import register
from fi_instrumentation.fi_types import ProjectType

trace_provider = register(
    project_type=ProjectType.OBSERVE,
    project_name="dspy_app"
)

Configure DSPy Instrumentation

Instrument the DSPy client to enable telemetry collection. This step ensures that all interactions with the DSPy SDK are tracked and monitored.

from traceai_dspy import DSPyInstrumentor

DSPyInstrumentor().instrument(tracer_provider=trace_provider)

Create DSPy Components

Set up your DSPy client with built-in observability.

import dspy

class BasicQA(dspy.Signature):
    """Answer questions with short factoid answers."""

    question = dspy.InputField()
    answer = dspy.OutputField(desc="often between 1 and 5 words")

if __name__ == "__main__":
    turbo = dspy.LM(model="openai/gpt-4")

    dspy.settings.configure(lm=turbo)

    # Define the predictor.
    generate_answer = dspy.Predict(BasicQA)

    # Call the predictor on a particular input.
    pred = generate_answer(question="What is the capital of the united states?")
    print(f"Predicted Answer: {pred.answer}")

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

traceai_dspy-0.1.5.tar.gz (8.2 kB view details)

Uploaded Source

Built Distributions

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

traceai_dspy-0.1.5-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

traceai_dspy-0.1.5-1-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file traceai_dspy-0.1.5.tar.gz.

File metadata

  • Download URL: traceai_dspy-0.1.5.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.0 CPython/3.13.0 Darwin/24.1.0

File hashes

Hashes for traceai_dspy-0.1.5.tar.gz
Algorithm Hash digest
SHA256 c606575ff8ba1c1ab640471713b79a0f8a26c82809da3b641e6ef7e9e0a15589
MD5 adc559d482030af0d364e83f02484fce
BLAKE2b-256 6e0e45b394328a73a89dd83995a1eef61e683df9ad0b53c29b40ecc7fa8dfe2c

See more details on using hashes here.

File details

Details for the file traceai_dspy-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: traceai_dspy-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.0 CPython/3.13.0 Darwin/24.1.0

File hashes

Hashes for traceai_dspy-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 40718e5a3e2c0d669d19e02df5c89bbc82bc1e8a97b82df19a91c6a0e3ed745b
MD5 f9986decd84d2e77f0cfafc1d2824d6d
BLAKE2b-256 5ade8cde987d28e9cd35f1b4637fc50c0e8a006067cbbd09c7b2476d0a02289d

See more details on using hashes here.

File details

Details for the file traceai_dspy-0.1.5-1-py3-none-any.whl.

File metadata

  • Download URL: traceai_dspy-0.1.5-1-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.0 CPython/3.13.0 Darwin/24.1.0

File hashes

Hashes for traceai_dspy-0.1.5-1-py3-none-any.whl
Algorithm Hash digest
SHA256 97a340562411b8ce894d584a3c2380c371ef50f6d61e3a78aaca24f8a42094d0
MD5 6159254e9fc5a00e9b111c8e0885fbc1
BLAKE2b-256 e2afe4f191c7f471c156ae21d48d2d11119431cbdfd1a95530b43ddd45f766c3

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.8

2 files

0.1.7

2 files

0.1.6

2 files

This release

0.1.5 This release

3 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page