Skip to content

Python: Allow configuration of parameters for BingGroundingTool #12264

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 27, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions python/semantic_kernel/agents/azure_ai/azure_ai_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,21 @@ def _azure_function(spec: ToolSpec) -> ToolDefinition:

@_register_tool("bing_grounding")
def _bing_grounding(spec: ToolSpec) -> BingGroundingTool:
opts = spec.options or {}

connections = spec.options.get("tool_connections")
if not connections or not isinstance(connections, list) or not connections[0]:
raise AgentInitializationException(f"Missing or malformed 'tool_connections' in: {spec}")

conn_id = connections[0]
return BingGroundingTool(connection_id=conn_id)

market = opts.get("market", "")
set_lang = opts.get("set_lang", "")
count = opts.get("count", 5)
if not isinstance(count, int):
raise AgentInitializationException(f"'count' must be an integer in: {spec}")
freshness = opts.get("freshness", "")

return BingGroundingTool(connection_id=conn_id, market=market, set_lang=set_lang, count=count, freshness=freshness)


@_register_tool("code_interpreter")
Expand Down
Loading