Skip to content

Commit dd30c87

Browse files
feat(api): add web search filters
1 parent c7cf473 commit dd30c87

File tree

4 files changed

+116
-5
lines changed

4 files changed

+116
-5
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 119
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-ddbdf9343316047e8a773c54fb24e4a8d225955e202a1888fde6f9c8898ebf98.yml
3-
openapi_spec_hash: 9802f6dd381558466c897f6e387e06ca
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-8517ffa1004e31ca2523d617629e64be6fe4f13403ddfd9db5b3be002656cbde.yml
3+
openapi_spec_hash: b64dd8c8b23082a7aa2a3e5c5fffd8bd
44
config_hash: fe0ea26680ac2075a6cd66416aefe7db

src/resources/conversations/conversations.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export class Conversations extends APIResource {
2222
items: ItemsAPI.Items = new ItemsAPI.Items(this._client);
2323

2424
/**
25-
* Create a conversation with the given ID.
25+
* Create a conversation.
2626
*/
2727
create(body: ConversationCreateParams, options?: RequestOptions): APIPromise<Conversation> {
2828
return this._client.post('/conversations', { body, ...options });

src/resources/conversations/items.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,8 @@ export interface ItemListParams extends ConversationCursorPageParams {
438438
* Specify additional output data to include in the model response. Currently
439439
* supported values are:
440440
*
441+
* - `web_search_call.action.sources`: Include the sources of the web search tool
442+
* call.
441443
* - `code_interpreter_call.outputs`: Includes the outputs of python code execution
442444
* in code interpreter tool call items.
443445
* - `computer_call_output.output.image_url`: Include image urls from the computer

src/resources/responses/responses.ts

Lines changed: 111 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1949,6 +1949,28 @@ export namespace ResponseFunctionWebSearch {
19491949
* The action type.
19501950
*/
19511951
type: 'search';
1952+
1953+
/**
1954+
* The sources used in the search.
1955+
*/
1956+
sources?: Array<Search.Source>;
1957+
}
1958+
1959+
export namespace Search {
1960+
/**
1961+
* A source used in the search.
1962+
*/
1963+
export interface Source {
1964+
/**
1965+
* The type of source. Always `url`.
1966+
*/
1967+
type: 'url';
1968+
1969+
/**
1970+
* The URL of the source.
1971+
*/
1972+
url: string;
1973+
}
19521974
}
19531975

19541976
/**
@@ -2124,6 +2146,12 @@ export interface ResponseInProgressEvent {
21242146
* Specify additional output data to include in the model response. Currently
21252147
* supported values are:
21262148
*
2149+
* - `web_search_call.action.sources`: Include the sources of the web search tool
2150+
* call.
2151+
* - `code_interpreter_call.outputs`: Includes the outputs of python code execution
2152+
* in code interpreter tool call items.
2153+
* - `computer_call_output.output.image_url`: Include image urls from the computer
2154+
* call output.
21272155
* - `file_search_call.results`: Include the search results of the file search tool
21282156
* call.
21292157
* - `message.input_image.image_url`: Include image urls from the input message.
@@ -4625,15 +4653,90 @@ export interface ResponseWebSearchCallSearchingEvent {
46254653
export type Tool =
46264654
| FunctionTool
46274655
| FileSearchTool
4628-
| WebSearchTool
46294656
| ComputerTool
4657+
| Tool.WebSearchTool
46304658
| Tool.Mcp
46314659
| Tool.CodeInterpreter
46324660
| Tool.ImageGeneration
46334661
| Tool.LocalShell
4634-
| CustomTool;
4662+
| CustomTool
4663+
| WebSearchTool;
46354664

46364665
export namespace Tool {
4666+
/**
4667+
* Search the Internet for sources related to the prompt. Learn more about the
4668+
* [web search tool](https://platform.openai.com/docs/guides/tools-web-search).
4669+
*/
4670+
export interface WebSearchTool {
4671+
/**
4672+
* The type of the web search tool. One of `web_search` or `web_search_2025_08_26`.
4673+
*/
4674+
type: 'web_search' | 'web_search_2025_08_26';
4675+
4676+
/**
4677+
* Filters for the search.
4678+
*/
4679+
filters?: WebSearchTool.Filters | null;
4680+
4681+
/**
4682+
* High level guidance for the amount of context window space to use for the
4683+
* search. One of `low`, `medium`, or `high`. `medium` is the default.
4684+
*/
4685+
search_context_size?: 'low' | 'medium' | 'high';
4686+
4687+
/**
4688+
* The approximate location of the user.
4689+
*/
4690+
user_location?: WebSearchTool.UserLocation | null;
4691+
}
4692+
4693+
export namespace WebSearchTool {
4694+
/**
4695+
* Filters for the search.
4696+
*/
4697+
export interface Filters {
4698+
/**
4699+
* Allowed domains for the search. If not provided, all domains are allowed.
4700+
* Subdomains of the provided domains are allowed as well.
4701+
*
4702+
* Example: `["pubmed.ncbi.nlm.nih.gov"]`
4703+
*/
4704+
allowed_domains?: Array<string> | null;
4705+
}
4706+
4707+
/**
4708+
* The approximate location of the user.
4709+
*/
4710+
export interface UserLocation {
4711+
/**
4712+
* Free text input for the city of the user, e.g. `San Francisco`.
4713+
*/
4714+
city?: string | null;
4715+
4716+
/**
4717+
* The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of
4718+
* the user, e.g. `US`.
4719+
*/
4720+
country?: string | null;
4721+
4722+
/**
4723+
* Free text input for the region of the user, e.g. `California`.
4724+
*/
4725+
region?: string | null;
4726+
4727+
/**
4728+
* The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the
4729+
* user, e.g. `America/Los_Angeles`.
4730+
*/
4731+
timezone?: string | null;
4732+
4733+
/**
4734+
* The type of location approximation. Always `approximate`.
4735+
*/
4736+
type?: 'approximate';
4737+
}
4738+
}
4739+
46374740
/**
46384741
* Give the model access to additional tools via remote Model Context Protocol
46394742
* (MCP) servers.
@@ -5122,6 +5225,12 @@ export interface ResponseCreateParamsBase {
51225225
* Specify additional output data to include in the model response. Currently
51235226
* supported values are:
51245227
*
5228+
* - `web_search_call.action.sources`: Include the sources of the web search tool
5229+
* call.
5230+
* - `code_interpreter_call.outputs`: Includes the outputs of python code execution
5231+
* in code interpreter tool call items.
5232+
* - `computer_call_output.output.image_url`: Include image urls from the computer
5233+
* call output.
51255234
* - `file_search_call.results`: Include the search results of the file search tool
51265235
* call.
51275236
* - `message.input_image.image_url`: Include image urls from the input message.

0 commit comments

Comments
 (0)