-
-
Notifications
You must be signed in to change notification settings - Fork 134
[Agent] Code grooming around tool call #1010
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: main
Are you sure you want to change the base?
Conversation
lyrixx
commented
Nov 27, 2025
| Q | A |
|---|---|
| Bug fix? | no |
| New feature? | no |
| Docs? | no |
| Issues | |
| License | MIT |
| } | ||
|
|
||
| private function handleToolCallsCallback(Output $output): \Closure | ||
| private function handleToolCallsCallback(Output $output, ToolCallResult $result, ?AssistantMessage $streamedAssistantResponse = null): ResultInterface |
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 reduced the indirection. This reduce the depth in the stack.
|
|
||
| /** | ||
| * @param class-string $reference | ||
| * @param class-string $className |
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.
Let's use only one name for a "thing". Line 30, this is called className.
I think it's better to be consistant, it's easier to understand
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.
doesn't have to be a class tho, right?
| * List of executable tools. | ||
| * | ||
| * @var list<mixed> | ||
| * @var list<object> |
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.
We call ::class on item. So it must be an object. See linne 69
| $this->tools = $tools instanceof \Traversable ? iterator_to_array($tools) : $tools; | ||
| } | ||
|
|
||
| public function getTools(): array |
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.
There is something a bit hard to understand.
getTools does not return tool, but tools metadata !
I would like to rebame Tool to ToolMetadata, getTools() to getToolsMetadata()
It will really ease on-boarding I guess.
And it will fix inconsistency. For example :
private function getMetadata(ToolCall $toolCall): Tool8cd7562 to
42f101c
Compare
|
PR title: Tall or Tool? |
|
Ouch, too many typos 😅 . I edited the PR title. |
chr-hertel
left a comment
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.
fine after this small gotcha
| $results = []; | ||
| foreach ($toolCalls as $toolCall) { | ||
| $results[] = $toolResult = $this->toolbox->execute($toolCall); | ||
| // dd($toolResult); |
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.
this needs to go
|
and the PHPStan issue looks real - wonder if that's worth the trouble |