Skip to content

feat: Create Python SDK with auto-instrumentation #2

Description

@haasonsaas

🚀 Feature Request

Description

Create a Python version of eval2otel with auto-instrumentation capabilities, following OpenTelemetry's new instrumentation-genai patterns.

Motivation

Python is the dominant language in the AI/ML ecosystem. OpenTelemetry has started releasing Python instrumentation libraries for GenAI, and eval2otel should provide a Python SDK that aligns with these standards while offering zero-code instrumentation options.

Proposed Implementation

  1. Core Python Package

    • Port TypeScript functionality to Python
    • Use Pydantic for type safety and validation
    • Follow OpenTelemetry Python conventions
  2. Auto-Instrumentation

    • Support opentelemetry-instrument command
    • Automatic patching of popular AI libraries:
      • OpenAI
      • Anthropic
      • Google GenerativeAI
      • AWS Bedrock
      • Cohere
      • Hugging Face
  3. Configuration

    from eval2otel import Eval2Otel, EvalResult
    
    # Initialize
    eval2otel = Eval2Otel(
        service_name='my-ai-service',
        capture_content=True,
        sample_content_rate=0.1
    )
    
    # Auto-instrument
    from eval2otel.auto import instrument_all
    instrument_all()
    
    # Or specific providers
    from eval2otel.instrumentations import instrument_openai
    instrument_openai()
  4. Zero-Code Usage

    # Run with auto-instrumentation
    opentelemetry-instrument \
      --traces_exporter otlp \
      --metrics_exporter otlp \
      --service_name my-service \
      python main.py
  5. Environment Variables

    • OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT
    • EVAL2OTEL_SAMPLE_RATE
    • EVAL2OTEL_REDACT_PII

Deliverables

  • Python package on PyPI
  • Auto-instrumentation support
  • Documentation and examples
  • Integration tests
  • Type hints and Pydantic models

References

Priority

High - Python support is critical for AI/ML ecosystem adoption

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions