Skip to main content

Groq OpenTelemetry Integration

Overview

This integration provides support for using OpenTelemetry with the Groq framework. It enables tracing and monitoring of applications built with Groq.

Installation

  1. Install traceAI Groq
pip install traceAI-groq

Set Environment Variables

Set up your environment variables to authenticate with FutureAGI.

import os

os.environ["FI_API_KEY"] = FI_API_KEY
os.environ["FI_SECRET_KEY"] = FI_SECRET_KEY
os.environ["GROQ_API_KEY"] = GROQ_API_KEY

Quickstart

Register Tracer Provider

Set up the trace provider to establish the observability pipeline. The trace provider:

from fi_instrumentation import register
from fi_instrumentation.fi_types import ProjectType

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

Configure Groq Instrumentation

Instrument the Groq client to enable telemetry collection. This step ensures that all interactions with the Groq SDK are tracked and monitored.

from groq import Groq
from groq.types.chat import ChatCompletionToolMessageParam
from traceai_groq import GroqInstrumentor

GroqInstrumentor().instrument(tracer_provider=trace_provider)

def test():
    client = Groq(
        api_key=os.environ.get("GROQ_API_KEY"),
    )

    weather_function = {
        "type": "function",
        "function": {
            "name": "get_weather",
            "description": "finds the weather for a given city",
            "parameters": {
                "type": "object",
                "properties": {
                    "city": {
                        "type": "string",
                        "description": "The city to find the weather for, e.g. 'London'",
                    }
                },
                "required": ["city"],
            },
        },
    }

    sys_prompt = "Respond to the user's query using the correct tool."
    user_msg = "What's the weather like in San Francisco?"

    messages = [
        {"role": "system", "content": sys_prompt},
        {"role": "user", "content": user_msg},
    ]
    response = client.chat.completions.create(
        model="mixtral-8x7b-32768",
        messages=messages,
        temperature=0.0,
        tools=[weather_function],
        tool_choice="required",
    )

    message = response.choices[0].message
    assert (tool_calls := message.tool_calls)
    tool_call_id = tool_calls[0].id
    messages.append(message)
    messages.append(
        ChatCompletionToolMessageParam(
            content="sunny", role="tool", tool_call_id=tool_call_id
        ),
    )
    final_response = client.chat.completions.create(
        model="mixtral-8x7b-32768",
        messages=messages,
    )
    return final_response

if __name__ == "__main__":
    response = test()
    print("Response\n")
    print(response)

Metadata

Release files for traceAI-groq 0.1.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for traceAI-groq 0.1.11
File Size Uploaded Provenance Actions
traceai_groq-0.1.11.tar.gz 11.9 kB With provenance Details for traceai_groq-0.1.11.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for traceAI-groq 0.1.11
File Interpreter ABI Platform Actions
traceai_groq-0.1.11-py3-none-any.whl Python 3 none any Details for traceai_groq-0.1.11-py3-none-any.whl

Total release size: 26.2 kB

Release files / traceai_groq-0.1.11.tar.gz

Download URL traceai_groq-0.1.11.tar.gz
Size 11.9 kB
Tags Source
SHA-256 checksum
How to use checksums
4f12d8665a4663aa367ae9524addfbdf97f3a289ed97a89b062bbc84afde1284
BLAKE2b-256 checksum
How to use checksums
e2b8ad4faf135f338a854c204ce34b07ace96f55b7d1ac432fc2dae3c0e4feef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.

Transparency log

Release files / traceai_groq-0.1.11-py3-none-any.whl

Download URL traceai_groq-0.1.11-py3-none-any.whl
Size 14.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fb660d2111deaac92b5cc29035c75c3619052618a0ad838d72dd13d6e9f4d68b
BLAKE2b-256 checksum
How to use checksums
fd9e1e08f1a07669c81b4f08f0817355b7d3c04b74d4b5f5ed11f7812add3a1b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.

Transparency log

Security for traceAI-groq 0.1.11

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for traceai_groq-0.1.11.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page