Update getting started samples to reflect AF. Update a unit test. (#1093)

This commit is contained in:
Evan Mattson
2025-10-02 10:20:12 +09:00
committed by GitHub
Unverified
parent 6d0f28eb9b
commit 4f4890cf6a
7 changed files with 17 additions and 13 deletions
@@ -48,6 +48,7 @@ from azure.core.credentials_async import AsyncTokenCredential
from azure.core.exceptions import HttpResponseError
from azure.identity.aio import AzureCliCredential
from pydantic import BaseModel, Field, ValidationError
from pytest import MonkeyPatch
from agent_framework_azure_ai import AzureAIAgentClient, AzureAISettings
@@ -1006,8 +1007,11 @@ async def test_azure_ai_chat_client_prep_tools_file_search_no_connection(mock_ai
await chat_client._prep_tools([file_search_tool]) # type: ignore
async def test_azure_ai_chat_client_prep_tools_file_search_no_index_name(mock_ai_project_client: MagicMock) -> None:
async def test_azure_ai_chat_client_prep_tools_file_search_no_index_name(
mock_ai_project_client: MagicMock, monkeypatch: MonkeyPatch
) -> None:
"""Test _prep_tools with HostedFileSearchTool missing index_name and vector stores."""
monkeypatch.delenv("AZURE_AI_SEARCH_INDEX_NAME", raising=False)
chat_client = create_test_azure_ai_chat_client(mock_ai_project_client, agent_id="test-agent")
@@ -62,7 +62,7 @@ async def main() -> None:
print(f"{agent.name}: {result1}\n")
print("\n=======================================\n")
# Second query
query2 = "What is Microsoft Semantic Kernel?"
query2 = "What is Microsoft Agent Framework?"
print(f"User: {query2}")
result2 = await handle_approvals_with_thread(query2, agent, thread)
print(f"{agent.name}: {result2}\n")
@@ -40,7 +40,7 @@ async def mcp_tools_on_run_level() -> None:
print(f"{agent.name}: {result1}\n")
print("\n=======================================\n")
# Second query
query2 = "What is Microsoft Semantic Kernel?"
query2 = "What is Microsoft Agent Framework?"
print(f"User: {query2}")
result2 = await agent.run(query2, tools=mcp_server)
print(f"{agent.name}: {result2}\n")
@@ -71,7 +71,7 @@ async def mcp_tools_on_agent_level() -> None:
print(f"{agent.name}: {result1}\n")
print("\n=======================================\n")
# Second query
query2 = "What is Microsoft Semantic Kernel?"
query2 = "What is Microsoft Agent Framework?"
print(f"User: {query2}")
result2 = await agent.run(query2)
print(f"{agent.name}: {result2}\n")
@@ -79,7 +79,7 @@ async def main() -> None:
print(f"{agent.name}: {result1}\n")
print("\n=======================================\n")
# Second query
query2 = "What is Microsoft Semantic Kernel and use a web search to see what is Reddit saying about it?"
query2 = "What is Microsoft Agent Framework and use a web search to see what is Reddit saying about it?"
print(f"User: {query2}")
result2 = await handle_approvals_with_thread(query2, agent, thread)
print(f"{agent.name}: {result2}\n")
@@ -38,7 +38,7 @@ async def mcp_tools_on_run_level() -> None:
print(f"{agent.name}: {result1}\n")
print("\n=======================================\n")
# Second query
query2 = "What is Microsoft Semantic Kernel?"
query2 = "What is Microsoft Agent Framework?"
print(f"User: {query2}")
result2 = await agent.run(query2, tools=mcp_server)
print(f"{agent.name}: {result2}\n")
@@ -66,7 +66,7 @@ async def mcp_tools_on_agent_level() -> None:
print(f"{agent.name}: {result1}\n")
print("\n=======================================\n")
# Second query
query2 = "What is Microsoft Semantic Kernel?"
query2 = "What is Microsoft Agent Framework?"
print(f"User: {query2}")
result2 = await agent.run(query2)
print(f"{agent.name}: {result2}\n")
@@ -114,7 +114,7 @@ async def run_hosted_mcp_without_thread_and_specific_approval() -> None:
print(f"{agent.name}: {result1}\n")
print("\n=======================================\n")
# Second query
query2 = "What is Microsoft Semantic Kernel?"
query2 = "What is Microsoft Agent Framework?"
print(f"User: {query2}")
result2 = await handle_approvals_without_thread(query2, agent)
print(f"{agent.name}: {result2}\n")
@@ -146,7 +146,7 @@ async def run_hosted_mcp_without_approval() -> None:
print(f"{agent.name}: {result1}\n")
print("\n=======================================\n")
# Second query
query2 = "What is Microsoft Semantic Kernel?"
query2 = "What is Microsoft Agent Framework?"
print(f"User: {query2}")
result2 = await handle_approvals_without_thread(query2, agent)
print(f"{agent.name}: {result2}\n")
@@ -177,7 +177,7 @@ async def run_hosted_mcp_with_thread() -> None:
print(f"{agent.name}: {result1}\n")
print("\n=======================================\n")
# Second query
query2 = "What is Microsoft Semantic Kernel?"
query2 = "What is Microsoft Agent Framework?"
print(f"User: {query2}")
result2 = await handle_approvals_with_thread(query2, agent, thread)
print(f"{agent.name}: {result2}\n")
@@ -210,7 +210,7 @@ async def run_hosted_mcp_with_thread_streaming() -> None:
print("\n")
print("\n=======================================\n")
# Second query
query2 = "What is Microsoft Semantic Kernel?"
query2 = "What is Microsoft Agent Framework?"
print(f"User: {query2}")
print(f"{agent.name}: ", end="")
async for update in handle_approvals_with_thread_streaming(query2, agent, thread):
@@ -43,7 +43,7 @@ async def streaming_with_mcp(show_raw_stream: bool = False) -> None:
print("")
print("\n=======================================\n")
# Second query
query2 = "What is Microsoft Semantic Kernel?"
query2 = "What is Microsoft Agent Framework?"
print(f"User: {query2}")
print(f"{agent.name}: ", end="")
async for chunk in agent.run_stream(query2):
@@ -76,7 +76,7 @@ async def run_with_mcp() -> None:
print(f"{agent.name}: {result1}\n")
print("\n=======================================\n")
# Second query
query2 = "What is Microsoft Semantic Kernel?"
query2 = "What is Microsoft Agent Framework?"
print(f"User: {query2}")
result2 = await agent.run(query2)
print(f"{agent.name}: {result2}\n")