Early accessGnani Evon v3.5 is now available as an API to early access registrants.
The model’s knowledge stops at its training date. With web search, it can look things up (today’s weather, current prices, recent events) and answer with sources.
When to use this
- Questions about now, such as the weather this weekend or today’s prices.
- Recent events that happened after the model was trained.
- Answers you want to cite, with links your users can check.
Turn on web search
Add the built-inweb_search tool to tools. The service runs the searches for you. Unlike function tools, you do not run anything or send results back. You get the final answer, with numbered citations like [1] and the list of sources.
Response
When the model searched,message.web_search lists what it searched for and the sources it was given. The answer cites them by id. The full response is in the example panel.
usage adds up every model call made for the request, including the search results the model read. A searched answer therefore uses more tokens than a plain one.
OpenAI returns citations as
annotations of type url_citation. Here they come as [n] markers in content and the list in message.web_search.sources.Showing citations
To show citations, replace each[n] in content with a link to sources[n-1].url, or list the sources under the answer. These helpers look each source up by its id and turn the markers into Markdown links:
Streaming
With"stream": true, you see each search as it happens. A chunk whose choices[0].delta.web_search is set reports progress; the answer then streams in delta.content as usual.
Search status values
Search status values
A failed search never fails the request. The model answers from what it knows and says that live search was not available.
Limits
Tokens used for a searched answer count toward your daily token quota like any other request.
Rules
tool_choicemust beauto(the default) ornone.noneturns search off for the request.- You can send your own function tools in the same request. If the model calls one of them, the reply is returned to you with
tool_calls, as in Tool calling. - Do not name one of your own functions
web_searchorsearch; the request is refused with400. - If web search is not available, the request is refused with
503 web_search_unavailable. Retry later, or send it without the tool. - Search results are screened by the safety filters like any other text. A result that fails the check is dropped, and the model answers without it.
Related
Tool calling
Use web search alongside your own functions.
Limits
Daily searches and the daily token quota.
Streaming
Read search progress and the answer as they arrive.
Safety and privacy
How search results are screened.