🚀 Use Symfony's autowiring to dynamically inject AI tools #187
robiningelbrecht
started this conversation in
General
Replies: 2 comments
-
|
Link to the PR with the actual implementation: https://github.com/robiningelbrecht/statistics-for-strava/pull/358/files |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Very clear pattern. Thank you for sharing! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm making extensive use of the tools feature to build an AI Agent, and I’ve set up a pattern that might be useful for others working with Symfony.
Tag Your Tools Automatically
First, I configure Symfony to automatically tag all services implementing
ToolInterfaceInject All Tools Into a Toolkit
Next, I use the
#[AutowireIterator]attribute to collect all tagged tools and inject them into a `Toolkit classWiring the Toolkit into Your Agent
Once the toolkit is set up, injecting it into the agent and using it is straightforward:
Beta Was this translation helpful? Give feedback.
All reactions