fix tool example with additional args (#228)

This commit is contained in:
RolandJAAI 2025-01-16 23:00:11 +01:00 committed by GitHub
parent a4ec1e5be3
commit a1d8f3c398
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -131,7 +131,7 @@ And voilà, here's your image! 🏖️
<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/sunny_beach.webp"> <img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/sunny_beach.webp">
Then you can use this tool just like any other tool. For example, let's improve the prompt `a rabbit wearing a space suit` and generate an image of it. Then you can use this tool just like any other tool. For example, let's improve the prompt `a rabbit wearing a space suit` and generate an image of it. This example also shows how you can pass additional arguments to the agent.
```python ```python
from smolagents import CodeAgent, HfApiModel from smolagents import CodeAgent, HfApiModel
@ -140,7 +140,7 @@ model = HfApiModel("Qwen/Qwen2.5-Coder-32B-Instruct")
agent = CodeAgent(tools=[image_generation_tool], model=model) agent = CodeAgent(tools=[image_generation_tool], model=model)
agent.run( agent.run(
"Improve this prompt, then generate an image of it.", prompt='A rabbit wearing a space suit' "Improve this prompt, then generate an image of it.", additional_args={'user_prompt': 'A rabbit wearing a space suit'}
) )
``` ```