Skip to content

Commit 7e0b4fc

Browse files
authored
Resolve TODO comment (#2728)
1 parent fc4c0e2 commit 7e0b4fc

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

pydantic_evals/pydantic_evals/dataset.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -849,11 +849,10 @@ async def _run_task(
849849
_CURRENT_TASK_RUN.reset(token)
850850

851851
if isinstance(span_tree, SpanTree): # pragma: no branch
852-
# TODO: Question: Should we make this metric-attributes functionality more user-configurable in some way before merging?
853-
# Note: the use of otel for collecting these metrics is the main reason why I think we should require at least otel as a dependency, if not logfire;
854-
# otherwise, we don't have a great way to get usage data from arbitrary frameworks.
855-
# Ideally we wouldn't need to hard-code the specific logic here, but I'm not sure a great way to expose it to
856-
# users. Maybe via an argument of type Callable[[SpanTree], dict[str, int | float]] or similar?
852+
# Idea for making this more configurable: replace the following logic with a call to a user-provided function
853+
# of type Callable[[_TaskRun, SpanTree], None] or similar, (maybe no _TaskRun and just use the public APIs).
854+
# That way users can customize this logic. We'd default to a function that does the current thing but also
855+
# allow `None` to disable it entirely.
857856
for node in span_tree:
858857
if node.attributes.get('gen_ai.operation.name') == 'chat':
859858
task_run.increment_metric('requests', 1)

0 commit comments

Comments
 (0)