-
Notifications
You must be signed in to change notification settings - Fork 19.7k
feat(core): automatically count and store meta for tool call count #33756
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
CodSpeed Performance ReportMerging #33756 will not alter performanceComparing
|
| def _persist_run(self, run: Run) -> None: | ||
| """Persist a run.""" | ||
|
|
||
| def _store_tool_call_metadata(self, run: Run) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd put this all in _complete_llm_run in tracers/core. We don't need to do this on all runs IMO
| ) | ||
| llm_run.end_time = datetime.now(timezone.utc) | ||
| llm_run.events.append({"name": "end", "time": llm_run.end_time}) | ||
| store_tool_call_count_in_run(llm_run) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I really dislike side-effects but I understand they're a thing in Python
| return tool_call_count | ||
|
|
||
|
|
||
| def store_tool_call_count_in_run(run: Run, *, always_store: bool = False) -> int: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this really need to be its own function
Adds automatic tool call counting to tracing by means of a new
store_tool_call_count_in_run(), which calls on newly addedcount_tool_calls_in_run().Runs on successful LLM completion. Does not run on errored runs.