Python: Fix SK migration samples (#5047)

* Fix SK migration samples

* Fix env vars for SK

* Hard code model for sheel tool samples
This commit is contained in:
Tao Chen
2026-04-02 01:40:34 -07:00
committed by GitHub
Unverified
parent 628bb1af48
commit 3d87cec304
6 changed files with 27 additions and 10 deletions
@@ -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",
@@ -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",
@@ -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",