Register your project with the necessary configuration.
Copy
from fi_instrumentation import register, Transportfrom fi_instrumentation.fi_types import ProjectType# Setup OTel via our register functiontrace_provider = register( project_type=ProjectType.OBSERVE, project_name="FUTURE_AGI", # Your project name session_name="chat-bot" # Session name transport=Transport.GRPC, # Transport mechanism for your traces)
Example: Instrumenting with Auto Instrumentor ( OpenAI )
First, install the traceAI openai package:
Copy
pip install traceAI-openai
Instrument your project with FutureAGI’s OpenAI Instrumentor.
Copy
from traceai_openai import OpenAIInstrumentorOpenAIInstrumentor().instrument(tracer_provider=trace_provider)
Initialize the OpenAI client and make OpenAI requests as you normally would. Our Instrumentor will automatically trace these requests for you, which can be viewed in your Observe dashboard.
Copy
from openai import OpenAIos.environ["OPENAI_API_KEY"] = "your-openai-api-key"client = OpenAI()completion = client.chat.completions.create( model="gpt-4o", messages=[ { "role": "user", "content": "Write a one-sentence bedtime story about a unicorn." } ])print(completion.choices[0].message.content)
To know more about the supported frameworks and how to instrument them, check out our Auto Instrumentation page.