feat(import): OTel GenAI traces → eval fixtures/trajectories (#15)#23
Merged
Conversation
Ingest an OTLP trace export as a replayable eval suite — one EvalCase per trace
(input from the GenAI prompt, expected from the completion, ordered tool calls as
a trajectory). Fixture ingestion, NOT a trace dashboard (the explicit anti-goal).
- importers/otel.py: import_otel(file_path, ...) parses resourceSpans →
scopeSpans → spans, groups by traceId (ordered by start time), and maps each
trace to an EvalCase. Handles both content styles — structured
gen_ai.input/output.messages and indexed OpenLLMetry gen_ai.{prompt,completion}
.{i}. A trace with tool calls → expected.tools + the tool-check grader
(trajectory); no input → skipped; bad file → OtelImportError.
- commands/importers.py: `import --from otel --file traces.json` (--file added;
--db now optional, required per-source); reuses export_suite_yaml.
- README: the otel import example.
Tests: test_otel_import.py (replay fixture, tools→trajectory/tool-check, indexed
OpenLLMetry style, skip-no-input, group-by-trace, bad-file→error). pytest 6/6 +
48 import tests green (no regression); mypy + ruff clean.
Closes #15.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019tXZpN29akdmG8AEjgSZwk
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #15.
What: ingest an OTLP trace export as a replayable eval suite — one EvalCase per trace (input from the GenAI prompt, expected from the completion, ordered tool calls as a trajectory). Fixture ingestion, NOT a trace dashboard (the explicit anti-goal).
How:
importers/otel.py—import_otel(file_path, ...)parses resourceSpans → scopeSpans → spans, groups bytraceId(ordered by start time), maps each trace to an EvalCase. Handles both content styles — structuredgen_ai.input/output.messagesand indexed OpenLLMetrygen_ai.{prompt,completion}.{i}. A trace with tool calls →expected.tools+ the tool-check grader; no input → skipped; bad file →OtelImportError.commands/importers.py—import --from otel --file traces.json(--fileadded;--dbnow optional, required per-source); reusesexport_suite_yaml.Tests:
test_otel_import.py(replay fixture, tools→trajectory/tool-check, indexed OpenLLMetry style, skip-no-input, group-by-trace, bad-file→error). pytest 6/6 + 48 import tests green (no regression); mypy + ruff clean.