-
Notifications
You must be signed in to change notification settings - Fork 3.2k
adding tracing support for bing custom search tool #44291
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
base: main
Are you sure you want to change the base?
adding tracing support for bing custom search tool #44291
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds tracing support for Bing Custom Search tool in the Azure AI Projects SDK. The changes enable proper telemetry instrumentation to track both Bing Custom Search tool calls and their outputs, distinguishing them from similar remote function call patterns.
Key Changes
- Added a new
_emit_tool_output_eventhelper method to emit tool output events with the appropriate role and event type - Updated dictionary keys for
output_itemsto use(id, type)tuples instead of justidto prevent call and output items with the same ID from overwriting each other - Enhanced the generic tool call/output handler to support Pydantic v2
model_dump()method in addition to existingas_dict()support - Split handling of
remote_function_call(the call) andremote_function_call_output(the output) into separate code paths with appropriate event types and field extraction logic
| # Debug sync wrapper initialization | ||
| # Return wrapped stream |
Copilot
AI
Dec 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] These debug comments appear to be leftover from development and don't add value to the code. They should be removed to keep the codebase clean.
| # Debug sync wrapper initialization | |
| # Return wrapped stream |
| # Always try to include common ID fields (safe, needed for correlation) | ||
| for id_field in ["id", "call_id"]: | ||
| if hasattr(output_item, id_field): | ||
| tool_output["id" if id_field == "id" else "id"] = getattr(output_item, id_field) |
Copilot
AI
Dec 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The conditional expression "id" if id_field == "id" else "id" always evaluates to "id" regardless of the condition. This means when id_field is "call_id", the code still assigns to tool_output["id"] instead of mapping call_id to id. This appears to be a copy-paste error.
This should be: tool_output["id"] = getattr(output_item, id_field) to correctly handle both field names.
| tool_output["id" if id_field == "id" else "id"] = getattr(output_item, id_field) | |
| tool_output["id"] = getattr(output_item, id_field) |
adding tracing support for bing custom search tool