Skip to content

Commit c3c8dfa

Browse files
authored
Python: Bing custom search tool content support (#12415)
### Motivation and Context In the `azure-ai-agent` package version 1.1.0b1, they provided the `AgentsNamedToolChoiceType.BING_CUSTOM_SEARCH` enum. Adding this to then provide support for generating bing grounding content for streaming/non-streaming path. <!-- Thank you for your contribution to the semantic-kernel repo! Please help reviewers and future users, providing the following information: 1. Why is this change required? 2. What problem does it solve? 3. What scenario does it contribute to? 4. If it fixes an open issue, please link to the issue here. --> ### Description - Add BING_CUSTOM_SEARCH enum to allow for content support. - Bumps `pyproject.toml` `azure-ai-agents` min allowed version to `1.1.0b1` which includes this new enum. <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [X] The code builds clean without any errors or warnings - [X] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [X] All unit tests pass, and I have added new tests where possible - [X] I didn't break anyone 😄
1 parent 3e31c3b commit c3c8dfa

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

python/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ classifiers = [
2525
dependencies = [
2626
# azure agents
2727
"azure-ai-projects >= 1.0.0b11",
28-
"azure-ai-agents >= 1.0.0",
28+
"azure-ai-agents >= 1.1.0b1",
2929
"aiohttp ~= 3.8",
3030
"cloudevents ~=1.0",
3131
"pydantic >=2.0,!=2.10.0,!=2.10.1,!=2.10.2,!=2.10.3,<2.12",

python/semantic_kernel/agents/azure_ai/agent_thread_actions.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,10 @@ def sort_key(step: RunStep):
285285
function_step=function_step,
286286
tool_call=tool_call, # type: ignore
287287
)
288-
case AgentsNamedToolChoiceType.BING_GROUNDING:
288+
case (
289+
AgentsNamedToolChoiceType.BING_GROUNDING
290+
| AgentsNamedToolChoiceType.BING_CUSTOM_SEARCH
291+
):
289292
logger.debug(
290293
f"Entering tool_calls (bing_grounding) for run [{run.id}], agent "
291294
f" `{agent.name}` and thread `{thread_id}`"
@@ -528,7 +531,10 @@ async def _process_stream_events(
528531
case AgentsNamedToolChoiceType.CODE_INTERPRETER:
529532
content = generate_streaming_code_interpreter_content(agent.name, details)
530533
content_is_visible = True
531-
case AgentsNamedToolChoiceType.BING_GROUNDING:
534+
case (
535+
AgentsNamedToolChoiceType.BING_GROUNDING
536+
| AgentsNamedToolChoiceType.BING_CUSTOM_SEARCH
537+
):
532538
content = generate_streaming_bing_grounding_content(
533539
agent_name=agent.name, step_details=details
534540
)

python/uv.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)