@perplexity-ai/perplexity_ai 0.7.1 → 0.8.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 +8 -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/tslib.js +18 -18
- package/package.json +11 -1
- package/resources/async/chat/completions.d.mts +3 -30
- package/resources/async/chat/completions.d.mts.map +1 -1
- package/resources/async/chat/completions.d.ts +3 -30
- package/resources/async/chat/completions.d.ts.map +1 -1
- package/resources/async/chat/completions.js.map +1 -1
- 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 +17 -15
- package/resources/chat/completions.d.mts.map +1 -1
- package/resources/chat/completions.d.ts +17 -15
- 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/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/resources/async/chat/completions.ts +3 -50
- package/src/resources/chat/chat.ts +33 -2
- package/src/resources/chat/completions.ts +34 -25
- package/src/resources/chat/index.ts +7 -2
- package/src/resources/index.ts +1 -1
- 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,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
|
* FastAPI wrapper around chat completions
|
|
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;
|
|
@@ -250,11 +247,23 @@ export namespace CompletionCreateParams {
|
|
|
250
247
|
region?: string | null;
|
|
251
248
|
}
|
|
252
249
|
}
|
|
250
|
+
|
|
251
|
+
export type CompletionCreateParamsNonStreaming = CompletionsAPI.CompletionCreateParamsNonStreaming;
|
|
252
|
+
export type CompletionCreateParamsStreaming = CompletionsAPI.CompletionCreateParamsStreaming;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
export interface CompletionCreateParamsNonStreaming extends CompletionCreateParamsBase {
|
|
256
|
+
stream?: false | null;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
export interface CompletionCreateParamsStreaming extends CompletionCreateParamsBase {
|
|
260
|
+
stream: true;
|
|
253
261
|
}
|
|
254
262
|
|
|
255
263
|
export declare namespace Completions {
|
|
256
264
|
export {
|
|
257
|
-
type CompletionCreateResponse as CompletionCreateResponse,
|
|
258
265
|
type CompletionCreateParams as CompletionCreateParams,
|
|
266
|
+
type CompletionCreateParamsNonStreaming as CompletionCreateParamsNonStreaming,
|
|
267
|
+
type CompletionCreateParamsStreaming as CompletionCreateParamsStreaming,
|
|
259
268
|
};
|
|
260
269
|
}
|
|
@@ -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/streaming.ts
ADDED
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.8.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.8.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.8.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.8.0'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|