diff --git a/cookbook/providers/openai/README.md b/cookbook/providers/openai/README.md index 8476e81421..5fd2830098 100644 --- a/cookbook/providers/openai/README.md +++ b/cookbook/providers/openai/README.md @@ -18,47 +18,41 @@ export OPENAI_API_KEY=*** ### 3. Install libraries ```shell -pip install -U openai duckduckgo-search duckdb yfinance exa_py phidata +pip install -U openai duckduckgo-search duckdb yfinance phidata ``` -### 4. Run Agent +### 4. Run Agent without Tools -- stream off +- Streaming on ```shell -python cookbook/providers/openai/basic.py +python cookbook/providers/openai/basic_stream.py ``` -- stream on +- Streaming off ```shell -python cookbook/providers/openai/basic_stream.py +python cookbook/providers/openai/basic.py ``` ### 5. Run Agent with Tools -- DuckDuckGo Search - -```shell -python cookbook/providers/openai/agent.py -``` - -- DuckDuckGo Search Stream +- DuckDuckGo Search with streaming on ```shell python cookbook/providers/openai/agent_stream.py ``` -- YFinance +- DuckDuckGo Search without streaming ```shell -python cookbook/providers/openai/finance.py +python cookbook/providers/openai/agent.py ``` -- Exa Search +- Finance Agent ```shell -python cookbook/providers/openai/exa_search.py +python cookbook/providers/openai/finance_agent.py ``` - Data Analyst @@ -67,7 +61,7 @@ python cookbook/providers/openai/exa_search.py python cookbook/providers/openai/data_analyst.py ``` -### 6. Run Agent with Structured output +### 6. Run Agent that returns structured output ```shell python cookbook/providers/openai/structured_output.py diff --git a/cookbook/providers/openai/agent.py b/cookbook/providers/openai/agent.py index 08ecadb6c5..94ab2c2375 100644 --- a/cookbook/providers/openai/agent.py +++ b/cookbook/providers/openai/agent.py @@ -10,8 +10,8 @@ ) # Get the response in a variable -# run: RunResponse = agent.run("What is the stock price of NVDA") +# run: RunResponse = agent.run("What is the stock price of NVDA and TSLA") # print(run.content) # Print the response on the terminal -agent.print_response("What is the stock price of NVDA") +agent.print_response("What is the stock price of NVDA and TSLA") diff --git a/cookbook/providers/openai/agent_stream.py b/cookbook/providers/openai/agent_stream.py index 983a2925c0..95fec0e9b5 100644 --- a/cookbook/providers/openai/agent_stream.py +++ b/cookbook/providers/openai/agent_stream.py @@ -11,9 +11,9 @@ ) # Get the response in a variable -# run_response: Iterator[RunResponse] = agent.run("What is the stock price of NVDA", stream=True) +# run_response: Iterator[RunResponse] = agent.run("What is the stock price of NVDA and TSLA", stream=True) # for chunk in run_response: # print(chunk.content) # Print the response on the terminal -agent.print_response("What is the stock price of NVDA", stream=True) +agent.print_response("What is the stock price of NVDA and TSLA", stream=True) diff --git a/cookbook/providers/openai/exa_search.py b/cookbook/providers/openai/exa_search.py deleted file mode 100644 index 427d372006..0000000000 --- a/cookbook/providers/openai/exa_search.py +++ /dev/null @@ -1,13 +0,0 @@ -from phi.agent import Agent -from phi.model.openai import OpenAIChat -from phi.tools.exa import ExaTools -from phi.tools.website import WebsiteTools - -agent = Agent(model=OpenAIChat(id="gpt-4o"), tools=[ExaTools(), WebsiteTools()], markdown=True, show_tool_calls=True) - -agent.print_response( - "Produce this table: research chromatic homotopy theory. " - "Access each link in the result outputting the summary for that article, its link, and keywords. " - "After the table output make conceptual ascii art of the overarching themes and constructions", - stream=True, -) diff --git a/phi/playground/routes.py b/phi/playground/routes.py index 0c9ff9a88a..4460947bf3 100644 --- a/phi/playground/routes.py +++ b/phi/playground/routes.py @@ -104,11 +104,7 @@ def get_agent_sessions(body: GetAgentSessionsRequest): for session in all_agent_sessions: title = get_session_title(session) agent_sessions.append( - GetAgentSessionsResponse( - session_id=session.session_id, - title=title, - created_at=session.created_at - ) + GetAgentSessionsResponse(session_id=session.session_id, title=title, created_at=session.created_at) ) return agent_sessions diff --git a/phi/utils/json_io.py b/phi/utils/json_io.py index 5caff16a66..21b217ac3a 100644 --- a/phi/utils/json_io.py +++ b/phi/utils/json_io.py @@ -19,7 +19,7 @@ def default(self, o): def read_json_file(file_path: Optional[Path]) -> Optional[Union[Dict, List]]: if file_path is not None and file_path.exists() and file_path.is_file(): - logger.debug(f"Reading {file_path}") + # logger.debug(f"Reading {file_path}") return json.loads(file_path.read_text()) return None