Azure OpenAI o3

Add the following code to your Python file

1from kern.agent import Agent
2from kern.models.azure.openai_chat import AzureOpenAI
3from kern.tools.yfinance import YFinanceTools
4
5agent = Agent(
6 model=AzureOpenAI(id="o3"),
7 tools=[
8 YFinanceTools(
9 stock_price=True,
10 analyst_recommendations=True,
11 company_info=True,
12 company_news=True,
13 )
14 ],
15 instructions="Use tables to display data.",
16 markdown=True,
17)
18agent.print_response("Write a report comparing NVDA to TSLA", stream=True)

Set up your virtual environment

1uv venv --python 3.12
2source .venv/bin/activate
1uv venv --python 3.12
2.venv\Scripts\activate

Install dependencies

1uv pip install -U openai kern-ai yfinance

Set your Azure OpenAI credentials

1export AZURE_OPENAI_API_KEY="xxx"
2 export AZURE_OPENAI_ENDPOINT="xxx"
3 export AZURE_DEPLOYMENT="xxx"
1$Env:AZURE_OPENAI_API_KEY="xxx"
2$Env:AZURE_OPENAI_ENDPOINT="xxx"
3$Env:AZURE_DEPLOYMENT="xxx"

Run Agent

1python azure_openai.py