mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-08-06 10:42:39 +00:00
update example scripts to adapt agentconfig deparcated in v0.1.6
This commit is contained in:
parent
1efbe21937
commit
41c40954d7
1 changed files with 12 additions and 11 deletions
|
@ -217,16 +217,15 @@ client = LlamaStackClient(
|
||||||
base_url=f"http://localhost:8321",
|
base_url=f"http://localhost:8321",
|
||||||
provider_data = {"tavily_search_api_key": "your_TAVILY_SEARCH_API_KEY"})
|
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",
|
model="meta-llama/Llama-3.2-3B-Instruct",
|
||||||
instructions=(
|
instructions=(
|
||||||
"You are a highly knowledgeable and helpful web search assistant. "
|
"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. "
|
"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"],
|
tools=["builtin::websearch"],
|
||||||
)
|
)
|
||||||
agent = Agent(client, agent_config)
|
|
||||||
|
|
||||||
session_id = agent.create_session("websearch-session")
|
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.lib.agents.event_logger import EventLogger
|
||||||
from llama_stack_client import LlamaStackClient
|
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",
|
model="meta-llama/Llama-3.2-3B-Instruct",
|
||||||
instructions="You are a helpful wolfram_alpha assistant, use wolfram_alpha tool as external source validation.",
|
instructions="You are a helpful wolfram_alpha assistant, use wolfram_alpha tool as external source validation.",
|
||||||
toolgroups=["builtin::wolfram_alpha"],
|
tools=["builtin::wolfram_alpha"],
|
||||||
wolfram_api_key="your_WOLFRAM_ALPHA_API_KEY",
|
)
|
||||||
)
|
|
||||||
agent = Agent(client, agent_config)
|
|
||||||
|
|
||||||
session_id = agent.create_session("wolframa-alpha-session")
|
session_id = agent.create_session("wolframa-alpha-session")
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue