mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
Python: Fixed SK migration samples (#4046)
* Fixed sk migration provider samples * Fixes to SK migration samples
This commit is contained in:
committed by
GitHub
Unverified
parent
aab80d9ed9
commit
c23bc1371c
+3
-2
@@ -46,11 +46,12 @@ async def run_agent_framework() -> None:
|
||||
instructions="Answer questions in one concise paragraph.",
|
||||
model=ASSISTANT_MODEL,
|
||||
) as assistant_agent:
|
||||
reply = await assistant_agent.run("What is the capital of Denmark?")
|
||||
session = assistant_agent.create_session()
|
||||
reply = await assistant_agent.run("What is the capital of Denmark?", session=session)
|
||||
print("[AF]", reply.text)
|
||||
follow_up = await assistant_agent.run(
|
||||
"How many residents live there?",
|
||||
session=assistant_agent.create_session(),
|
||||
session=session,
|
||||
)
|
||||
print("[AF][follow-up]", follow_up.text)
|
||||
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ async def run_semantic_kernel() -> None:
|
||||
|
||||
# Enable the hosted code interpreter tool on the assistant definition.
|
||||
definition = await client.beta.assistants.create(
|
||||
model=OpenAISettings().chat_deployment_name,
|
||||
model=OpenAISettings().chat_model_id,
|
||||
name="CodeRunner",
|
||||
instructions="Run the provided request as code and return the result.",
|
||||
tools=code_interpreter_tool,
|
||||
|
||||
+3
-4
@@ -34,7 +34,7 @@ async def run_semantic_kernel() -> None:
|
||||
|
||||
class WeatherPlugin:
|
||||
@kernel_function(name="get_forecast", description="Look up the forecast for a city and day.")
|
||||
async def fake_weather_lookup(city: str, day: str) -> dict[str, Any]:
|
||||
async def fake_weather_lookup(self, city: str, day: str) -> dict[str, Any]:
|
||||
"""Pretend to call a weather service."""
|
||||
return {
|
||||
"city": city,
|
||||
@@ -50,9 +50,8 @@ async def run_semantic_kernel() -> None:
|
||||
model=ASSISTANT_MODEL,
|
||||
name="WeatherHelper",
|
||||
instructions="Call get_forecast to fetch weather details.",
|
||||
plugins=[WeatherPlugin()],
|
||||
)
|
||||
agent = OpenAIAssistantAgent(client=client, definition=definition)
|
||||
agent = OpenAIAssistantAgent(client=client, definition=definition, plugins=[WeatherPlugin()])
|
||||
|
||||
thread: AssistantAgentThread | None = None
|
||||
response = await agent.get_response(
|
||||
@@ -64,7 +63,7 @@ async def run_semantic_kernel() -> None:
|
||||
|
||||
|
||||
async def run_agent_framework() -> None:
|
||||
from agent_framework._tools import tool
|
||||
from agent_framework import tool
|
||||
from agent_framework.openai import OpenAIAssistantsClient
|
||||
|
||||
@tool(
|
||||
|
||||
Reference in New Issue
Block a user