@perplexity-ai/perplexity_ai 0.22.0 → 0.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +47 -0
- package/client.d.mts +12 -2
- package/client.d.mts.map +1 -1
- package/client.d.ts +12 -2
- package/client.d.ts.map +1 -1
- package/client.js +14 -2
- package/client.js.map +1 -1
- package/client.mjs +14 -2
- package/client.mjs.map +1 -1
- package/core/streaming.js.map +1 -1
- package/core/streaming.mjs.map +1 -1
- package/internal/parse.d.mts.map +1 -1
- package/internal/parse.d.ts.map +1 -1
- package/internal/parse.js +5 -0
- package/internal/parse.js.map +1 -1
- package/internal/parse.mjs +5 -0
- package/internal/parse.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/contextualized-embeddings.d.mts +64 -0
- package/resources/contextualized-embeddings.d.mts.map +1 -0
- package/resources/contextualized-embeddings.d.ts +64 -0
- package/resources/contextualized-embeddings.d.ts.map +1 -0
- package/resources/contextualized-embeddings.js +17 -0
- package/resources/contextualized-embeddings.js.map +1 -0
- package/resources/contextualized-embeddings.mjs +13 -0
- package/resources/contextualized-embeddings.mjs.map +1 -0
- package/resources/embeddings.d.mts +60 -0
- package/resources/embeddings.d.mts.map +1 -0
- package/resources/embeddings.d.ts +60 -0
- package/resources/embeddings.d.ts.map +1 -0
- package/resources/embeddings.js +16 -0
- package/resources/embeddings.js.map +1 -0
- package/resources/embeddings.mjs +12 -0
- package/resources/embeddings.mjs.map +1 -0
- package/resources/index.d.mts +3 -1
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +3 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +5 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +2 -0
- package/resources/index.mjs.map +1 -1
- package/resources/responses.d.mts +111 -43
- package/resources/responses.d.mts.map +1 -1
- package/resources/responses.d.ts +111 -43
- package/resources/responses.d.ts.map +1 -1
- package/resources/shared.d.mts +72 -0
- package/resources/shared.d.mts.map +1 -1
- package/resources/shared.d.ts +72 -0
- package/resources/shared.d.ts.map +1 -1
- package/src/client.ts +41 -3
- package/src/core/streaming.ts +2 -2
- package/src/internal/parse.ts +6 -0
- package/src/resources/contextualized-embeddings.ts +83 -0
- package/src/resources/embeddings.ts +76 -0
- package/src/resources/index.ts +9 -0
- package/src/resources/responses.ts +144 -54
- package/src/resources/shared.ts +84 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -79,10 +79,139 @@ export interface ErrorInfo {
|
|
|
79
79
|
type?: string;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
+
export interface FunctionCallOutputItem {
|
|
83
|
+
id: string;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* JSON string of arguments
|
|
87
|
+
*/
|
|
88
|
+
arguments: string;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Correlates with function_call_output input
|
|
92
|
+
*/
|
|
93
|
+
call_id: string;
|
|
94
|
+
|
|
95
|
+
name: string;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Status of a response or output item
|
|
99
|
+
*/
|
|
100
|
+
status: 'completed' | 'failed' | 'in_progress' | 'requires_action';
|
|
101
|
+
|
|
102
|
+
type: 'function_call';
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Base64-encoded opaque signature for thinking models
|
|
106
|
+
*/
|
|
107
|
+
thought_signature?: string;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export interface FunctionTool {
|
|
111
|
+
/**
|
|
112
|
+
* The name of the function
|
|
113
|
+
*/
|
|
114
|
+
name: string;
|
|
115
|
+
|
|
116
|
+
type: 'function';
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* A description of what the function does
|
|
120
|
+
*/
|
|
121
|
+
description?: string;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* JSON Schema defining the function's parameters
|
|
125
|
+
*/
|
|
126
|
+
parameters?: { [key: string]: unknown };
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Whether to enable strict schema validation
|
|
130
|
+
*/
|
|
131
|
+
strict?: boolean;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export type InputItem =
|
|
135
|
+
| InputItem.InputMessage
|
|
136
|
+
| InputItem.FunctionCallOutputInput
|
|
137
|
+
| InputItem.FunctionCallInput;
|
|
138
|
+
|
|
139
|
+
export namespace InputItem {
|
|
140
|
+
export interface InputMessage {
|
|
141
|
+
/**
|
|
142
|
+
* Message content - either a string or array of content parts
|
|
143
|
+
*/
|
|
144
|
+
content: string | Array<InputMessage.ContentPartArray>;
|
|
145
|
+
|
|
146
|
+
role: 'user' | 'assistant' | 'system' | 'developer';
|
|
147
|
+
|
|
148
|
+
type: 'message';
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export namespace InputMessage {
|
|
152
|
+
export interface ContentPartArray {
|
|
153
|
+
type: 'input_text' | 'input_image';
|
|
154
|
+
|
|
155
|
+
image_url?: string;
|
|
156
|
+
|
|
157
|
+
text?: string;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export interface FunctionCallOutputInput {
|
|
162
|
+
/**
|
|
163
|
+
* The call_id from function_call output
|
|
164
|
+
*/
|
|
165
|
+
call_id: string;
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Function result (JSON string)
|
|
169
|
+
*/
|
|
170
|
+
output: string;
|
|
171
|
+
|
|
172
|
+
type: 'function_call_output';
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Function name (required by some providers)
|
|
176
|
+
*/
|
|
177
|
+
name?: string;
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Base64-encoded signature from function_call
|
|
181
|
+
*/
|
|
182
|
+
thought_signature?: string;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export interface FunctionCallInput {
|
|
186
|
+
/**
|
|
187
|
+
* Function arguments (JSON string)
|
|
188
|
+
*/
|
|
189
|
+
arguments: string;
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* The call_id that correlates with function_call_output
|
|
193
|
+
*/
|
|
194
|
+
call_id: string;
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* The function name
|
|
198
|
+
*/
|
|
199
|
+
name: string;
|
|
200
|
+
|
|
201
|
+
type: 'function_call';
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Base64-encoded signature for thinking models
|
|
205
|
+
*/
|
|
206
|
+
thought_signature?: string;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
82
210
|
export type OutputItem =
|
|
83
211
|
| OutputItem.MessageOutputItem
|
|
84
212
|
| OutputItem.SearchResultsOutputItem
|
|
85
|
-
| OutputItem.FetchURLResultsOutputItem
|
|
213
|
+
| OutputItem.FetchURLResultsOutputItem
|
|
214
|
+
| FunctionCallOutputItem;
|
|
86
215
|
|
|
87
216
|
export namespace OutputItem {
|
|
88
217
|
export interface MessageOutputItem {
|
|
@@ -98,7 +227,7 @@ export namespace OutputItem {
|
|
|
98
227
|
/**
|
|
99
228
|
* Status of a response or output item
|
|
100
229
|
*/
|
|
101
|
-
status: 'completed' | 'failed' | 'in_progress';
|
|
230
|
+
status: 'completed' | 'failed' | 'in_progress' | 'requires_action';
|
|
102
231
|
|
|
103
232
|
type: 'message';
|
|
104
233
|
}
|
|
@@ -231,7 +360,7 @@ export namespace ResponseStreamChunk {
|
|
|
231
360
|
/**
|
|
232
361
|
* Status of a response or output item
|
|
233
362
|
*/
|
|
234
|
-
status: 'completed' | 'failed' | 'in_progress';
|
|
363
|
+
status: 'completed' | 'failed' | 'in_progress' | 'requires_action';
|
|
235
364
|
|
|
236
365
|
error?: ResponsesAPI.ErrorInfo;
|
|
237
366
|
|
|
@@ -295,7 +424,7 @@ export namespace ResponseStreamChunk {
|
|
|
295
424
|
/**
|
|
296
425
|
* Status of a response or output item
|
|
297
426
|
*/
|
|
298
|
-
status: 'completed' | 'failed' | 'in_progress';
|
|
427
|
+
status: 'completed' | 'failed' | 'in_progress' | 'requires_action';
|
|
299
428
|
|
|
300
429
|
error?: ResponsesAPI.ErrorInfo;
|
|
301
430
|
|
|
@@ -358,7 +487,7 @@ export namespace ResponseStreamChunk {
|
|
|
358
487
|
/**
|
|
359
488
|
* Status of a response or output item
|
|
360
489
|
*/
|
|
361
|
-
status: 'completed' | 'failed' | 'in_progress';
|
|
490
|
+
status: 'completed' | 'failed' | 'in_progress' | 'requires_action';
|
|
362
491
|
|
|
363
492
|
error?: ResponsesAPI.ErrorInfo;
|
|
364
493
|
|
|
@@ -769,9 +898,9 @@ export namespace ResponseStreamChunk {
|
|
|
769
898
|
|
|
770
899
|
export interface ResponsesCreateParams {
|
|
771
900
|
/**
|
|
772
|
-
* Input content - either a string or array of input
|
|
901
|
+
* Input content - either a string or array of input items
|
|
773
902
|
*/
|
|
774
|
-
input: string | Array<
|
|
903
|
+
input: string | Array<InputItem>;
|
|
775
904
|
|
|
776
905
|
/**
|
|
777
906
|
* System instructions for the model
|
|
@@ -831,31 +960,10 @@ export interface ResponsesCreateParams {
|
|
|
831
960
|
/**
|
|
832
961
|
* Tools available to the model
|
|
833
962
|
*/
|
|
834
|
-
tools?: Array<ResponsesCreateParams.WebSearchTool | ResponsesCreateParams.FetchURLTool>;
|
|
963
|
+
tools?: Array<ResponsesCreateParams.WebSearchTool | ResponsesCreateParams.FetchURLTool | FunctionTool>;
|
|
835
964
|
}
|
|
836
965
|
|
|
837
966
|
export namespace ResponsesCreateParams {
|
|
838
|
-
export interface InputMessageArray {
|
|
839
|
-
/**
|
|
840
|
-
* Message content - either a string or array of content parts
|
|
841
|
-
*/
|
|
842
|
-
content: string | Array<InputMessageArray.ContentPartArray>;
|
|
843
|
-
|
|
844
|
-
role: 'user' | 'assistant' | 'system' | 'developer';
|
|
845
|
-
|
|
846
|
-
type?: 'message';
|
|
847
|
-
}
|
|
848
|
-
|
|
849
|
-
export namespace InputMessageArray {
|
|
850
|
-
export interface ContentPartArray {
|
|
851
|
-
type: 'input_text' | 'input_image';
|
|
852
|
-
|
|
853
|
-
image_url?: string;
|
|
854
|
-
|
|
855
|
-
text?: string;
|
|
856
|
-
}
|
|
857
|
-
}
|
|
858
|
-
|
|
859
967
|
export interface Reasoning {
|
|
860
968
|
/**
|
|
861
969
|
* How much effort the model should spend on reasoning
|
|
@@ -1002,7 +1110,7 @@ export interface ResponseCreateResponse {
|
|
|
1002
1110
|
/**
|
|
1003
1111
|
* Status of a response or output item
|
|
1004
1112
|
*/
|
|
1005
|
-
status: 'completed' | 'failed' | 'in_progress';
|
|
1113
|
+
status: 'completed' | 'failed' | 'in_progress' | 'requires_action';
|
|
1006
1114
|
|
|
1007
1115
|
error?: ErrorInfo;
|
|
1008
1116
|
|
|
@@ -1019,9 +1127,9 @@ export type ResponseCreateParams = ResponseCreateParamsNonStreaming | ResponseCr
|
|
|
1019
1127
|
|
|
1020
1128
|
export interface ResponseCreateParamsBase {
|
|
1021
1129
|
/**
|
|
1022
|
-
* Input content - either a string or array of input
|
|
1130
|
+
* Input content - either a string or array of input items
|
|
1023
1131
|
*/
|
|
1024
|
-
input: string | Array<
|
|
1132
|
+
input: string | Array<InputItem>;
|
|
1025
1133
|
|
|
1026
1134
|
/**
|
|
1027
1135
|
* System instructions for the model
|
|
@@ -1081,31 +1189,10 @@ export interface ResponseCreateParamsBase {
|
|
|
1081
1189
|
/**
|
|
1082
1190
|
* Tools available to the model
|
|
1083
1191
|
*/
|
|
1084
|
-
tools?: Array<ResponseCreateParams.WebSearchTool | ResponseCreateParams.FetchURLTool>;
|
|
1192
|
+
tools?: Array<ResponseCreateParams.WebSearchTool | ResponseCreateParams.FetchURLTool | FunctionTool>;
|
|
1085
1193
|
}
|
|
1086
1194
|
|
|
1087
1195
|
export namespace ResponseCreateParams {
|
|
1088
|
-
export interface InputMessageArray {
|
|
1089
|
-
/**
|
|
1090
|
-
* Message content - either a string or array of content parts
|
|
1091
|
-
*/
|
|
1092
|
-
content: string | Array<InputMessageArray.ContentPartArray>;
|
|
1093
|
-
|
|
1094
|
-
role: 'user' | 'assistant' | 'system' | 'developer';
|
|
1095
|
-
|
|
1096
|
-
type?: 'message';
|
|
1097
|
-
}
|
|
1098
|
-
|
|
1099
|
-
export namespace InputMessageArray {
|
|
1100
|
-
export interface ContentPartArray {
|
|
1101
|
-
type: 'input_text' | 'input_image';
|
|
1102
|
-
|
|
1103
|
-
image_url?: string;
|
|
1104
|
-
|
|
1105
|
-
text?: string;
|
|
1106
|
-
}
|
|
1107
|
-
}
|
|
1108
|
-
|
|
1109
1196
|
export interface Reasoning {
|
|
1110
1197
|
/**
|
|
1111
1198
|
* How much effort the model should spend on reasoning
|
|
@@ -1206,6 +1293,9 @@ export declare namespace Responses {
|
|
|
1206
1293
|
type Annotation as Annotation,
|
|
1207
1294
|
type ContentPart as ContentPart,
|
|
1208
1295
|
type ErrorInfo as ErrorInfo,
|
|
1296
|
+
type FunctionCallOutputItem as FunctionCallOutputItem,
|
|
1297
|
+
type FunctionTool as FunctionTool,
|
|
1298
|
+
type InputItem as InputItem,
|
|
1209
1299
|
type OutputItem as OutputItem,
|
|
1210
1300
|
type ResponseStreamChunk as ResponseStreamChunk,
|
|
1211
1301
|
type ResponsesCreateParams as ResponsesCreateParams,
|
package/src/resources/shared.ts
CHANGED
|
@@ -328,6 +328,90 @@ export interface Choice {
|
|
|
328
328
|
finish_reason?: 'stop' | 'length' | null;
|
|
329
329
|
}
|
|
330
330
|
|
|
331
|
+
/**
|
|
332
|
+
* A single contextualized embedding result
|
|
333
|
+
*/
|
|
334
|
+
export interface ContextualizedEmbeddingObject {
|
|
335
|
+
/**
|
|
336
|
+
* List of embedding objects for chunks in this document
|
|
337
|
+
*/
|
|
338
|
+
data?: Array<EmbeddingObject>;
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* The index of the document this chunk belongs to
|
|
342
|
+
*/
|
|
343
|
+
index?: number;
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* The object type
|
|
347
|
+
*/
|
|
348
|
+
object?: string;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* A single embedding result
|
|
353
|
+
*/
|
|
354
|
+
export interface EmbeddingObject {
|
|
355
|
+
/**
|
|
356
|
+
* Base64-encoded embedding vector. For base64_int8: decode to signed int8 array
|
|
357
|
+
* (length = dimensions). For base64_binary: decode to packed bits (length =
|
|
358
|
+
* dimensions / 8 bytes).
|
|
359
|
+
*/
|
|
360
|
+
embedding?: string;
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* The index of the input text this embedding corresponds to
|
|
364
|
+
*/
|
|
365
|
+
index?: number;
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* The object type
|
|
369
|
+
*/
|
|
370
|
+
object?: string;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* Token usage for the embeddings request
|
|
375
|
+
*/
|
|
376
|
+
export interface EmbeddingsUsage {
|
|
377
|
+
/**
|
|
378
|
+
* Cost breakdown for the request
|
|
379
|
+
*/
|
|
380
|
+
cost?: EmbeddingsUsage.Cost;
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* Number of tokens in the input texts
|
|
384
|
+
*/
|
|
385
|
+
prompt_tokens?: number;
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* Total number of tokens processed
|
|
389
|
+
*/
|
|
390
|
+
total_tokens?: number;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
export namespace EmbeddingsUsage {
|
|
394
|
+
/**
|
|
395
|
+
* Cost breakdown for the request
|
|
396
|
+
*/
|
|
397
|
+
export interface Cost {
|
|
398
|
+
/**
|
|
399
|
+
* Currency of the cost values
|
|
400
|
+
*/
|
|
401
|
+
currency?: 'USD';
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* Cost for input tokens in USD
|
|
405
|
+
*/
|
|
406
|
+
input_cost?: number;
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* Total cost for the request in USD
|
|
410
|
+
*/
|
|
411
|
+
total_cost?: number;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
|
|
331
415
|
/**
|
|
332
416
|
* Defines a JSON schema for structured output validation
|
|
333
417
|
*/
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.25.0'; // x-release-please-version
|
package/version.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.25.0";
|
|
2
2
|
//# sourceMappingURL=version.d.mts.map
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.25.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/version.js
CHANGED
package/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.25.0'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|