Skip to main content

OpenTelemetry SDK for Coalex.ai with OTLP integration

Project description

Coalex SDK

A Python package for OpenTelemetry integration with Coalex.ai observability platform.

Installation

pip install coalex

Quick Start with VertexAI

from coalex.otel import register, add_request_context
from openinference.instrumentation.vertexai import VertexAIInstrumentor
from vertexai.generative_models import GenerativeModel

# Register Coalex tracing
tracer_provider = register(
    agent_id="YOUR_AGENT_ID"
)

# Instrument VertexAI with Coalex tracer
VertexAIInstrumentor().instrument(tracer_provider=tracer_provider)

# Create model instance
model = GenerativeModel("gemini-2.0-flash")

# Add request context for this interaction
add_request_context(
    request_id="req_vertex_001",
    prompt_version="v1.0.0"
)

# Generate content - this will be automatically traced
response = model.generate_content(
    "Write a haiku about artificial intelligence.",
    generation_config={
        "max_output_tokens": 100,
        "temperature": 0.7,
    }
)

print("Generated haiku:")
print(response.text)

Features

  • Simple Setup: One-line registration with register()
  • Coalex Integration: Default endpoint for Coalex observability platform
  • Request Context: Easy addition of request_id and prompt_version
  • OpenInference Compatible: Works with all OpenInference instrumentors
  • Authentication: Automatic authentication using agent_id

Configuration

  • agent_id: Your unique agent identifier (required for authentication)
  • endpoint: OTLP endpoint (defaults to Coalex: https://traces.coalex.ai/v1/traces)
  • service_name: Name of the service (default: "coalex-service")

Example

See examples/vertexai_example.py for a complete working example including:

  • Basic content generation
  • Streaming responses
  • Proper error handling
  • Request context management

To run the example, install the additional dependencies:

pip install google-cloud-aiplatform openinference-instrumentation-vertexai

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

coalex-0.1.0.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

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

coalex-0.1.0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: coalex-0.1.0.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for coalex-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6d736c6d0fa31a8c0d72db19caed155c18302bd8eb09068ac53b11a8056e8c4d
MD5 006f2fea19758588e6a80f3e38c2d80e
BLAKE2b-256 c5219a0e889a78b591774fe2fc0d46d681896015011ec23ecc8f35d7233b9f24

See more details on using hashes here.

Provenance

The following attestation bundles were made for coalex-0.1.0.tar.gz:

Publisher: publish.yml on carlosmlribeiro/coalex.ai

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: coalex-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for coalex-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8ce63b8f89b482427b1b9c3740458c23b05961d7187427cb2f6077ee8b487093
MD5 fbae883688b3e8411a3583580506faa7
BLAKE2b-256 2ee0fe72594d652170e9c259aacfd3cd477da1e9beb32320fcb7fe767cb46242

See more details on using hashes here.

Provenance

The following attestation bundles were made for coalex-0.1.0-py3-none-any.whl:

Publisher: publish.yml on carlosmlribeiro/coalex.ai

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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