1. Installation

Install the traceAI and Groq packages.

pip install traceAI-groq

2. Set Environment Variables

Set up your environment variables to authenticate with both FutureAGI and Groq.

import os

os.environ["FI_API_KEY"] = "your-futureagi-api-key"
os.environ["FI_SECRET_KEY"] = "your-futureagi-secret-key"
os.environ["GROQ_API_KEY"] = "your-groq-api-key"

3. Initialize Trace Provider

Set up the trace provider to create a new project in FutureAGI, establish telemetry data pipelines .

from fi_instrumentation import register
from fi_instrumentation.fi_types import ProjectType

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

4. Instrument your Project

Instrument your project to enable automatic tracing.

from traceai_groq import GroqInstrumentor

GroqInstrumentor().instrument(tracer_provider=trace_provider)

5. Interact with Groq

Interact with Groq as you normally would. Our Instrumentor will automatically trace and send the telemetry data to our platform.

from groq import Groq

client = Groq()

chat_completion = client.chat.completions.create(
    messages=[
        {
            "role": "system",
            "content": "you are a helpful assistant."
        },
        {
            "role": "user",
            "content": "Explain the importance of fast language models",
        }
    ],
    model="llama-3.3-70b-versatile",
)

print(chat_completion.choices[0].message.content)

Was this page helpful?