@xsai/stream-text 0.0.31 → 0.1.0-beta.2
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/dist/index.d.ts +4 -4
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FinishReason, Usage, ChatOptions } from '@xsai/shared-chat';
|
|
2
2
|
|
|
3
|
-
interface
|
|
3
|
+
interface StreamTextChunkResult {
|
|
4
4
|
choices: {
|
|
5
5
|
delta: {
|
|
6
6
|
content: string;
|
|
@@ -17,7 +17,7 @@ interface ChunkResult {
|
|
|
17
17
|
usage?: Usage;
|
|
18
18
|
}
|
|
19
19
|
interface StreamTextOptions extends ChatOptions {
|
|
20
|
-
onChunk?: (chunk:
|
|
20
|
+
onChunk?: (chunk: StreamTextChunkResult) => Promise<void> | void;
|
|
21
21
|
/** if you want to disable stream, use `@xsai/generate-{text,object}` */
|
|
22
22
|
stream?: never;
|
|
23
23
|
streamOptions?: {
|
|
@@ -30,7 +30,7 @@ interface StreamTextOptions extends ChatOptions {
|
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
32
|
interface StreamTextResult {
|
|
33
|
-
chunkStream: ReadableStream<
|
|
33
|
+
chunkStream: ReadableStream<StreamTextChunkResult>;
|
|
34
34
|
finishReason?: FinishReason;
|
|
35
35
|
textStream: ReadableStream<string>;
|
|
36
36
|
usage?: Usage;
|
|
@@ -40,4 +40,4 @@ interface StreamTextResult {
|
|
|
40
40
|
*/
|
|
41
41
|
declare const streamText: (options: StreamTextOptions) => Promise<StreamTextResult>;
|
|
42
42
|
|
|
43
|
-
export { type
|
|
43
|
+
export { type StreamTextChunkResult, type StreamTextOptions, type StreamTextResult, streamText };
|
package/dist/index.js
CHANGED