Documentation
Platform/Python SDK

Python SDK

Learn how to integrate Noveum's Python SDK for comprehensive AI application tracing.

The Noveum Python SDK provides seamless integration for tracing AI applications with context manager-based APIs.

🚀 Quick Start

from noveum_trace import trace_llm, trace_operation
 
# Basic LLM tracing
with trace_llm(
    model="gpt-4",
    input="What is machine learning?",
    output="Machine learning is..."
) as span:
    # Your LLM call here
    pass
 
# Custom operation tracing
with trace_operation("data_processing") as span:
    # Your custom logic here
    span.set_attribute("records_processed", 1000)

🔧 Key Features

Context Manager-Based Tracing

  • Seamless Integration: Drop-in replacement for existing code
  • Automatic Cleanup: Handles span lifecycle automatically
  • Error Handling: Built-in error tracking and reporting

Automatic Instrumentation

  • LangChain: Automatic tracing for chains and agents
  • LlamaIndex: Built-in support for RAG pipelines
  • OpenAI: Direct integration with OpenAI API calls

Production-Ready Features

  • Intelligent Sampling: Reduce overhead in production
  • Async Support: Full async/await compatibility
  • Batching: Efficient data transmission

📚 Framework Integrations

LangChain Integration

from noveum_trace.langchain import NoveumCallbackHandler
 
# Add to your LangChain chain
chain = LLMChain(llm=llm, prompt=prompt)
chain.run("Hello world", callbacks=[NoveumCallbackHandler()])

FastAPI Integration

from fastapi import FastAPI
from noveum_trace.fastapi import NoveumMiddleware
 
app = FastAPI()
app.add_middleware(NoveumMiddleware)

🎯 Advanced Usage

Custom Attributes & Events

with trace_llm(model="gpt-4") as span:
    span.set_attribute("user_id", "12345")
    span.add_event("model_loaded", {"timestamp": "2024-01-01"})

Sampling Configuration

from noveum_trace import configure_sampling
 
configure_sampling(
    sample_rate=0.1,  # 10% sampling in production
    max_traces_per_minute=100
)

📖 Documentation

Exclusive Early Access

Get Early Access to Noveum.ai Platform

Be the first one to get notified when we open Noveum Platform to more users. All users get access to Observability suite for free, early users get free eval jobs and premium support for the first year.

Sign up now. We send access to new batch every week.

Early access members receive premium onboarding support and influence our product roadmap. Limited spots available.

On this page