Skip to content

Commit d17785c

Browse files
feat(api): manual updates
1 parent b2d7e82 commit d17785c

File tree

9 files changed

+55
-16
lines changed

9 files changed

+55
-16
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: 5
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/perplexity-ai%2Fperplexity-aba0c21c569842e93e17b69cae9cee58d389fce9c2482f4d251fd8727db05679.yml
3-
openapi_spec_hash: 3d01b1c1425f7d43a8acf8b99bb9b321
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/perplexity-ai%2Fperplexity-51a3b755ae8040a6baeff490b3226a94c02a71aca6c4754dd365d7d0de8e399d.yml
3+
openapi_spec_hash: 03d28237de381a5b914ef738b3587bb5
44
config_hash: 0be7520657a7a0fb6b5a839e716fe30c

src/resources/async/chat/completions.ts

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,21 @@ import { path } from '../../../internal/utils/path';
1010

1111
export class Completions extends APIResource {
1212
/**
13-
* FastAPI wrapper around async chat completions
14-
*
15-
* This endpoint creates an asynchronous chat completion job and returns a job ID
16-
* that can be used to poll for results.
13+
* Submit an asynchronous chat completion request.
1714
*/
1815
create(body: CompletionCreateParams, options?: RequestOptions): APIPromise<CompletionCreateResponse> {
1916
return this._client.post('/async/chat/completions', { body, ...options });
2017
}
2118

2219
/**
23-
* list all async chat completion requests for a given user.
20+
* Retrieve a list of all asynchronous chat completion requests for a given user.
2421
*/
2522
list(options?: RequestOptions): APIPromise<CompletionListResponse> {
2623
return this._client.get('/async/chat/completions', options);
2724
}
2825

2926
/**
30-
* get the response for a given async chat completion request.
27+
* Retrieve the response for a given asynchronous chat completion request.
3128
*/
3229
get(
3330
apiRequest: string,
@@ -37,6 +34,7 @@ export class Completions extends APIResource {
3734
const {
3835
'x-client-env': xClientEnv,
3936
'x-client-name': xClientName,
37+
'x-created-at-epoch-seconds': xCreatedAtEpochSeconds,
4038
'x-request-time': xRequestTime,
4139
'x-usage-tier': xUsageTier,
4240
'x-user-id': xUserID,
@@ -49,6 +47,9 @@ export class Completions extends APIResource {
4947
{
5048
...(xClientEnv != null ? { 'x-client-env': xClientEnv } : undefined),
5149
...(xClientName != null ? { 'x-client-name': xClientName } : undefined),
50+
...(xCreatedAtEpochSeconds != null ?
51+
{ 'x-created-at-epoch-seconds': xCreatedAtEpochSeconds }
52+
: undefined),
5253
...(xRequestTime != null ? { 'x-request-time': xRequestTime } : undefined),
5354
...(xUsageTier != null ? { 'x-usage-tier': xUsageTier } : undefined),
5455
...(xUserID != null ? { 'x-user-id': xUserID } : undefined),
@@ -176,6 +177,8 @@ export namespace CompletionCreateParams {
176177

177178
image_format_filter?: Array<string> | null;
178179

180+
language_preference?: string | null;
181+
179182
last_updated_after_filter?: string | null;
180183

181184
last_updated_before_filter?: string | null;
@@ -234,8 +237,12 @@ export namespace CompletionCreateParams {
234237

235238
stream?: boolean | null;
236239

240+
stream_mode?: 'full' | 'concise';
241+
237242
temperature?: number | null;
238243

244+
thread_id?: string | null;
245+
239246
tool_choice?: 'none' | 'auto' | 'required' | null;
240247

241248
tools?: Array<Request.Tool> | null;
@@ -250,6 +257,8 @@ export namespace CompletionCreateParams {
250257

251258
updated_before_timestamp?: number | null;
252259

260+
use_threads?: boolean | null;
261+
253262
web_search_options?: Request.WebSearchOptions;
254263
}
255264

@@ -335,7 +344,7 @@ export namespace CompletionCreateParams {
335344

336345
search_context_size?: 'low' | 'medium' | 'high';
337346

338-
search_type?: 'fast' | 'pro' | 'auto';
347+
search_type?: 'fast' | 'pro' | 'auto' | null;
339348

340349
user_location?: WebSearchOptions.UserLocation | null;
341350
}
@@ -372,6 +381,11 @@ export interface CompletionGetParams {
372381
*/
373382
'x-client-name'?: string;
374383

384+
/**
385+
* Header param:
386+
*/
387+
'x-created-at-epoch-seconds'?: string;
388+
375389
/**
376390
* Header param:
377391
*/

src/resources/chat/chat.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ export interface StreamChunk {
2323

2424
model: string;
2525

26-
usage: Shared.UsageInfo;
27-
2826
citations?: Array<string> | null;
2927

3028
object?: string;
@@ -34,6 +32,8 @@ export interface StreamChunk {
3432
status?: 'PENDING' | 'COMPLETED' | null;
3533

3634
type?: 'message' | 'info' | 'end_of_stream' | null;
35+
36+
usage?: Shared.UsageInfo | null;
3737
}
3838

3939
Chat.Completions = Completions;

src/resources/chat/completions.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { RequestOptions } from '../../internal/request-options';
1010

1111
export class Completions extends APIResource {
1212
/**
13-
* FastAPI wrapper around chat completions
13+
* Generate a chat completion response for the given conversation.
1414
*/
1515
create(body: CompletionCreateParamsNonStreaming, options?: RequestOptions): APIPromise<ChatAPI.StreamChunk>;
1616
create(
@@ -70,6 +70,8 @@ export interface CompletionCreateParamsBase {
7070

7171
image_format_filter?: Array<string> | null;
7272

73+
language_preference?: string | null;
74+
7375
last_updated_after_filter?: string | null;
7476

7577
last_updated_before_filter?: string | null;
@@ -128,8 +130,12 @@ export interface CompletionCreateParamsBase {
128130

129131
stream?: boolean | null;
130132

133+
stream_mode?: 'full' | 'concise';
134+
131135
temperature?: number | null;
132136

137+
thread_id?: string | null;
138+
133139
tool_choice?: 'none' | 'auto' | 'required' | null;
134140

135141
tools?: Array<CompletionCreateParams.Tool> | null;
@@ -144,6 +150,8 @@ export interface CompletionCreateParamsBase {
144150

145151
updated_before_timestamp?: number | null;
146152

153+
use_threads?: boolean | null;
154+
147155
web_search_options?: CompletionCreateParams.WebSearchOptions;
148156
}
149157

@@ -229,7 +237,7 @@ export namespace CompletionCreateParams {
229237

230238
search_context_size?: 'low' | 'medium' | 'high';
231239

232-
search_type?: 'fast' | 'pro' | 'auto';
240+
search_type?: 'fast' | 'pro' | 'auto' | null;
233241

234242
user_location?: WebSearchOptions.UserLocation | null;
235243
}

src/resources/search.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { RequestOptions } from '../internal/request-options';
66

77
export class Search extends APIResource {
88
/**
9-
* Search
9+
* Search the web and retrieve relevant web page contents.
1010
*/
1111
create(body: SearchCreateParams, options?: RequestOptions): APIPromise<SearchCreateResponse> {
1212
return this._client.post('/search', { body, ...options });
@@ -17,6 +17,8 @@ export interface SearchCreateResponse {
1717
id: string;
1818

1919
results: Array<SearchCreateResponse.Result>;
20+
21+
server_time?: string | null;
2022
}
2123

2224
export namespace SearchCreateResponse {
@@ -36,7 +38,7 @@ export namespace SearchCreateResponse {
3638
export interface SearchCreateParams {
3739
query: string | Array<string>;
3840

39-
country?: string | null;
41+
display_server_time?: boolean;
4042

4143
max_results?: number;
4244

src/resources/shared.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ export interface APIPublicSearchResult {
1212
last_updated?: string | null;
1313

1414
snippet?: string;
15+
16+
source?: 'web' | 'attachment';
1517
}
1618

1719
export interface ChatMessageInput {

tests/api-resources/async/chat/completions.test.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ describe('resource completions', () => {
4646
date: 'date',
4747
last_updated: 'last_updated',
4848
snippet: 'snippet',
49+
source: 'web',
4950
},
5051
],
5152
},
@@ -59,6 +60,7 @@ describe('resource completions', () => {
5960
date: 'date',
6061
last_updated: 'last_updated',
6162
snippet: 'snippet',
63+
source: 'web',
6264
},
6365
],
6466
},
@@ -87,6 +89,7 @@ describe('resource completions', () => {
8789
has_image_url: true,
8890
image_domain_filter: ['string'],
8991
image_format_filter: ['string'],
92+
language_preference: 'language_preference',
9093
last_updated_after_filter: 'last_updated_after_filter',
9194
last_updated_before_filter: 'last_updated_before_filter',
9295
latitude: 0,
@@ -114,7 +117,9 @@ describe('resource completions', () => {
114117
search_tenant: 'search_tenant',
115118
stop: 'string',
116119
stream: true,
120+
stream_mode: 'full',
117121
temperature: 0,
122+
thread_id: 'thread_id',
118123
tool_choice: 'none',
119124
tools: [
120125
{
@@ -137,6 +142,7 @@ describe('resource completions', () => {
137142
top_p: 0,
138143
updated_after_timestamp: 0,
139144
updated_before_timestamp: 0,
145+
use_threads: true,
140146
web_search_options: {
141147
image_results_enhanced_relevance: true,
142148
search_context_size: 'low',
@@ -182,6 +188,7 @@ describe('resource completions', () => {
182188
local_mode: true,
183189
'x-client-env': 'x-client-env',
184190
'x-client-name': 'x-client-name',
191+
'x-created-at-epoch-seconds': 'x-created-at-epoch-seconds',
185192
'x-request-time': 'x-request-time',
186193
'x-usage-tier': 'x-usage-tier',
187194
'x-user-id': 'x-user-id',

tests/api-resources/chat/completions.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ describe('resource completions', () => {
4646
date: 'date',
4747
last_updated: 'last_updated',
4848
snippet: 'snippet',
49+
source: 'web',
4950
},
5051
],
5152
},
@@ -59,6 +60,7 @@ describe('resource completions', () => {
5960
date: 'date',
6061
last_updated: 'last_updated',
6162
snippet: 'snippet',
63+
source: 'web',
6264
},
6365
],
6466
},
@@ -87,6 +89,7 @@ describe('resource completions', () => {
8789
has_image_url: true,
8890
image_domain_filter: ['string'],
8991
image_format_filter: ['string'],
92+
language_preference: 'language_preference',
9093
last_updated_after_filter: 'last_updated_after_filter',
9194
last_updated_before_filter: 'last_updated_before_filter',
9295
latitude: 0,
@@ -114,7 +117,9 @@ describe('resource completions', () => {
114117
search_tenant: 'search_tenant',
115118
stop: 'string',
116119
stream: false,
120+
stream_mode: 'full',
117121
temperature: 0,
122+
thread_id: 'thread_id',
118123
tool_choice: 'none',
119124
tools: [
120125
{
@@ -137,6 +142,7 @@ describe('resource completions', () => {
137142
top_p: 0,
138143
updated_after_timestamp: 0,
139144
updated_before_timestamp: 0,
145+
use_threads: true,
140146
web_search_options: {
141147
image_results_enhanced_relevance: true,
142148
search_context_size: 'low',

tests/api-resources/search.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ describe('resource search', () => {
2424
test.skip('create: required and optional params', async () => {
2525
const response = await client.search.create({
2626
query: 'string',
27-
country: 'country',
27+
display_server_time: true,
2828
max_results: 0,
2929
max_tokens: 0,
3030
max_tokens_per_page: 0,

0 commit comments

Comments
 (0)