Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ysolanky committed Sep 30, 2024
1 parent ea62673 commit 708fef0
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 26 deletions.
1 change: 0 additions & 1 deletion cookbook/llms/claude/assistant_stream_off.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@
llm=Claude(model="claude-3-5-sonnet-20240620"),
tools=[DuckDuckGo()],
show_tool_calls=True,
debug_mode=True,
)
assistant.print_response("Whats happening in France?", markdown=True, stream=False)
18 changes: 12 additions & 6 deletions cookbook/providers/openai/agent.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
from phi.agent import Agent
from phi.agent import Agent, RunResponse # noqa
from phi.model.openai import OpenAIChat
from phi.tools.duckduckgo import DuckDuckGo
from phi.tools.yfinance import YFinanceTools

agent = Agent(
model=OpenAIChat(model="gpt-4o"),
tools=[DuckDuckGo()],
model=OpenAIChat(id="gpt-4o"),
tools=[YFinanceTools(stock_price=True)],
show_tool_calls=True,
# debug_mode=True,
markdown=True,
)
agent.print_response("Whats happening in France?", markdown=True)

# Get the response in a variable
# run: RunResponse = agent.run("What is the stock price of NVDA and TSLA")
# print(run.content)

# Print the response in the terminal
agent.print_response("What is the stock price of NVDA and TSLA")
20 changes: 14 additions & 6 deletions cookbook/providers/openai/agent_stream.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
from phi.agent import Agent
from typing import Iterator # noqa
from phi.agent import Agent, RunResponse # noqa
from phi.model.openai import OpenAIChat
from phi.tools.duckduckgo import DuckDuckGo
from phi.tools.yfinance import YFinanceTools

agent = Agent(
model=OpenAIChat(model="gpt-4o"),
tools=[DuckDuckGo()],
model=OpenAIChat(id="gpt-4o"),
tools=[YFinanceTools(stock_price=True)],
show_tool_calls=True,
# debug_mode=True,
markdown=True,
)
agent.print_response("Whats happening in France?", markdown=True, stream=True)

# Get the response in a variable
# 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 in the terminal
agent.print_response("What is the stock price of NVDA and TSLA", stream=True)
14 changes: 7 additions & 7 deletions cookbook/providers/openai/basic.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from phi.agent import Agent, RunResponse
from phi.agent import Agent, RunResponse # noqa
from phi.model.openai import OpenAIChat

agent = Agent(
model=OpenAIChat(model="gpt-4o"),
description="You help people with their health and fitness goals.",
)
agent = Agent(model=OpenAIChat(id="gpt-4o"), instructions=["Respond in a southern tone"], markdown=True)

run: RunResponse = agent.run("Share a healthy breakfast recipe") # type: ignore
# Get the response in a variable
# run: RunResponse = agent.run("Explain simulation theory")
# print(run.content)

print(run.content)
# Print the response in the terminal
agent.print_response("Explain simulation theory")
16 changes: 10 additions & 6 deletions cookbook/providers/openai/basic_stream.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
from phi.agent import Agent
from typing import Iterator # noqa
from phi.agent import Agent, RunResponse # noqa
from phi.model.openai import OpenAIChat

agent = Agent(
model=OpenAIChat(model="gpt-4o"),
description="You help people with their health and fitness goals.",
)
agent = Agent(model=OpenAIChat(id="gpt-4o"), instructions=["Respond in a southern tone"], markdown=True)

agent.print_response("Share a healthy breakfast recipe", stream=True)
# Get the response in a variable
# run_response: Iterator[RunResponse] = agent.run("Explain simulation theory", stream=True)
# for chunk in run_response:
# print(chunk.content)

# Print the response in the terminal
agent.print_response("Explain simulation theory", stream=True)

0 comments on commit 708fef0

Please sign in to comment.