Skip to content

Commit

Permalink
o1-cookbook-init-phi-2005
Browse files Browse the repository at this point in the history
  • Loading branch information
ysolanky committed Nov 18, 2024
1 parent ef5f314 commit 8e8ff48
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 8e8ff48

Please sign in to comment.