diff --git a/units/en/unit2/smolagents/code_agents.mdx b/units/en/unit2/smolagents/code_agents.mdx index d9ab32394..e97ba0b51 100644 --- a/units/en/unit2/smolagents/code_agents.mdx +++ b/units/en/unit2/smolagents/code_agents.mdx @@ -91,7 +91,9 @@ Running an agent is quite straightforward: ```python from smolagents import CodeAgent, DuckDuckGoSearchTool, InferenceClientModel -agent = CodeAgent(tools=[DuckDuckGoSearchTool()], model=InferenceClientModel()) +web_search = DuckDuckGoSearchTool(max_results=5, rate_limit=2.0) + +agent = CodeAgent(tools=[web_search], model=InferenceClientModel()) agent.run("Search for the best music recommendations for a party at the Wayne's mansion.") ``` @@ -286,11 +288,12 @@ class SuperheroPartyThemeTool(Tool): return themes.get(category.lower(), "Themed party idea not found. Try 'classic heroes', 'villain masquerade', or 'futuristic Gotham'.") +web_search = DuckDuckGoSearchTool(max_results=5, rate_limit=2.0) # Alfred, the butler, preparing the menu for the party agent = CodeAgent( tools=[ - DuckDuckGoSearchTool(), + web_search, VisitWebpageTool(), suggest_menu, catering_service_tool, diff --git a/units/es/unit2/smolagents/code_agents.mdx b/units/es/unit2/smolagents/code_agents.mdx index 5866cbad6..e43b55d51 100644 --- a/units/es/unit2/smolagents/code_agents.mdx +++ b/units/es/unit2/smolagents/code_agents.mdx @@ -89,7 +89,9 @@ Ejecutar un agente es bastante sencillo: ```python from smolagents import CodeAgent, DuckDuckGoSearchTool, InferenceClientModel -agent = CodeAgent(tools=[DuckDuckGoSearchTool()], model=InferenceClientModel()) +web_search = DuckDuckGoSearchTool(max_results=5, rate_limit=2.0) + +agent = CodeAgent(tools=[web_search], model=InferenceClientModel()) agent.run("Busca las mejores recomendaciones de música para una fiesta en la mansión de los Wayne.") ``` @@ -278,11 +280,12 @@ class SuperheroPartyThemeTool(Tool): return themes.get(category.lower(), "Idea de fiesta temática no encontrada. Prueba con 'héroes clásicos', 'mascarada de villanos' o 'Gotham futurista'.") +web_search = DuckDuckGoSearchTool(max_results=5, rate_limit=2.0) # Alfred, el mayordomo, preparando el menú para la fiesta agent = CodeAgent( tools=[ - DuckDuckGoSearchTool(), + web_search, VisitWebpageTool(), suggest_menu, catering_service_tool, diff --git a/units/fr/unit2/smolagents/code_agents.mdx b/units/fr/unit2/smolagents/code_agents.mdx index f0a297c96..0a48208c1 100644 --- a/units/fr/unit2/smolagents/code_agents.mdx +++ b/units/fr/unit2/smolagents/code_agents.mdx @@ -91,7 +91,9 @@ Exécuter un agent est assez simple : ```python from smolagents import CodeAgent, DuckDuckGoSearchTool, InferenceClientModel -agent = CodeAgent(tools=[DuckDuckGoSearchTool()], model=InferenceClientModel()) +web_search = DuckDuckGoSearchTool(max_results=5, rate_limit=2.0) + +agent = CodeAgent(tools=[web_search], model=InferenceClientModel()) agent.run("Recherche les meilleures recommandations musicales pour une fête au manoir des Wayne.") ``` @@ -285,11 +287,12 @@ class SuperheroPartyThemeTool(Tool): return themes.get(category.lower(), "Idée de fête thématique non trouvée. Essayez 'héros classiques', 'mascarade de méchants', ou 'Gotham futuriste'.") +web_search = DuckDuckGoSearchTool(max_results=5, rate_limit=2.0) # Alfred, le majordome, préparant le menu pour la fête agent = CodeAgent( tools=[ - DuckDuckGoSearchTool(), + web_search, VisitWebpageTool(), suggest_menu, catering_service_tool, diff --git a/units/ko/unit2/smolagents/code_agents.mdx b/units/ko/unit2/smolagents/code_agents.mdx index fcba655d7..bf7a84e1a 100644 --- a/units/ko/unit2/smolagents/code_agents.mdx +++ b/units/ko/unit2/smolagents/code_agents.mdx @@ -93,7 +93,9 @@ login() ```python from smolagents import CodeAgent, DuckDuckGoSearchTool, InferenceClientModel -agent = CodeAgent(tools=[DuckDuckGoSearchTool()], model=InferenceClientModel()) +web_search = DuckDuckGoSearchTool(max_results=5, rate_limit=2.0) + +agent = CodeAgent(tools=[web_search], model=InferenceClientModel()) agent.run("웨인 저택에서 열리는 파티에 어울리는 최고의 음악 추천을 검색해줘.") ``` @@ -284,11 +286,12 @@ class SuperheroPartyThemeTool(Tool): return themes.get(category.lower(), "테마 파티 아이디어를 찾을 수 없습니다. 'classic heroes', 'villain masquerade', 'futuristic Gotham' 중에서 시도해보세요.") +web_search = DuckDuckGoSearchTool(max_results=5, rate_limit=2.0) # Alfred가 파티 메뉴를 준비합니다 agent = CodeAgent( tools=[ - DuckDuckGoSearchTool(), + web_search, VisitWebpageTool(), suggest_menu, catering_service_tool, diff --git a/units/zh-CN/unit2/smolagents/code_agents.mdx b/units/zh-CN/unit2/smolagents/code_agents.mdx index 421967831..b34b5635e 100644 --- a/units/zh-CN/unit2/smolagents/code_agents.mdx +++ b/units/zh-CN/unit2/smolagents/code_agents.mdx @@ -89,7 +89,9 @@ login() ```python from smolagents import CodeAgent, DuckDuckGoSearchTool, InferenceClientModel -agent = CodeAgent(tools=[DuckDuckGoSearchTool()], model=InferenceClientModel()) +web_search = DuckDuckGoSearchTool(max_results=5, rate_limit=2.0) + +agent = CodeAgent(tools=[web_search], model=InferenceClientModel()) agent.run("Search for the best music recommendations for a party at the Wayne's mansion.") ``` @@ -279,11 +281,12 @@ class SuperheroPartyThemeTool(Tool): return themes.get(category.lower(), "Themed party idea not found. Try 'classic heroes', 'villain masquerade', or 'futuristic Gotham'.") +web_search = DuckDuckGoSearchTool(max_results=5, rate_limit=2.0) # 管家阿尔弗雷德,为派对准备菜单 agent = CodeAgent( tools=[ - DuckDuckGoSearchTool(), + web_search, VisitWebpageTool(), suggest_menu, catering_service_tool,