Skip to content

API reference

Generated from the docstrings of the opengrade-ai package (sdk/src/opengrade). For a guided tour with examples, read the Python SDK guide first.

Everything documented here is importable from the top-level package, whatever module it is defined in:

from opengrade import Opengrade

og = Opengrade(project="my-app")  # tracking_uri defaults to http://localhost:8000


@og.trace
def answer(question: str) -> str: ...


result = og.evaluate(dataset="gold.jsonl", task=lambda item: answer(item.input), metrics=[...])
Page Contents
Tracing init_tracing, flush, @trace, span, span attributes, users / sessions / tags
Experiments evaluate, start_experiment, Experiment, ExperimentResult, sweep, evaluate_retrieval, chat test cases (chat_input, set_search_query)
Metrics and judges metric, LocalMetric, Sample, Score, LlmJudge
Production scores and feedback score_trace, log_score, log_feedback
Control plane client Client, AsyncClient, AppConfigClient
Configuration and errors Opengrade, Settings, active project, exceptions