Skip to content

Commit a97608a

Browse files
fix: swap Azure OpenAI models to OpenAI directly (2/n) (#698)
1 parent ef34fdc commit a97608a

File tree

1 file changed

+6
-4
lines changed
  • integrations/microsoft-agent-framework/python/examples/agents

1 file changed

+6
-4
lines changed

integrations/microsoft-agent-framework/python/examples/agents/dojo.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
print(f"AZURE_CLIENT_ID: {'SET' if os.getenv('AZURE_CLIENT_ID') else 'MISSING'}")
4545
print(f"AZURE_TENANT_ID: {'SET' if os.getenv('AZURE_TENANT_ID') else 'MISSING'}")
4646
print(f"AZURE_CLIENT_SECRET: {'SET' if os.getenv('AZURE_CLIENT_SECRET') else 'MISSING'}")
47+
print(f"OPENAI_API_KEY: {'SET' if os.getenv('OPENAI_API_KEY') else 'MISSING'}")
4748

4849
# Resolve deployment name with fallback to support both Python and .NET env var naming
4950
deployment_name = os.getenv("AZURE_OPENAI_CHAT_DEPLOYMENT_NAME")
@@ -58,6 +59,8 @@
5859
else:
5960
print("WARNING: AZURE_OPENAI_ENDPOINT not set")
6061

62+
api_key = os.getenv("OPENAI_API_KEY")
63+
6164
# Create a shared chat client for all agents
6265
# You can use different chat clients for different agents:
6366

@@ -71,10 +74,9 @@
7174

7275
# If using api_key authentication remove the credential parameter
7376
# Explicitly pass deployment_name to align with .NET behavior and support both env var names
74-
chat_client = AzureOpenAIChatClient(
75-
credential=DefaultAzureCredential(),
76-
deployment_name=deployment_name,
77-
endpoint=endpoint,
77+
chat_client = OpenAIChatClient(
78+
model_id=deployment_name,
79+
api_key=api_key,
7880
)
7981

8082
# Agentic Chat - simple_agent

0 commit comments

Comments
 (0)