Skip to main content

Overview

This guide shows you how to integrate Latitude Telemetry into an application that uses the Groq SDK.
You’ll keep calling Groq exactly as you do today. Telemetry simply observes and enriches those calls.
Auto-instrumentation for Groq is available in the Python SDK. For other languages, send traces via the OpenTelemetry exporter.

Requirements

  • A Latitude account and API key
  • A Latitude project slug
  • A project that uses the Groq SDK (groq)
  • A Groq API key (set as GROQ_API_KEY)

Steps

1

Install

pip install latitude-telemetry groq
2

Initialize and use

import groq
from groq import Groq

from latitude_telemetry import Latitude, capture

latitude = Latitude(
    api_key="your-api-key",
    project="your-project-slug",
    instrumentations={"groq": groq},
)

client = Groq()

def generate_reply():
    response = client.chat.completions.create(
        model="llama-3.1-8b-instant",
        messages=[{"role": "user", "content": "Hello"}],
    )
    return response.choices[0].message.content

capture("generate-reply", generate_reply)

latitude.shutdown()

Seeing Your Traces

Once connected, traces appear automatically in Latitude:
  1. Open your project in the Latitude dashboard
  2. Each execution shows input/output messages, model, token usage, latency, and errors