Did anyone else stopped receiving new traces?
馃敀[private user] I would love some 馃檪
Arize AX
I just tried to run the code from here: https://arize.com/docs/ax/integrations/frameworks-and-platforms/dspy/dspy-tracing
It is confusing 馃檪
I just copied to code from here: https://arize.com/docs/ax/integrations/frameworks-and-platforms/dspy/dspy-tracing
Worked Yesterday
When i run the sample, i can see a new project is being created in Arize, but no traces
Did all of that, still nothing, not sure what i'm missing
# Import Arize OTel registration
from arize.otel import register
# Import OpenInference instrumentors
from openinference.instrumentation.dspy import DSPyInstrumentor
from openinference.instrumentation.litellm import LiteLLMInstrumentor # For underlying LLM calls via LiteLLM
# Setup OTel and Arize exporter
tracer_provider = register(
space_id=ARIZE_SPACE_ID,
api_key=ARIZE_API_KEY,
project_name=PROJECT_NAME
)
# Instrument DSPy
DSPyInstrumentor().instrument(tracer_provider=tracer_provider)
# Instrument LiteLLM (recommended for full visibility into DSPy's LLM calls)
LiteLLMInstrumentor().instrument(tracer_provider=tracer_provider)
print("DSPy and LiteLLM instrumented for Arize.")import dspy
import os
from openinference.semconv.trace import SpanAttributes # For using_attributes
from openinference.instrumentation import using_attributes # For custom attributes
# Ensure OPENAI_API_KEY is set in your environment
os.environ["OPENAI_API_KEY"] = OPENAI_API_KEY
class BasicQA(dspy.Signature):
"""Answer questions with short factoid answers."""
question = dspy.InputField()
answer = dspy.OutputField(desc="often between 1 and 5 words")
# Configure the LLM. DSPy can use various LLMs, often via LiteLLM.
# For OpenAI models, ensure OPENAI_API_KEY is set.
# The dspy.OpenAI client might internally use LiteLLM or a direct OpenAI client.
turbo = dspy.LM(model="gpt-3.5-turbo")
dspy.configure(lm=turbo)
# Example of adding custom attributes to traces using OpenInference context manager
with using_attributes(
session_id="my-dspy-session-001",
user_id="user-dspy-example",
metadata={
"environment": "testing",
"dspy_module": "BasicQA",
},
tags=["dspy", "qa"],
prompt_template_version="1.0",
prompt_template_variables={
"signature_desc": BasicQA.__doc__.strip()
}
):
# 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 Atlantis?"
)
print(f"Question: What is the capital of the Atlantis?")
print(f"Predicted Answer: {pred.answer}")
pred_europe = generate_answer(
question="What is the capital of France?"
)
print(f"Question: What is the capital of France?")
print(f"Predicted Answer: {pred_europe.answer}")
print("DSPy example run complete. Check Arize for traces.")I'm starting to see spans from ~45 minutes ago
Got you, well at least i know i didn't miss anything. Thanks for the help
