diff --git a/.github/workflows/python-sample-validation.yml b/.github/workflows/python-sample-validation.yml index 57746935ee..598da770fb 100644 --- a/.github/workflows/python-sample-validation.yml +++ b/.github/workflows/python-sample-validation.yml @@ -610,14 +610,19 @@ jobs: env: FOUNDRY_PROJECT_ENDPOINT: ${{ vars.FOUNDRY_PROJECT_ENDPOINT || vars.AZURE_AI_PROJECT_ENDPOINT }} FOUNDRY_MODEL: ${{ vars.FOUNDRY_MODEL || vars.AZUREOPENAI__RESPONSESDEPLOYMENTNAME }} - # Azure OpenAI configuration + # Azure OpenAI configuration for AF AZURE_OPENAI_ENDPOINT: ${{ vars.AZUREOPENAI__ENDPOINT }} AZURE_OPENAI_MODEL: ${{ vars.AZURE_OPENAI_DEPLOYMENT_NAME || vars.AZUREOPENAI__RESPONSESDEPLOYMENTNAME }} - # OpenAI configuration + # Azure OpenAI configuration for SK + AZURE_OPENAI_CHAT_DEPLOYMENT_NAME: ${{ vars.AZURE_OPENAI_DEPLOYMENT_NAME }} + # OpenAI key OPENAI_API_KEY: ${{ secrets.OPENAI__APIKEY }} + # OpenAI configuration for AF OPENAI_CHAT_MODEL: ${{ vars.OPENAI__CHATMODELID }} OPENAI_RESPONSES_MODEL: ${{ vars.OPENAI__RESPONSESMODELID }} OPENAI_MODEL: ${{ vars.OPENAI__RESPONSESMODELID }} + # OpenAI configuration for SK + OPENAI_CHAT_MODEL_ID: ${{ vars.OPENAI__CHATMODELID }} # Copilot Studio COPILOTSTUDIOAGENT__ENVIRONMENTID: ${{ secrets.COPILOTSTUDIOAGENT__ENVIRONMENTID }} COPILOTSTUDIOAGENT__SCHEMANAME: ${{ secrets.COPILOTSTUDIOAGENT__SCHEMANAME }} diff --git a/python/samples/02-agents/providers/openai/client_with_local_shell.py b/python/samples/02-agents/providers/openai/client_with_local_shell.py index f4829cc5e7..1de710c9d4 100644 --- a/python/samples/02-agents/providers/openai/client_with_local_shell.py +++ b/python/samples/02-agents/providers/openai/client_with_local_shell.py @@ -18,6 +18,9 @@ This sample demonstrates implementing a local shell tool using get_shell_tool(fu that wraps Python's subprocess module. Unlike the hosted shell tool (get_shell_tool()), local shell execution runs commands on YOUR machine, not in a remote container. +Currently not all models support the shell tool. Refer to the OpenAI documentation for the +list of supported models: https://developers.openai.com/api/docs/models/ + SECURITY NOTE: This example executes real commands on your local machine. Only enable this when you trust the agent's actions. Consider implementing allowlists, sandboxing, or approval workflows for production use. @@ -53,7 +56,10 @@ async def main() -> None: print("=== OpenAI Agent with Local Shell Tool Example ===") print("NOTE: Commands will execute on your local machine.\n") - client = OpenAIChatClient() + # Currently not all models support the shell tool. Refer to the OpenAI + # documentation for the list of supported models: + # https://developers.openai.com/api/docs/models/ + client = OpenAIChatClient(model="gpt-5.4-nano") local_shell_tool = client.get_shell_tool( func=run_bash, ) diff --git a/python/samples/02-agents/providers/openai/client_with_shell.py b/python/samples/02-agents/providers/openai/client_with_shell.py index 5043d8e4a1..6a501dea81 100644 --- a/python/samples/02-agents/providers/openai/client_with_shell.py +++ b/python/samples/02-agents/providers/openai/client_with_shell.py @@ -17,6 +17,9 @@ for executing shell commands in a managed container environment hosted by OpenAI The shell tool allows the model to run commands like listing files, running scripts, or performing system operations within a secure, sandboxed container. + +Currently not all models support the shell tool. Refer to the OpenAI documentation +for the list of supported models: https://developers.openai.com/api/docs/models/ """ @@ -24,7 +27,10 @@ async def main() -> None: """Example showing how to use the shell tool with OpenAI Chat.""" print("=== OpenAI Chat Client Agent with Shell Tool Example ===") - client = OpenAIChatClient() + # Currently not all models support the shell tool. Refer to the OpenAI + # documentation for the list of supported models: + # https://developers.openai.com/api/docs/models/ + client = OpenAIChatClient(model="gpt-5.4-nano") # Create a hosted shell tool with the default auto container environment shell_tool = client.get_shell_tool() diff --git a/python/samples/semantic-kernel-migration/openai_responses/01_basic_responses_agent.py b/python/samples/semantic-kernel-migration/openai_responses/01_basic_responses_agent.py index 37f002ef22..d74487d1e8 100644 --- a/python/samples/semantic-kernel-migration/openai_responses/01_basic_responses_agent.py +++ b/python/samples/semantic-kernel-migration/openai_responses/01_basic_responses_agent.py @@ -23,12 +23,12 @@ async def run_semantic_kernel() -> None: from semantic_kernel.connectors.ai.open_ai import OpenAISettings openai_settings = OpenAISettings() - assert openai_settings.responses_model is not None, "Responses model ID must be set in OpenAISettings" + assert openai_settings.responses_model_id is not None, "Responses model ID must be set in OpenAISettings" client = OpenAIResponsesAgent.create_client() # SK response agents wrap OpenAI's hosted Responses API. agent = OpenAIResponsesAgent( - ai_model=openai_settings.responses_model, + ai_model_id=openai_settings.responses_model_id, client=client, instructions="Answer in one concise sentence.", name="Expert", diff --git a/python/samples/semantic-kernel-migration/openai_responses/02_responses_agent_with_tool.py b/python/samples/semantic-kernel-migration/openai_responses/02_responses_agent_with_tool.py index 306aa68a23..01b783aff9 100644 --- a/python/samples/semantic-kernel-migration/openai_responses/02_responses_agent_with_tool.py +++ b/python/samples/semantic-kernel-migration/openai_responses/02_responses_agent_with_tool.py @@ -29,12 +29,12 @@ async def run_semantic_kernel() -> None: return a + b openai_settings = OpenAISettings() - assert openai_settings.responses_model is not None, "Responses model ID must be set in OpenAISettings" + assert openai_settings.responses_model_id is not None, "Responses model ID must be set in OpenAISettings" client = OpenAIResponsesAgent.create_client() # Plugins advertise callable tools to the Responses agent. agent = OpenAIResponsesAgent( - ai_model=openai_settings.responses_model, + ai_model_id=openai_settings.responses_model_id, client=client, instructions="Use the add tool when math is required.", name="MathExpert", diff --git a/python/samples/semantic-kernel-migration/openai_responses/03_responses_agent_structured_output.py b/python/samples/semantic-kernel-migration/openai_responses/03_responses_agent_structured_output.py index 133d3b079c..cbfbf470a0 100644 --- a/python/samples/semantic-kernel-migration/openai_responses/03_responses_agent_structured_output.py +++ b/python/samples/semantic-kernel-migration/openai_responses/03_responses_agent_structured_output.py @@ -30,12 +30,12 @@ async def run_semantic_kernel() -> None: from semantic_kernel.connectors.ai.open_ai import OpenAISettings openai_settings = OpenAISettings() - assert openai_settings.responses_model is not None, "Responses model ID must be set in OpenAISettings" + assert openai_settings.responses_model_id is not None, "Responses model ID must be set in OpenAISettings" client = OpenAIResponsesAgent.create_client() # response_format requests schema-constrained output from the model. agent = OpenAIResponsesAgent( - ai_model=openai_settings.responses_model, + ai_model_id=openai_settings.responses_model_id, client=client, instructions="Return launch briefs as structured JSON.", name="ProductMarketer",