Skip to content

Conversation

@lyrixx
Copy link
Member

@lyrixx lyrixx commented Nov 27, 2025

Q A
Bug fix? no
New feature? no
Docs? no
Issues
License MIT

@carsonbot carsonbot added Agent Issues & PRs about the AI Agent component Status: Needs Review labels Nov 27, 2025
}

private function handleToolCallsCallback(Output $output): \Closure
private function handleToolCallsCallback(Output $output, ToolCallResult $result, ?AssistantMessage $streamedAssistantResponse = null): ResultInterface
Copy link
Member Author

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
Copy link
Member Author

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

Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure to understand. What could it be, if it's not a class, but the type is class-string?

* List of executable tools.
*
* @var list<mixed>
* @var list<object>
Copy link
Member Author

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
Copy link
Member Author

@lyrixx lyrixx Nov 27, 2025

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): Tool

@OskarStark
Copy link
Contributor

PR title: Tall or Tool?

@lyrixx lyrixx changed the title [Agent] Code groming arround tall call [Agent] Code grooming around tool call Nov 28, 2025
@lyrixx
Copy link
Member Author

lyrixx commented Nov 28, 2025

Ouch, too many typos 😅 . I edited the PR title.

Copy link
Member

@chr-hertel chr-hertel left a 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

@chr-hertel
Copy link
Member

and the PHPStan issue looks real - wonder if that's worth the trouble

@lyrixx
Copy link
Member Author

lyrixx commented Dec 2, 2025

and the PHPStan issue looks real - wonder if that's worth the trouble

There was a real issue with PHPStan. Since the code is now better, PHPStan found the typo. I fixed it.


Pr rebases, and cleaned. Ready for review

Note

there is a pending question about a bigger cleaning. It would happen in a new PR, But I would love to get an answer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Agent Issues & PRs about the AI Agent component Status: Needs Review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants