@perplexity-ai/perplexity_ai 0.7.1 → 0.9.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 +22 -0
- package/README.md +28 -6
- package/client.d.mts +2 -2
- package/client.d.mts.map +1 -1
- package/client.d.ts +2 -2
- package/client.d.ts.map +1 -1
- package/client.js.map +1 -1
- package/client.mjs.map +1 -1
- package/core/streaming.d.mts +33 -0
- package/core/streaming.d.mts.map +1 -0
- package/core/streaming.d.ts +33 -0
- package/core/streaming.d.ts.map +1 -0
- package/core/streaming.js +276 -0
- package/core/streaming.js.map +1 -0
- package/core/streaming.mjs +271 -0
- package/core/streaming.mjs.map +1 -0
- package/internal/decoders/line.d.mts +17 -0
- package/internal/decoders/line.d.mts.map +1 -0
- package/internal/decoders/line.d.ts +17 -0
- package/internal/decoders/line.d.ts.map +1 -0
- package/internal/decoders/line.js +113 -0
- package/internal/decoders/line.js.map +1 -0
- package/internal/decoders/line.mjs +108 -0
- package/internal/decoders/line.mjs.map +1 -0
- package/internal/parse.d.mts.map +1 -1
- package/internal/parse.d.ts.map +1 -1
- package/internal/parse.js +10 -0
- package/internal/parse.js.map +1 -1
- package/internal/parse.mjs +10 -0
- package/internal/parse.mjs.map +1 -1
- package/internal/request-options.d.mts +2 -0
- package/internal/request-options.d.mts.map +1 -1
- package/internal/request-options.d.ts +2 -0
- package/internal/request-options.d.ts.map +1 -1
- package/internal/request-options.js.map +1 -1
- package/internal/request-options.mjs.map +1 -1
- package/internal/to-file.d.mts +1 -1
- package/internal/to-file.d.ts +1 -1
- package/internal/to-file.js +1 -1
- package/internal/to-file.mjs +1 -1
- package/internal/tslib.js +18 -18
- package/package.json +11 -1
- package/resources/async/chat/completions.d.mts +15 -37
- package/resources/async/chat/completions.d.mts.map +1 -1
- package/resources/async/chat/completions.d.ts +15 -37
- package/resources/async/chat/completions.d.ts.map +1 -1
- package/resources/async/chat/completions.js +7 -7
- package/resources/async/chat/completions.js.map +1 -1
- package/resources/async/chat/completions.mjs +7 -7
- package/resources/async/chat/completions.mjs.map +1 -1
- package/resources/chat/chat.d.mts +16 -2
- package/resources/chat/chat.d.mts.map +1 -1
- package/resources/chat/chat.d.ts +16 -2
- package/resources/chat/chat.d.ts.map +1 -1
- package/resources/chat/chat.js.map +1 -1
- package/resources/chat/chat.mjs +1 -1
- package/resources/chat/chat.mjs.map +1 -1
- package/resources/chat/completions.d.mts +23 -17
- package/resources/chat/completions.d.mts.map +1 -1
- package/resources/chat/completions.d.ts +23 -17
- package/resources/chat/completions.d.ts.map +1 -1
- package/resources/chat/completions.js +1 -4
- package/resources/chat/completions.js.map +1 -1
- package/resources/chat/completions.mjs +1 -4
- package/resources/chat/completions.mjs.map +1 -1
- package/resources/chat/index.d.mts +2 -2
- package/resources/chat/index.d.mts.map +1 -1
- package/resources/chat/index.d.ts +2 -2
- package/resources/chat/index.d.ts.map +1 -1
- package/resources/chat/index.js.map +1 -1
- package/resources/chat/index.mjs +1 -1
- package/resources/chat/index.mjs.map +1 -1
- package/resources/index.d.mts +1 -1
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +1 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs.map +1 -1
- package/resources/search.d.mts +3 -2
- package/resources/search.d.mts.map +1 -1
- package/resources/search.d.ts +3 -2
- package/resources/search.d.ts.map +1 -1
- package/resources/search.js +1 -1
- package/resources/search.mjs +1 -1
- package/resources/shared.d.mts +1 -0
- package/resources/shared.d.mts.map +1 -1
- package/resources/shared.d.ts +1 -0
- package/resources/shared.d.ts.map +1 -1
- package/src/client.ts +2 -2
- package/src/core/streaming.ts +331 -0
- package/src/internal/decoders/line.ts +135 -0
- package/src/internal/parse.ts +14 -0
- package/src/internal/request-options.ts +2 -0
- package/src/internal/to-file.ts +1 -1
- package/src/resources/async/chat/completions.ts +24 -57
- package/src/resources/chat/chat.ts +33 -2
- package/src/resources/chat/completions.ts +44 -27
- package/src/resources/chat/index.ts +7 -2
- package/src/resources/index.ts +1 -1
- package/src/resources/search.ts +4 -2
- package/src/resources/shared.ts +2 -0
- package/src/streaming.ts +2 -0
- package/src/version.ts +1 -1
- package/streaming.d.mts +2 -0
- package/streaming.d.mts.map +1 -0
- package/streaming.d.ts +2 -0
- package/streaming.d.ts.map +1 -0
- package/streaming.js +6 -0
- package/streaming.js.map +1 -0
- package/streaming.mjs +2 -0
- package/streaming.mjs.map +1 -0
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -1,19 +1,50 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
3
|
import { APIResource } from '../../core/resource';
|
|
4
|
+
import * as Shared from '../shared';
|
|
4
5
|
import * as CompletionsAPI from './completions';
|
|
5
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
CompletionCreateParams,
|
|
8
|
+
CompletionCreateParamsNonStreaming,
|
|
9
|
+
CompletionCreateParamsStreaming,
|
|
10
|
+
Completions,
|
|
11
|
+
} from './completions';
|
|
6
12
|
|
|
7
13
|
export class Chat extends APIResource {
|
|
8
14
|
completions: CompletionsAPI.Completions = new CompletionsAPI.Completions(this._client);
|
|
9
15
|
}
|
|
10
16
|
|
|
17
|
+
export interface StreamChunk {
|
|
18
|
+
id: string;
|
|
19
|
+
|
|
20
|
+
choices: Array<Shared.Choice>;
|
|
21
|
+
|
|
22
|
+
created: number;
|
|
23
|
+
|
|
24
|
+
model: string;
|
|
25
|
+
|
|
26
|
+
citations?: Array<string> | null;
|
|
27
|
+
|
|
28
|
+
object?: string;
|
|
29
|
+
|
|
30
|
+
search_results?: Array<Shared.APIPublicSearchResult> | null;
|
|
31
|
+
|
|
32
|
+
status?: 'PENDING' | 'COMPLETED' | null;
|
|
33
|
+
|
|
34
|
+
type?: 'message' | 'info' | 'end_of_stream' | null;
|
|
35
|
+
|
|
36
|
+
usage?: Shared.UsageInfo | null;
|
|
37
|
+
}
|
|
38
|
+
|
|
11
39
|
Chat.Completions = Completions;
|
|
12
40
|
|
|
13
41
|
export declare namespace Chat {
|
|
42
|
+
export { type StreamChunk as StreamChunk };
|
|
43
|
+
|
|
14
44
|
export {
|
|
15
45
|
Completions as Completions,
|
|
16
|
-
type CompletionCreateResponse as CompletionCreateResponse,
|
|
17
46
|
type CompletionCreateParams as CompletionCreateParams,
|
|
47
|
+
type CompletionCreateParamsNonStreaming as CompletionCreateParamsNonStreaming,
|
|
48
|
+
type CompletionCreateParamsStreaming as CompletionCreateParamsStreaming,
|
|
18
49
|
};
|
|
19
50
|
}
|
|
@@ -1,42 +1,39 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
3
|
import { APIResource } from '../../core/resource';
|
|
4
|
+
import * as CompletionsAPI from './completions';
|
|
4
5
|
import * as Shared from '../shared';
|
|
6
|
+
import * as ChatAPI from './chat';
|
|
5
7
|
import { APIPromise } from '../../core/api-promise';
|
|
8
|
+
import { Stream } from '../../core/streaming';
|
|
6
9
|
import { RequestOptions } from '../../internal/request-options';
|
|
7
10
|
|
|
8
11
|
export class Completions extends APIResource {
|
|
9
12
|
/**
|
|
10
|
-
*
|
|
13
|
+
* Generate a chat completion response for the given conversation.
|
|
11
14
|
*/
|
|
12
|
-
create(body:
|
|
13
|
-
|
|
15
|
+
create(body: CompletionCreateParamsNonStreaming, options?: RequestOptions): APIPromise<ChatAPI.StreamChunk>;
|
|
16
|
+
create(
|
|
17
|
+
body: CompletionCreateParamsStreaming,
|
|
18
|
+
options?: RequestOptions,
|
|
19
|
+
): APIPromise<Stream<ChatAPI.StreamChunk>>;
|
|
20
|
+
create(
|
|
21
|
+
body: CompletionCreateParamsBase,
|
|
22
|
+
options?: RequestOptions,
|
|
23
|
+
): APIPromise<Stream<ChatAPI.StreamChunk> | ChatAPI.StreamChunk>;
|
|
24
|
+
create(
|
|
25
|
+
body: CompletionCreateParams,
|
|
26
|
+
options?: RequestOptions,
|
|
27
|
+
): APIPromise<ChatAPI.StreamChunk> | APIPromise<Stream<ChatAPI.StreamChunk>> {
|
|
28
|
+
return this._client.post('/chat/completions', { body, ...options, stream: body.stream ?? false }) as
|
|
29
|
+
| APIPromise<ChatAPI.StreamChunk>
|
|
30
|
+
| APIPromise<Stream<ChatAPI.StreamChunk>>;
|
|
14
31
|
}
|
|
15
32
|
}
|
|
16
33
|
|
|
17
|
-
export
|
|
18
|
-
id: string;
|
|
34
|
+
export type CompletionCreateParams = CompletionCreateParamsNonStreaming | CompletionCreateParamsStreaming;
|
|
19
35
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
created: number;
|
|
23
|
-
|
|
24
|
-
model: string;
|
|
25
|
-
|
|
26
|
-
usage: Shared.UsageInfo;
|
|
27
|
-
|
|
28
|
-
citations?: Array<string> | null;
|
|
29
|
-
|
|
30
|
-
object?: string;
|
|
31
|
-
|
|
32
|
-
search_results?: Array<Shared.APIPublicSearchResult> | null;
|
|
33
|
-
|
|
34
|
-
status?: 'PENDING' | 'COMPLETED' | null;
|
|
35
|
-
|
|
36
|
-
type?: 'message' | 'info' | 'end_of_stream' | null;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export interface CompletionCreateParams {
|
|
36
|
+
export interface CompletionCreateParamsBase {
|
|
40
37
|
messages: Array<Shared.ChatMessageInput>;
|
|
41
38
|
|
|
42
39
|
model: string;
|
|
@@ -73,6 +70,8 @@ export interface CompletionCreateParams {
|
|
|
73
70
|
|
|
74
71
|
image_format_filter?: Array<string> | null;
|
|
75
72
|
|
|
73
|
+
language_preference?: string | null;
|
|
74
|
+
|
|
76
75
|
last_updated_after_filter?: string | null;
|
|
77
76
|
|
|
78
77
|
last_updated_before_filter?: string | null;
|
|
@@ -131,8 +130,12 @@ export interface CompletionCreateParams {
|
|
|
131
130
|
|
|
132
131
|
stream?: boolean | null;
|
|
133
132
|
|
|
133
|
+
stream_mode?: 'full' | 'concise';
|
|
134
|
+
|
|
134
135
|
temperature?: number | null;
|
|
135
136
|
|
|
137
|
+
thread_id?: string | null;
|
|
138
|
+
|
|
136
139
|
tool_choice?: 'none' | 'auto' | 'required' | null;
|
|
137
140
|
|
|
138
141
|
tools?: Array<CompletionCreateParams.Tool> | null;
|
|
@@ -147,6 +150,8 @@ export interface CompletionCreateParams {
|
|
|
147
150
|
|
|
148
151
|
updated_before_timestamp?: number | null;
|
|
149
152
|
|
|
153
|
+
use_threads?: boolean | null;
|
|
154
|
+
|
|
150
155
|
web_search_options?: CompletionCreateParams.WebSearchOptions;
|
|
151
156
|
}
|
|
152
157
|
|
|
@@ -232,7 +237,7 @@ export namespace CompletionCreateParams {
|
|
|
232
237
|
|
|
233
238
|
search_context_size?: 'low' | 'medium' | 'high';
|
|
234
239
|
|
|
235
|
-
search_type?: 'fast' | 'pro' | 'auto';
|
|
240
|
+
search_type?: 'fast' | 'pro' | 'auto' | null;
|
|
236
241
|
|
|
237
242
|
user_location?: WebSearchOptions.UserLocation | null;
|
|
238
243
|
}
|
|
@@ -250,11 +255,23 @@ export namespace CompletionCreateParams {
|
|
|
250
255
|
region?: string | null;
|
|
251
256
|
}
|
|
252
257
|
}
|
|
258
|
+
|
|
259
|
+
export type CompletionCreateParamsNonStreaming = CompletionsAPI.CompletionCreateParamsNonStreaming;
|
|
260
|
+
export type CompletionCreateParamsStreaming = CompletionsAPI.CompletionCreateParamsStreaming;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
export interface CompletionCreateParamsNonStreaming extends CompletionCreateParamsBase {
|
|
264
|
+
stream?: false | null;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
export interface CompletionCreateParamsStreaming extends CompletionCreateParamsBase {
|
|
268
|
+
stream: true;
|
|
253
269
|
}
|
|
254
270
|
|
|
255
271
|
export declare namespace Completions {
|
|
256
272
|
export {
|
|
257
|
-
type CompletionCreateResponse as CompletionCreateResponse,
|
|
258
273
|
type CompletionCreateParams as CompletionCreateParams,
|
|
274
|
+
type CompletionCreateParamsNonStreaming as CompletionCreateParamsNonStreaming,
|
|
275
|
+
type CompletionCreateParamsStreaming as CompletionCreateParamsStreaming,
|
|
259
276
|
};
|
|
260
277
|
}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
export { Chat } from './chat';
|
|
4
|
-
export {
|
|
3
|
+
export { Chat, type StreamChunk } from './chat';
|
|
4
|
+
export {
|
|
5
|
+
Completions,
|
|
6
|
+
type CompletionCreateParams,
|
|
7
|
+
type CompletionCreateParamsNonStreaming,
|
|
8
|
+
type CompletionCreateParamsStreaming,
|
|
9
|
+
} from './completions';
|
package/src/resources/index.ts
CHANGED
package/src/resources/search.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { RequestOptions } from '../internal/request-options';
|
|
|
6
6
|
|
|
7
7
|
export class Search extends APIResource {
|
|
8
8
|
/**
|
|
9
|
-
* Search
|
|
9
|
+
* Search the web and retrieve relevant web page contents.
|
|
10
10
|
*/
|
|
11
11
|
create(body: SearchCreateParams, options?: RequestOptions): APIPromise<SearchCreateResponse> {
|
|
12
12
|
return this._client.post('/search', { body, ...options });
|
|
@@ -17,6 +17,8 @@ export interface SearchCreateResponse {
|
|
|
17
17
|
id: string;
|
|
18
18
|
|
|
19
19
|
results: Array<SearchCreateResponse.Result>;
|
|
20
|
+
|
|
21
|
+
server_time?: string | null;
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
export namespace SearchCreateResponse {
|
|
@@ -36,7 +38,7 @@ export namespace SearchCreateResponse {
|
|
|
36
38
|
export interface SearchCreateParams {
|
|
37
39
|
query: string | Array<string>;
|
|
38
40
|
|
|
39
|
-
|
|
41
|
+
display_server_time?: boolean;
|
|
40
42
|
|
|
41
43
|
max_results?: number;
|
|
42
44
|
|
package/src/resources/shared.ts
CHANGED
package/src/streaming.ts
ADDED
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.9.0'; // x-release-please-version
|
package/streaming.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"streaming.d.mts","sourceRoot":"","sources":["src/streaming.ts"],"names":[],"mappings":""}
|
package/streaming.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"streaming.d.ts","sourceRoot":"","sources":["src/streaming.ts"],"names":[],"mappings":""}
|
package/streaming.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("./internal/tslib.js");
|
|
4
|
+
/** @deprecated Import from ./core/streaming instead */
|
|
5
|
+
tslib_1.__exportStar(require("./core/streaming.js"), exports);
|
|
6
|
+
//# sourceMappingURL=streaming.js.map
|
package/streaming.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"streaming.js","sourceRoot":"","sources":["src/streaming.ts"],"names":[],"mappings":";;;AAAA,uDAAuD;AACvD,8DAAiC"}
|
package/streaming.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"streaming.mjs","sourceRoot":"","sources":["src/streaming.ts"],"names":[],"mappings":""}
|
package/version.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.9.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.9.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.9.0'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|