Skip to main content

Python SDK for Omneval LLM tracing

Project description

Omneval Python SDK

Python SDK for Omneval LLM tracing and evaluation.

Installation

pip install omneval-sdk

Quick Start

import omneval_sdk

# Configure the SDK at application startup
omneval_sdk.configure(
    endpoint="http://localhost:4318",  # Omneval ingest endpoint
    api_key="oev_proj_your_api_key",
)

# Decorate functions to trace them
@omneval_sdk.trace
def call_llm(prompt):
    span = omneval_sdk.get_active_span()
    omneval_sdk.set_model(span, "gpt-4o")
    omneval_sdk.set_input(span, prompt)
    omneval_sdk.set_output(span, "Hello!")
    return "done"

result = call_llm("What is 2+2?")

API Reference

omneval_sdk.configure(endpoint, api_key)

Configure the OTLP HTTP exporter pointing at the Omneval ingest API. Must be called once at startup.

@omneval_sdk.trace

Decorator that wraps a function in an OTel span sent to Omneval. Nested decorated functions produce correctly linked parent-child span trees.

omneval_sdk.set_input(span, input_value)

Attach input data to a span as the omneval.input attribute.

omneval_sdk.set_output(span, output_value)

Attach output data to a span as the omneval.output attribute.

omneval_sdk.set_model(span, model)

Attach the model name to a span as the gen_ai.request.model attribute.

omneval_sdk.set_tokens(span, input_tokens, output_tokens)

Attach token counts to a span as gen_ai.usage.input_tokens and gen_ai.usage.output_tokens.

omneval_sdk.get_active_span()

Return the currently active span from the context variable. Returns None outside a decorated function.

omneval_sdk.OmnevalClient(base_url, api_key, project_id=None)

HTTP client for prompt fetching and manual score writes.

The project_id is automatically extracted from the API key suffix (e.g. oev_proj_my-projectmy-project). Pass project_id explicitly to override this behavior.

client = omneval_sdk.OmnevalClient("http://localhost:8080", "oev_proj_my-project")
prompt = client.get_prompt("greeting", "production")
client.write_score("span-id-123", "helpfulness", 0.8, "Good reasoning")

client.write_score(span_id, eval_name, value, reasoning="")

Submit a manual score for a span. The project_id from the client configuration is automatically included in the request.

Args:

  • span_id (str, required): The span ID to score.
  • eval_name (str): Name of the evaluation (e.g. "helpfulness", "correctness").
  • value (float): Numeric score value (typically 0.0–1.0).
  • reasoning (str, optional): Human-readable reasoning for the score.

Returns: None on success (201 Created).

Raises:

  • ValueError: If span_id is empty.
  • requests.HTTPError: If the server returns an error (e.g. 400 Bad Request, 500 Internal Server Error).
client.write_score(
    span_id="span-abc123",
    eval_name="correctness",
    value=0.9,
    reasoning="The answer correctly identified the entity",
)

Exports

All key helper functions are exported from the top-level omneval_sdk package:

from omneval_sdk import (
    trace,           # @trace decorator
    configure,       # configure endpoint
    OmnevalClient,   # HTTP client
    set_input,       # set input on span
    set_output,      # set output on span
    set_model,       # set model on span
    set_tokens,      # set token counts on span
    get_active_span, # get current span
)

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

omneval_sdk-0.0.64.tar.gz (51.2 kB view details)

Uploaded Source

Built Distribution

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

omneval_sdk-0.0.64-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file omneval_sdk-0.0.64.tar.gz.

File metadata

  • Download URL: omneval_sdk-0.0.64.tar.gz
  • Upload date:
  • Size: 51.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for omneval_sdk-0.0.64.tar.gz
Algorithm Hash digest
SHA256 b1e775110727d9d6196e6859eb530d366900a57d710849b17e8dc68c5e975153
MD5 d5b6e1835900ad38b0e65e1cac86cfcc
BLAKE2b-256 e21e10d5aa97bdae8330d611faffac40aecb5aa83c4598eb59e3e02660165e17

See more details on using hashes here.

Provenance

The following attestation bundles were made for omneval_sdk-0.0.64.tar.gz:

Publisher: release.yml on omneval/omneval

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

File details

Details for the file omneval_sdk-0.0.64-py3-none-any.whl.

File metadata

  • Download URL: omneval_sdk-0.0.64-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for omneval_sdk-0.0.64-py3-none-any.whl
Algorithm Hash digest
SHA256 5c6cc40b89d3528efc389140f88fa13f9f3b65295ba70655ef5192271fcd6acd
MD5 57bad19ec7a05b7263c79c31207f8a9b
BLAKE2b-256 09d94a068813836686807780339060856b45cda56c5e20b484f0bb6bb0e24152

See more details on using hashes here.

Provenance

The following attestation bundles were made for omneval_sdk-0.0.64-py3-none-any.whl:

Publisher: release.yml on omneval/omneval

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