Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/python-sample-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
AZURE_OPENAI_CHAT_DEPLOYMENT_NAME: ${{ vars.AZUREOPENAI__CHATDEPLOYMENTNAME }}
AZURE_OPENAI_RESPONSES_DEPLOYMENT_NAME: ${{ vars.AZUREOPENAI__RESPONSESDEPLOYMENTNAME }}
# OpenAI configuration
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
OPENAI_API_KEY: ${{ secrets.OPENAI__APIKEY }}
OPENAI_CHAT_MODEL_ID: ${{ vars.OPENAI_CHAT_MODEL_NAME }}
OPENAI_RESPONSES_MODEL_ID: ${{ vars.OPENAI_REASONING_MODEL_NAME }}
# Observability
Expand Down Expand Up @@ -227,7 +227,7 @@ jobs:
AZURE_OPENAI_ENDPOINT: ${{ vars.AZUREOPENAI__ENDPOINT }}
AZURE_OPENAI_CHAT_DEPLOYMENT_NAME: ${{ vars.AZUREOPENAI__CHATDEPLOYMENTNAME }}
# OpenAI configuration
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
OPENAI_API_KEY: ${{ secrets.OPENAI__APIKEY }}
OPENAI_CHAT_MODEL_ID: ${{ vars.OPENAI_CHAT_MODEL_NAME }}
OPENAI_RESPONSES_MODEL_ID: ${{ vars.OPENAI_REASONING_MODEL_NAME }}
defaults:
Expand Down Expand Up @@ -268,7 +268,7 @@ jobs:
AZURE_OPENAI_CHAT_DEPLOYMENT_NAME: ${{ vars.AZUREOPENAI__CHATDEPLOYMENTNAME }}
AZURE_OPENAI_RESPONSES_DEPLOYMENT_NAME: ${{ vars.AZUREOPENAI__RESPONSESDEPLOYMENTNAME }}
# OpenAI configuration
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
OPENAI_API_KEY: ${{ secrets.OPENAI__APIKEY }}
OPENAI_CHAT_MODEL_ID: ${{ vars.OPENAI_CHAT_MODEL_ID }}
OPENAI_RESPONSES_MODEL_ID: ${{ vars.OPENAI_RESPONSES_MODEL_ID }}
# Copilot Studio
Expand Down
2 changes: 1 addition & 1 deletion agent-samples/openai/OpenAIResponses.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ model:
topP: 0.95
connection:
kind: key
apiKey: =Env.OPENAI_APIKEY
apiKey: =Env.OPENAI_API_KEY
outputSchema:
properties:
language:
Expand Down
6 changes: 4 additions & 2 deletions python/samples/02-agents/chat_client/custom_chat_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ def _inner_get_response(
response_text = f"{response_text} {suffix}"
stream_delay_seconds = float(options.get("stream_delay_seconds", 0.05))

response_message = Message(role="assistant", contents=[Content.from_text(response_text)])
response_message = Message(
role="assistant", contents=[Content.from_text(response_text)]
)

response = ChatResponse(
messages=[response_message],
Expand Down Expand Up @@ -146,7 +148,7 @@ async def main() -> None:
# Use the chat client directly
print("Using chat client directly:")
direct_response = await echo_client.get_response(
"Hello, custom chat client!",
[Message(role="user", text="Hello, custom chat client!")],
options={
"uppercase": True,
"suffix": "(CUSTOM OPTIONS)",
Expand Down
21 changes: 16 additions & 5 deletions python/samples/02-agents/devui/in_memory_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@
import os
from typing import Annotated

from agent_framework import Agent, Executor, WorkflowBuilder, WorkflowContext, handler, tool
from agent_framework import (
Agent,
Executor,
WorkflowBuilder,
WorkflowContext,
handler,
tool,
)
from agent_framework.azure import AzureOpenAIChatClient
from agent_framework.devui import serve
from dotenv import load_dotenv
Expand All @@ -30,7 +37,9 @@ def get_weather(
"""Get the weather for a given location."""
conditions = ["sunny", "cloudy", "rainy", "stormy"]
temperature = 53
return f"The weather in {location} is {conditions[0]} with a high of {temperature}°C."
return (
f"The weather in {location} is {conditions[0]} with a high of {temperature}°C."
)


@tool(approval_mode="never_require")
Expand Down Expand Up @@ -59,7 +68,9 @@ class AddExclamation(Executor):
"""Add exclamation mark to text."""

@handler
async def add_exclamation(self, text: str, ctx: WorkflowContext[Never, str]) -> None:
async def add_exclamation(
self, text: str, ctx: WorkflowContext[Never, str]
) -> None:
"""Add exclamation and yield as workflow output."""
result = f"{text}!"
await ctx.yield_output(result)
Expand All @@ -74,9 +85,9 @@ def main():
# Create Azure OpenAI chat client
client = AzureOpenAIChatClient(
api_key=os.environ.get("AZURE_OPENAI_API_KEY"),
azure_endpoint=os.environ.get("AZURE_OPENAI_ENDPOINT"),
deployment_name=os.environ["AZURE_OPENAI_CHAT_DEPLOYMENT_NAME"],
endpoint=os.environ.get("AZURE_OPENAI_ENDPOINT"),
api_version=os.environ.get("AZURE_OPENAI_API_VERSION", "2024-10-21"),
model_id=os.environ.get("AZURE_OPENAI_CHAT_DEPLOYMENT_NAME", "gpt-4o"),
)

# Create agents
Expand Down