From 41c40954d7fd9ea748ed1dfd26332cc57ca74882 Mon Sep 17 00:00:00 2001 From: Yu An Date: Tue, 11 Mar 2025 10:28:33 +0000 Subject: [PATCH] update example scripts to adapt agentconfig deparcated in v0.1.6 --- docs/source/building_applications/tools.md | 23 +++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/docs/source/building_applications/tools.md b/docs/source/building_applications/tools.md index ab67200d2..a11e546b6 100644 --- a/docs/source/building_applications/tools.md +++ b/docs/source/building_applications/tools.md @@ -217,16 +217,15 @@ client = LlamaStackClient( base_url=f"http://localhost:8321", provider_data = {"tavily_search_api_key": "your_TAVILY_SEARCH_API_KEY"}) -agent_config = AgentConfig( +agent = Agent( + client, model="meta-llama/Llama-3.2-3B-Instruct", instructions=( "You are a highly knowledgeable and helpful web search assistant. " - "Your primary goal is to provide accurate and reliable information to the user. " "Whenever you encounter a query, make sure to use the websearch tools to look up the most current and precise information available. " ), - toolgroups=["builtin::websearch"], -) -agent = Agent(client, agent_config) + tools=["builtin::websearch"], + ) session_id = agent.create_session("websearch-session") @@ -245,15 +244,17 @@ from llama_stack_client.types.agent_create_params import AgentConfig from llama_stack_client.lib.agents.event_logger import EventLogger from llama_stack_client import LlamaStackClient -client = LlamaStackClient(base_url=f"http://localhost:8321") +client = LlamaStackClient( + base_url=f"http://localhost:8321", + provider_data = {"wolfram_alpha_api_key": "your_wolfram_api_key"} + ) -agent_config = AgentConfig( +agent = Agent( + client, model="meta-llama/Llama-3.2-3B-Instruct", instructions="You are a helpful wolfram_alpha assistant, use wolfram_alpha tool as external source validation.", - toolgroups=["builtin::wolfram_alpha"], - wolfram_api_key="your_WOLFRAM_ALPHA_API_KEY", -) -agent = Agent(client, agent_config) + tools=["builtin::wolfram_alpha"], + ) session_id = agent.create_session("wolframa-alpha-session")