Skip to main content

OpenTelemetry instrumentation for Fireworks AI

Project description

TraceAI Fireworks AI Instrumentation

OpenTelemetry instrumentation for Fireworks AI, enabling comprehensive observability for LLM API calls.

Installation

pip install traceai-fireworks

Quick Start

from fi_instrumentation import register
from fi_instrumentation.fi_types import ProjectType
from traceai_fireworks import FireworksInstrumentor

# Setup TraceAI
trace_provider = register(
    project_type=ProjectType.OBSERVE,
    project_name="my-fireworks-app",
)

# Instrument Fireworks
FireworksInstrumentor().instrument(tracer_provider=trace_provider)

# Now use OpenAI client with Fireworks
from openai import OpenAI

client = OpenAI(
    api_key="your-fireworks-api-key",
    base_url="https://api.fireworks.ai/inference/v1",
)

response = client.chat.completions.create(
    model="accounts/fireworks/models/llama-v3p1-8b-instruct",
    messages=[{"role": "user", "content": "Hello!"}]
)

Features

  • Automatic tracing of Fireworks AI API calls
  • Support for both synchronous and asynchronous operations
  • Streaming response support
  • Token usage tracking
  • Request/response attribute capture
  • OpenTelemetry semantic conventions for GenAI

Captured Attributes

  • gen_ai.request.model - Model name
  • gen_ai.request.max_tokens - Maximum tokens
  • gen_ai.request.temperature - Temperature setting
  • gen_ai.usage.input_tokens - Input token count
  • gen_ai.usage.output_tokens - Output token count
  • gen_ai.prompt.{n}.role - Message roles
  • gen_ai.prompt.{n}.content - Message contents
  • gen_ai.completion.{n}.content - Response content

Requirements

  • Python >= 3.9
  • openai >= 1.0.0
  • fi-instrumentation >= 0.1.0
  • opentelemetry-api >= 1.0.0
  • opentelemetry-sdk >= 1.0.0

License

Apache-2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

traceai_fireworks-0.1.0.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

traceai_fireworks-0.1.0-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file traceai_fireworks-0.1.0.tar.gz.

File metadata

  • Download URL: traceai_fireworks-0.1.0.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for traceai_fireworks-0.1.0.tar.gz
Algorithm Hash digest
SHA256 eca92117daf4c69f7a2f6f6b1081ea4b8674dd304ba9a6c419ca468e304c7ac5
MD5 140b2c5d37f37acae4f14ac0c7b383d9
BLAKE2b-256 16041671f5ccf08d5b7792ba6846b559754c5552939760b4ba3d62123c8bfe4b

See more details on using hashes here.

File details

Details for the file traceai_fireworks-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: traceai_fireworks-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for traceai_fireworks-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5bc7b9d263e9b8857d6eb30b89bfb74981a7511c0230a1c245963d0999502c84
MD5 32fa90d123bdbbd31c6ec0801e5e6aa8
BLAKE2b-256 4a43986c8e2e3f710cda9b4b51b11d0b0c909ccd6933ff5ba2f8905acd2752f0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page