Skip to content

Commit

Permalink
Merge pull request #1467 from phidatahq/o1-cookbook-init-phi-2005
Browse files Browse the repository at this point in the history
o1-cookbook-init-phi-2005
  • Loading branch information
ysolanky authored Nov 18, 2024
2 parents 819a829 + 8e8ff48 commit aa4ecaf
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
Empty file.
11 changes: 11 additions & 0 deletions cookbook/providers/openai/o1/basic.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from phi.agent import Agent, RunResponse # noqa
from phi.model.openai import OpenAIChat

agent = Agent(model=OpenAIChat(id="o1-preview"))

# Get the response in a variable
# run: RunResponse = agent.run("What is the closest galaxy to milky way?")
# print(run.content)

# Print the response in the terminal
agent.print_response("What is the closest galaxy to milky way?")
13 changes: 13 additions & 0 deletions cookbook/providers/openai/o1/basic_stream.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from typing import Iterator # noqa
from phi.agent import Agent, RunResponse # noqa
from phi.model.openai import OpenAIChat

agent = Agent(model=OpenAIChat(id="o1-preview"))

# Get the response in a variable
# run_response: Iterator[RunResponse] = agent.run("What is the closest galaxy to milky way?", stream=True)
# for chunk in run_response:
# print(chunk.content)

# Print the response in the terminal
agent.print_response("What is the closest galaxy to milky way?", stream=True)

0 comments on commit aa4ecaf

Please sign in to comment.