-
Notifications
You must be signed in to change notification settings - Fork 1
fix web search tool #128
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?
fix web search tool #128
Conversation
| if annotation["type"] == "url_citation" | ||
| } | ||
| ) | ||
| urls = list({source["url"] for source in message["action"]["sources"] if source["type"] == "url"}) |
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.
could you confirm that you tested this update on both gpt-4.1 series and gpt-5 series models?
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.
Yes
| "The trafilatura package is required to score responses involving web search. Please install it: `pip install trafilatura`" | ||
| ) | ||
|
|
||
| if message["action"]["type"] == "search": |
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.
{'id': 'msg_0dcf5fddf778d0a40068f295f3e31c819bbb7e6bfa4c8362d5',
'content': [{'annotations': [{'end_index': 401,
'start_index': 298,
'title': 'New Toyota Innova Crysta Review (2.8-AT and 2.4-MT) | Motoroids',
'type': 'url_citation',
'url': 'https://www.motoroids.com/reviews/new-toyota-innova-crysta-review-2-8-at-and-2-4-mt/'},
{'end_index': 1047,
'start_index': 921,
'title': 'Mahindra XUV700 Review - Team-BHP',
'type': 'url_citation',
'url': 'https://www.team-bhp.com/forum/official-new-car-reviews/240680-mahindra-xuv700-review.html?utm_source=openai'},
{'end_index': 1400,
'start_index': 1297,
'title': 'New Toyota Innova Crysta Review (2.8-AT and 2.4-MT) | Motoroids',
'type': 'url_citation',
'url': 'https://www.motoroids.com/reviews/new-toyota-innova-crysta-review-2-8-at-and-2-4-mt/'},
{'end_index': 1648,
'start_index': 1517,
'title': 'Toyota Innova Crysta ownership: Observation after 2 years & 20,000 km | Team-BHP',
'type': 'url_citation',
'url': 'https://www.team-bhp.com/news/toyota-innova-crysta-ownership-observation-after-2-years-20000-km?utm_source=openai'},
{'end_index': 1978,
'start_index': 1852,
'title': 'Mahindra XUV700 Review - Team-BHP',
'type': 'url_citation',
'url': 'https://www.team-bhp.com/forum/official-new-car-reviews/240680-mahindra-xuv700-review.html?utm_source=openai'},
{'end_index': 2317,
'start_index': 2232,
'title': 'Mahindra is Mahindra',
'type': 'url_citation',
'url': 'https://www.reddit.com/r/CarsIndia/comments/175g7ai?utm_source=openai'},
{'end_index': 2620,
'start_index': 2517,
'title': 'New Toyota Innova Crysta Review (2.8-AT and 2.4-MT) | Motoroids',
'type': 'url_citation',
'url': 'https://www.motoroids.com/reviews/new-toyota-innova-crysta-review-2-8-at-and-2-4-mt/'},
{'end_index': 3047,
'start_index': 2921,
'title': 'Mahindra XUV700 Review - Team-BHP',
'type': 'url_citation',
'url': 'https://www.team-bhp.com/forum/official-new-car-reviews/240680-mahindra-xuv700-review.html?utm_source=openai'}],
'text': 'Short summary (quick answer)\n- Most professional reviews and long‑term owner reports say the Innova Crysta diesel is the more refined/quieter car in day‑to‑day and long‑distance use — diesel clatter is well contained at idle/cruise, but the engine becomes noticeably audible when you push it hard. ([motoroids.com](https://www.motoroids.com/reviews/new-toyota-innova-crysta-review-2-8-at-and-2-4-mt/)) \n- The XUV700 (diesel) is praised for performance, features and overall composure, but its NVH record is mixed: professional tests find acceptable refinement at cruise, yet many owners and ownership threads report rattles, suspension thuds and door/trim vibrations (i.e., perceived poorer cabin fit‑and‑finish vs the Innova). If NVH/long‑haul serenity is the priority, reviewers/owners generally prefer the Innova; if you want features/performance and can tolerate (or fix) some cabin noise, the XUV700 is compelling. ([team-bhp.com](https://www.team-bhp.com/forum/official-new-car-reviews/240680-mahindra-xuv700-review.html?utm_source=openai))\n\nWhat the reviews say (key points + sources)\n- Innova Crysta (diesel)\n - “Feels like a tomb” at idle / cruise — diesel clatter well contained; excellent highway ride and isolation; engine noise rises under heavy throttle. (first drives & reviews). ([motoroids.com](https://www.motoroids.com/reviews/new-toyota-innova-crysta-review-2-8-at-and-2-4-mt/)) \n - Long‑term/owner writeups confirm improved NVH over older Innova generations and strong long‑distance comfort. ([team-bhp.com](https://www.team-bhp.com/news/toyota-innova-crysta-ownership-observation-after-2-years-20000-km?utm_source=openai))\n\n- XUV700 (diesel)\n - Professional reviews note generally good refinement for the 2.0 engines and a composed ride, but also mention wind/road noise at higher speeds and a “trucky” feel in some reviews. ([team-bhp.com](https://www.team-bhp.com/forum/official-new-car-reviews/240680-mahindra-xuv700-review.html?utm_source=openai)) \n - Numerous owner/ownership threads report rattles, creaks, suspension thuds and occasional audible vibrations (especially on rough roads or from door panels) — these real‑world reports are the main reason XUV700’s NVH is called “mixed” in practice. ([reddit.com](https://www.reddit.com/r/CarsIndia/comments/175g7ai?utm_source=openai))\n\nBottom line / recommendation\n- If your priority is the quietest, most comfortable diesel cabin for long trips and you want proven long‑term refinement, the Innova Crysta (diesel) is the safer pick. ([motoroids.com](https://www.motoroids.com/reviews/new-toyota-innova-crysta-review-2-8-at-and-2-4-mt/)) \n- If you prioritise tech, performance and value but can accept / mitigate some cabin rattles (or are ready to apply aftermarket sound‑deadening), the XUV700 offers more features and punch — just check the specific car carefully at delivery and look for trim/rattle issues on a thorough test drive. ([team-bhp.com](https://www.team-bhp.com/forum/official-new-car-reviews/240680-mahindra-xuv700-review.html?utm_source=openai))\n\nIf you want I can:\n- Pull the most recent head‑to‑head reviews/videos (with exact publish dates) from autosites and YouTube and list them (so you can watch/compare NVH samples). \n- Compile a short table of quoted NVH observations (idle, cruise, under acceleration, trim rattles) with exact publication dates and direct links. \n\nWhich would you prefer?',
'type': 'output_text',
'logprobs': []}],
'role': 'assistant',
'status': 'completed',
'type': 'message'}
Could you cover this?
Code:
client = OpenAI()
response5 = client.responses.create(
model="gpt-5-mini",
input=[{"role": "user", "content": "Find recent reviews comparing Innova Crysta vs XUV700 diesel NVH and cite sources."}],
tools=[{"type": "web_search"}],
instructions="Use web search and cite sources."
)
wds = form_response_string_responses_api(response5)
Has
[{'id': 'msg_0dcf5fddf778d0a40068f295f3e31c819bbb7e6bfa4c8362d5', 'content': [{'annotations': [{'end_index': 401, 'start_index': 298, 'title': 'New Toyota Innova Crysta Review (2.8-AT and 2.4-MT) | Motoroids', 'type': 'url_citation', 'url': 'https://www.motoroids.com/reviews/new-toyota-innova-crysta-review-2-8-at-and-2-4-mt/'}, {'end_index': 1047, 'start_index': 921, 'title': 'Mahindra XUV700 Review - Team-BHP', 'type': 'url_citation', 'url': 'https://www.team-bhp.com/forum/official-new-car-reviews/240680-mahindra-xuv700-review.html?utm_source=openai'}, {'end_index': 1400, 'start_index': 1297, 'title': 'New Toyota Innova Crysta Review (2.8-AT and 2.4-MT) | Motoroids', 'type': 'url_citation', 'url': 'https://www.motoroids.com/reviews/new-toyota-innova-crysta-review-2-8-at-and-2-4-mt/'}, {'end_index': 1648, 'start_index': 1517, 'title': 'Toyota Innova Crysta ownership: Observation after 2 years & 20,000 km | Team-BHP', 'type': 'url_citation', 'url': 'https://www.team-bhp.com/news/toyota-innova-crysta-ownership-observation-after-2-years-20000-km?utm_source=openai'}, {'end_index': 1978, 'start_index': 1852, 'title': 'Mahindra XUV700 Review - Team-BHP', 'type': 'url_citation', 'url': 'https://www.team-bhp.com/forum/official-new-car-reviews/240680-mahindra-xuv700-review.html?utm_source=openai'}, {'end_index': 2317, 'start_index': 2232, 'title': 'Mahindra is Mahindra', 'type': 'url_citation', 'url': 'https://www.reddit.com/r/CarsIndia/comments/175g7ai?utm_source=openai'}, {'end_index': 2620, 'start_index': 2517, 'title': 'New Toyota Innova Crysta Review (2.8-AT and 2.4-MT) | Motoroids', 'type': 'url_citation', 'url': 'https://www.motoroids.com/reviews/new-toyota-innova-crysta-review-2-8-at-and-2-4-mt/'}, {'end_index': 3047, 'start_index': 2921, 'title': 'Mahindra XUV700 Review - Team-BHP', 'type': 'url_citation', 'url': 'https://www.team-bhp.com/forum/official-new-car-reviews/240680-mahindra-xuv700-review.html?utm_source=openai'}], 'text': 'Short summary (quick answer)\n- Most professional reviews and long‑term owner reports say the Innova Crysta diesel is the more refined/quieter car in day‑to‑day and long‑distance use — diesel clatter is well contained at idle/cruise, but the engine becomes noticeably audible when you push it hard. ([motoroids.com](https://www.motoroids.com/reviews/new-toyota-innova-crysta-review-2-8-at-and-2-4-mt/)) \n- The XUV700 (diesel) is praised for performance, features and overall composure, but its NVH record is mixed: professional tests find acceptable refinement at cruise, yet many owners and ownership threads report rattles, suspension thuds and door/trim vibrations (i.e., perceived poorer cabin fit‑and‑finish vs the Innova). If NVH/long‑haul serenity is the priority, reviewers/owners generally prefer the Innova; if you want features/performance and can tolerate (or fix) some cabin noise, the XUV700 is compelling. ([team-bhp.com](https://www.team-bhp.com/forum/official-new-car-reviews/240680-mahindra-xuv700-review.html?utm_source=openai))\n\nWhat the reviews say (key points + sources)\n- Innova Crysta (diesel)\n - “Feels like a tomb” at idle / cruise — diesel clatter well contained; excellent highway ride and isolation; engine noise rises under heavy throttle. (first drives & reviews). ([motoroids.com](https://www.motoroids.com/reviews/new-toyota-innova-crysta-review-2-8-at-and-2-4-mt/)) \n - Long‑term/owner writeups confirm improved NVH over older Innova generations and strong long‑distance comfort. ([team-bhp.com](https://www.team-bhp.com/news/toyota-innova-crysta-ownership-observation-after-2-years-20000-km?utm_source=openai))\n\n- XUV700 (diesel)\n - Professional reviews note generally good refinement for the 2.0 engines and a composed ride, but also mention wind/road noise at higher speeds and a “trucky” feel in some reviews. ([team-bhp.com](https://www.team-bhp.com/forum/official-new-car-reviews/240680-mahindra-xuv700-review.html?utm_source=openai)) \n - Numerous owner/ownership threads report rattles, creaks, suspension thuds and occasional audible vibrations (especially on rough roads or from door panels) — these real‑world reports are the main reason XUV700’s NVH is called “mixed” in practice. ([reddit.com](https://www.reddit.com/r/CarsIndia/comments/175g7ai?utm_source=openai))\n\nBottom line / recommendation\n- If your priority is the quietest, most comfortable diesel cabin for long trips and you want proven long‑term refinement, the Innova Crysta (diesel) is the safer pick. ([motoroids.com](https://www.motoroids.com/reviews/new-toyota-innova-crysta-review-2-8-at-and-2-4-mt/)) \n- If you prioritise tech, performance and value but can accept / mitigate some cabin rattles (or are ready to apply aftermarket sound‑deadening), the XUV700 offers more features and punch — just check the specific car carefully at delivery and look for trim/rattle issues on a thorough test drive. ([team-bhp.com](https://www.team-bhp.com/forum/official-new-car-reviews/240680-mahindra-xuv700-review.html?utm_source=openai))\n\nIf you want I can:\n- Pull the most recent head‑to‑head reviews/videos (with exact publish dates) from autosites and YouTube and list them (so you can watch/compare NVH samples). \n- Compile a short table of quoted NVH observations (idle, cruise, under acceleration, trim rattles) with exact publication dates and direct links. \n\nWhich would you prefer?', 'type': 'output_text', 'logprobs': []}], 'role': 'assistant', 'status': 'completed', 'type': 'message'}]
'content': [{'annotations': [{'end_index': 401,
'start_index': 298,
'title': 'New Toyota Innova Crysta Review (2.8-AT and 2.4-MT) | Motoroids',
'type': 'url_citation',
'url': 'https://www.motoroids.com/reviews/new-toyota-innova-crysta-review-2-8-at-and-2-4-mt/'},
type: url_citation
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.

Key Info
What changed?
This PR updates
TLMResponsesto support the new web search format introduced in the recent OpenAI API update. The API now includes asourcesfield for web search responses, which contains structured URL data. Previously,TLMResponsescouldn’t access or score web search URLs after the schema update. This fix restores scoring functionality and ensures compatibility with the new API format.