1. Configure Your Environment

Set up your environment variables to connect to Future AGI. Get your API keys here

import os
os.environ["FI_API_KEY"] = "YOUR_API_KEY"
os.environ["FI_SECRET_KEY"] = "YOUR_SECRET_KEY"

2. Register Your Prototype Project

Register your project with the necessary configuration.

from fi_instrumentation import register
from fi_instrumentation.fi_types import ProjectType, EvalName, EvalTag, EvalTagType, EvalSpanKind

# Setup OTel via our register function
trace_provider = register(
    project_type=ProjectType.EXPERIMENT,  
    project_name="FUTURE_AGI",            # Your project name
    project_version_name="openai-exp",    # Version identifier for this prototype
    eval_tags = [
        EvalTag(
            eval_name=EvalName.TONE,
            value=EvalSpanKind.LLM,
            type=EvalTagType.OBSERVATION_SPAN,
            config={},
            mapping={
                'input' : '"llm.input_messages"'
            },
            custom_eval_name="<custom_eval_name2>",
        ),
    ]
)

Configuration Parameters:

  • project_type: Set as ProjectType.EXPERIMENT for prototyping
  • project_name: A descriptive name for your project
  • project_version_name (optional): A version identifier for this prototype, enabling comparison between different iterations
  • eval_tags (optional): Define which evaluations to run on your prototype as a list of EvalTag objects. Learn more →

Instrument your project:

There are 2 ways to implement tracing in your project

  1. Auto Instrumentor : Instrument your project with FutureAGI’s Auto Instrumentor. Recommended for most use cases.
  2. Manual Tracing : Manually track your project with Open Telemetry. Useful for more customized tracing. Learn more →

Example: Instrumenting with Auto Instrumentor ( OpenAI )

First, install the traceAI openai package:

pip install traceAI-openai

Instrument your project with FutureAGI’s OpenAI Instrumentor.

from traceai_openai import OpenAIInstrumentor

OpenAIInstrumentor().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 Prototype dashboard.

from openai import OpenAI

os.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.

Was this page helpful?