Example

from phi.agent import Agent
from phi.model.openai import OpenAIChat
from phi.tools.yfinance import YFinanceTools

agent = Agent(
    model=OpenAIChat(id="gpt-4o"),
    tools=[YFinanceTools(stock_price=True)],
    show_tool_calls=True,
    markdown=True,
)

agent.print_response("What is the stock price of NVDA and TSLA")

OpenAI Params

ParameterTypeDefaultDescription
idstr-The name of the model to be used for generating responses.
api_keystr-The API key for authenticating requests to the service.
base_urlstr-The base URL for making API requests to the service.

For more information, please refer to the OpenAI docs as well.

OpenAILike is a subclass of the OpenAI class and has access to the same params.