@@ -15,13 +15,13 @@ Example Use Cases
1515-----------------
1616
1717The example use-cases assume that you are working with the Symfony AI demo application, where an agent named
18- `blog ` is already defined with a set of tools.
18+ `` blog ` ` is already defined with a set of tools.
1919
2020Requirement: Set Up Dynamic Toolbox Class
2121~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2222
23- First, create a class that implements the `ToolboxInterface ` and, in its constructor, accepts
24- another `ToolboxInterface ` instance to delegate calls to the original toolbox. This implements the decorator
23+ First, create a class that implements the `` ToolboxInterface ` ` and, in its constructor, accepts
24+ another `` ToolboxInterface ` ` instance to delegate calls to the original toolbox. This implements the decorator
2525pattern.
2626
2727
@@ -56,18 +56,18 @@ pattern.
5656 }
5757 }
5858
59- By utilizing the `AsDecorator ` attribute, this class will automatically decorate the existing toolbox
60- for the `blog ` agent, and the `AutowireDecorated ` attribute will inject the original toolbox instance to
59+ By utilizing the `` AsDecorator ` ` attribute, this class will automatically decorate the existing toolbox
60+ for the `` blog `` agent, and the `` AutowireDecorated ` ` attribute will inject the original toolbox instance to
6161ensure that existing functionality is preserved and does not need to be reimplemented.
6262
6363Case 1: Customizing Tools at Runtime
6464~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6565
66- To change a tool description dynamically, override the `getTools ` method in the
67- `DynamicToolbox ` class. Here is an example of how to modify the description of a specific tool.
66+ To change a tool description dynamically, override the `` getTools ` ` method in the
67+ `` DynamicToolbox ` ` class. Here is an example of how to modify the description of a specific tool.
6868
6969
70- Let's assume that the existing tool `similarity_search ` should not have a general-purpose description,
70+ Let's assume that the existing tool `` similarity_search ` ` should not have a general-purpose description,
7171but instead a description that blocks general questions unless someone asks very politely, in which case it
7272allows use of the tool.
7373
@@ -97,7 +97,7 @@ allows use of the tool.
9797 }
9898
9999
100- With this implementation, whenever the `similarity_search ` tool is requested, it will have the new
100+ With this implementation, whenever the `` similarity_search ` ` tool is requested, it will have the new
101101description that enforces the search term argument to include the word "please". For example,
102102a question like "Find articles about Symfony" would become "articles symfony please".
103103
@@ -109,7 +109,7 @@ Case 2: Removing a Tool
109109
110110
111111To remove a tool dynamically, for example due to missing feature toggles, you can filter out the tool
112- in the `getTools ` method. In the following example, we simulate a feature toggle that is disabled, so
112+ in the `` getTools ` ` method. In the following example, we simulate a feature toggle that is disabled, so
113113the clock tool must not be available to the agent registered for the blog toolbox by default.
114114
115115
@@ -132,15 +132,15 @@ the clock tool must not be available to the agent registered for the blog toolbo
132132
133133
134134With this, and utilizing the blog example in the Symfony AI demo application, the agent will not be able
135- to tell the date or time. Only if the `toggleClockFeature ` is set to `true ` will the agent answer with the
135+ to tell the date or time. Only if the `` toggleClockFeature `` is set to `` true ` ` will the agent answer with the
136136current date and time again.
137137
138138Case 3: Adding a Tool
139139~~~~~~~~~~~~~~~~~~~~~
140140
141141
142- To add a new tool dynamically, instantiate a new `Tool ` object and append it to the list of tools
143- returned by the `getTools ` method. In the following example, we add a simple echo tool that returns whatever
142+ To add a new tool dynamically, instantiate a new `` Tool ` ` object and append it to the list of tools
143+ returned by the `` getTools ` ` method. In the following example, we add a simple echo tool that returns whatever
144144input it receives. Notably, this example will also intercept the requested tool execution and respond directly
145145with an uppercased version of the input.
146146
@@ -186,8 +186,8 @@ with an uppercased version of the input.
186186 }
187187
188188
189- With this implementation, the `echo ` tool will be available to the agent alongside the existing tools.
190- You can test this by using the blog example again and explicitly asking the agent to utilize the `echo ` tool.
189+ With this implementation, the `` echo ` ` tool will be available to the agent alongside the existing tools.
190+ You can test this by using the blog example again and explicitly asking the agent to utilize the `` echo ` ` tool.
191191
192192
193193Example:
0 commit comments