Skip to main content

Respan instrumentation plugin for DSPy

Project description

respan-instrumentation-dspy

Respan instrumentation plugin for DSPy.

This package registers a native DSPy callback and emits module, language model, tool, adapter, and evaluation spans into the Respan tracing pipeline.

Configuration

1. Install

pip install respan-instrumentation-dspy

2. Set Environment Variables

Variable Required Description
RESPAN_API_KEY Yes Your Respan API key. Authenticates both proxy and tracing.
RESPAN_BASE_URL No Defaults to https://api.respan.ai/api.

Quickstart

3. Run Script

import os

import dspy
from respan import Respan
from respan_instrumentation_dspy import DSPyInstrumentor

respan_api_key = os.environ["RESPAN_API_KEY"]
respan_base_url = os.getenv("RESPAN_BASE_URL", "https://api.respan.ai/api")

os.environ["OPENAI_API_KEY"] = respan_api_key
os.environ["OPENAI_BASE_URL"] = respan_base_url
os.environ["OPENAI_API_BASE"] = respan_base_url

respan = Respan(
    api_key=respan_api_key,
    base_url=respan_base_url,
    app_name="dspy-quickstart",
    instrumentations=[DSPyInstrumentor()],
)

dspy.configure(lm=dspy.LM("openai/gpt-4o-mini", cache=False))
question_answerer = dspy.Predict("question -> answer")
prediction = question_answerer(question="What is DSPy in one sentence?")

print(prediction.answer)
respan.flush()

4. View Dashboard

Open the Respan dashboard and inspect the dspy-quickstart trace.

Further Reading

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

respan_instrumentation_dspy-0.1.0.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

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

respan_instrumentation_dspy-0.1.0-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

Details for the file respan_instrumentation_dspy-0.1.0.tar.gz.

File metadata

  • Download URL: respan_instrumentation_dspy-0.1.0.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.4 CPython/3.12.12 Darwin/25.0.0

File hashes

Hashes for respan_instrumentation_dspy-0.1.0.tar.gz
Algorithm Hash digest
SHA256 13da110ddb0c7e4abb0665bb070bd3d4ba3aecd2e83a332fe28b7e446ee04840
MD5 b1d9b8ea9dd6739fd422c0655b528de6
BLAKE2b-256 60e2fe47b04ff9634a2f1c7f40491265dcde3864a904e0e5b7b47973a69263f5

See more details on using hashes here.

File details

Details for the file respan_instrumentation_dspy-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for respan_instrumentation_dspy-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8051c355d9558405ac108ec77b2c265d7dc5372b424156b168adcc46a8306744
MD5 c3fc1ecd9165475009c4a89cb0ef7028
BLAKE2b-256 e26c25c0886903f4376bcc5726024aea704c40d6f4ef98bb025040ddaa5877c5

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