A hosted tool that lets the LLM search the web. Currently only supported with OpenAI models, using the Responses API.
| 686 | |
| 687 | @dataclass |
| 688 | class WebSearchTool: |
| 689 | """A hosted tool that lets the LLM search the web. Currently only supported with OpenAI models, |
| 690 | using the Responses API. |
| 691 | """ |
| 692 | |
| 693 | user_location: UserLocation | None = None |
| 694 | """Optional location for the search. Lets you customize results to be relevant to a location.""" |
| 695 | |
| 696 | filters: WebSearchToolFilters | None = None |
| 697 | """A filter to apply based on file attributes.""" |
| 698 | |
| 699 | search_context_size: Literal["low", "medium", "high"] = "medium" |
| 700 | """The amount of context to use for the search.""" |
| 701 | |
| 702 | external_web_access: bool | None = None |
| 703 | """Whether the web search tool may fetch live internet content. |
| 704 | |
| 705 | When omitted, the API default is used. Set to `False` to request cached or |
| 706 | indexed-only behavior where supported. |
| 707 | """ |
| 708 | |
| 709 | @property |
| 710 | def name(self): |
| 711 | return "web_search" |
| 712 | |
| 713 | |
| 714 | @dataclass(eq=False) |
no outgoing calls