diff --git a/examples/agents/e2e_loop_with_client_tools.py b/examples/agents/e2e_loop_with_client_tools.py index fdfa4d21..82ae8cb9 100644 --- a/examples/agents/e2e_loop_with_client_tools.py +++ b/examples/agents/e2e_loop_with_client_tools.py @@ -9,10 +9,7 @@ from examples.client_tools.ticker_data import get_ticker_data from examples.client_tools.web_search import WebSearchTool from examples.client_tools.calculator import calculator -from llama_stack_client import LlamaStackClient -from llama_stack_client.lib.agents.agent import Agent -from llama_stack_client.lib.agents.event_logger import EventLogger -from llama_stack_client.types.agent_create_params import AgentConfig +from llama_stack_client import LlamaStackClient, Agent, AgentEventLogger async def run_main(host: str, port: int, disable_safety: bool = False): @@ -77,7 +74,7 @@ async def run_main(host: str, port: int, disable_safety: bool = False): session_id=session_id, ) - for log in EventLogger().log(response): + for log in AgentEventLogger().log(response): log.print() diff --git a/examples/agents/hello.py b/examples/agents/hello.py index 8035cc3d..973fb84f 100644 --- a/examples/agents/hello.py +++ b/examples/agents/hello.py @@ -4,16 +4,13 @@ # This source code is licensed under the terms described in the LICENSE file in # the root directory of this source tree. import os -from typing import Optional import fire -from llama_stack_client import LlamaStackClient -from llama_stack_client.lib.agents.agent import Agent -from llama_stack_client.lib.agents.event_logger import EventLogger +from llama_stack_client import LlamaStackClient, Agent, AgentEventLogger from termcolor import colored -def main(host: str, port: int, model_id: Optional[str] = None): +def main(host: str, port: int, model_id: str | None = None): if "TAVILY_SEARCH_API_KEY" not in os.environ: print( colored( @@ -97,7 +94,7 @@ def main(host: str, port: int, model_id: Optional[str] = None): session_id=session_id, ) - for log in EventLogger().log(response): + for log in AgentEventLogger().log(response): log.print() diff --git a/examples/agents/inflation.py b/examples/agents/inflation.py index 3cd7d273..f45fb5f2 100644 --- a/examples/agents/inflation.py +++ b/examples/agents/inflation.py @@ -7,11 +7,7 @@ import os import fire -from llama_stack_client import LlamaStackClient -from llama_stack_client.lib.agents.agent import Agent -from llama_stack_client.lib.agents.event_logger import EventLogger -from llama_stack_client.types.agent_create_params import AgentConfig -from llama_stack_client.types.agents.turn_create_params import Document +from llama_stack_client import LlamaStackClient, Agent, AgentEventLogger, Document from termcolor import colored @@ -45,7 +41,8 @@ def run_main(host: str, port: int, disable_safety: bool = False): agent = Agent( client, - model=selected_model, + # model=selected_model, + model_id="accounts/fireworks/models/llama-v3p3-70b-instruct", sampling_params={ "strategy": {"type": "top_p", "temperature": 1.0, "top_p": 0.9}, }, @@ -91,7 +88,7 @@ def run_main(host: str, port: int, disable_safety: bool = False): session_id=session_id, ) - for log in EventLogger().log(response): + for log in AgentEventLogger().log(response): log.print() diff --git a/examples/agents/podcast_transcript.py b/examples/agents/podcast_transcript.py index 6170f12a..c42ec0df 100644 --- a/examples/agents/podcast_transcript.py +++ b/examples/agents/podcast_transcript.py @@ -7,10 +7,7 @@ import os import fire -from llama_stack_client import LlamaStackClient -from llama_stack_client.lib.agents.agent import Agent -from llama_stack_client.lib.agents.event_logger import EventLogger -from llama_stack_client.types.agents.turn_create_params import Document +from llama_stack_client import LlamaStackClient, Agent, AgentEventLogger, Document from termcolor import colored @@ -102,7 +99,7 @@ def run_main(host: str, port: int, disable_safety: bool = False): session_id=session_id, ) - for log in EventLogger().log(response): + for log in AgentEventLogger().log(response): log.print() diff --git a/examples/agents/rag_as_attachments.py b/examples/agents/rag_as_attachments.py index 4c0e4c6f..2c618ffd 100644 --- a/examples/agents/rag_as_attachments.py +++ b/examples/agents/rag_as_attachments.py @@ -5,10 +5,7 @@ # the root directory of this source tree. import fire -from llama_stack_client import LlamaStackClient -from llama_stack_client.lib.agents.agent import Agent -from llama_stack_client.lib.agents.event_logger import EventLogger -from llama_stack_client.types.agents.turn_create_params import Document +from llama_stack_client import LlamaStackClient, Agent, AgentEventLogger, Document from termcolor import colored @@ -99,7 +96,7 @@ def run_main(host: str, port: int, disable_safety: bool = False): ) print(f"User> {prompt[0]}") - for log in EventLogger().log(response): + for log in AgentEventLogger().log(response): log.print() diff --git a/examples/agents/rag_with_vector_db.py b/examples/agents/rag_with_vector_db.py index ebb33d9e..1b3c5a6a 100644 --- a/examples/agents/rag_with_vector_db.py +++ b/examples/agents/rag_with_vector_db.py @@ -5,10 +5,7 @@ # the root directory of this source tree. import fire -from llama_stack_client import LlamaStackClient -from llama_stack_client.lib.agents.agent import Agent -from llama_stack_client.lib.agents.event_logger import EventLogger -from llama_stack_client.types import Document +from llama_stack_client import LlamaStackClient, Agent, AgentEventLogger, RAGDocument from termcolor import colored from uuid import uuid4 @@ -23,7 +20,7 @@ def run_main(host: str, port: int, disable_safety: bool = False): "lora_finetune.rst", ] documents = [ - Document( + RAGDocument( document_id=f"num-{i}", content=f"https://raw.githubusercontent.com/pytorch/torchtune/main/docs/source/tutorials/{url}", mime_type="text/plain", @@ -110,7 +107,7 @@ def run_main(host: str, port: int, disable_safety: bool = False): session_id=session_id, ) print(f"User> {prompt}") - for log in EventLogger().log(response): + for log in AgentEventLogger().log(response): log.print()