Azure OpenAI o3
Add the following code to your Python file
1from kern.agent import Agent2from kern.models.azure.openai_chat import AzureOpenAI3from kern.tools.yfinance import YFinanceTools45agent = 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.122source .venv/bin/activate1uv venv --python 3.122.venv\Scripts\activateInstall dependencies
1uv pip install -U openai kern-ai yfinanceSet 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