@xsai/stream-object 0.4.0-beta.1 → 0.4.0-beta.3
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.js +18 -19
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -287,7 +287,7 @@ async function streamObject(options) {
|
|
|
287
287
|
schema = strictJsonSchema(schema);
|
|
288
288
|
if (options.output === "array")
|
|
289
289
|
schema = wrap(schema);
|
|
290
|
-
|
|
290
|
+
let { textStream, ...rest } = streamText({
|
|
291
291
|
...options,
|
|
292
292
|
response_format: {
|
|
293
293
|
json_schema: {
|
|
@@ -302,25 +302,24 @@ async function streamObject(options) {
|
|
|
302
302
|
schemaDescription: void 0,
|
|
303
303
|
schemaName: void 0,
|
|
304
304
|
strict: void 0
|
|
305
|
-
}).then(({ textStream, ...rest }) => {
|
|
306
|
-
let elementStream;
|
|
307
|
-
let partialObjectStream;
|
|
308
|
-
if (options.output === "array") {
|
|
309
|
-
let rawElementStream;
|
|
310
|
-
[rawElementStream, textStream] = textStream.tee();
|
|
311
|
-
elementStream = toElementStream(rawElementStream);
|
|
312
|
-
} else {
|
|
313
|
-
let rawPartialObjectStream;
|
|
314
|
-
[textStream, rawPartialObjectStream] = textStream.tee();
|
|
315
|
-
partialObjectStream = toPartialObjectStream(rawPartialObjectStream);
|
|
316
|
-
}
|
|
317
|
-
return {
|
|
318
|
-
elementStream,
|
|
319
|
-
partialObjectStream,
|
|
320
|
-
textStream,
|
|
321
|
-
...rest
|
|
322
|
-
};
|
|
323
305
|
});
|
|
306
|
+
let elementStream;
|
|
307
|
+
let partialObjectStream;
|
|
308
|
+
if (options.output === "array") {
|
|
309
|
+
let rawElementStream;
|
|
310
|
+
[rawElementStream, textStream] = textStream.tee();
|
|
311
|
+
elementStream = toElementStream(rawElementStream);
|
|
312
|
+
} else {
|
|
313
|
+
let rawPartialObjectStream;
|
|
314
|
+
[textStream, rawPartialObjectStream] = textStream.tee();
|
|
315
|
+
partialObjectStream = toPartialObjectStream(rawPartialObjectStream);
|
|
316
|
+
}
|
|
317
|
+
return {
|
|
318
|
+
elementStream,
|
|
319
|
+
partialObjectStream,
|
|
320
|
+
textStream,
|
|
321
|
+
...rest
|
|
322
|
+
};
|
|
324
323
|
}
|
|
325
324
|
|
|
326
325
|
export { streamObject, toElementStream, toPartialObjectStream };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xsai/stream-object",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.4.0-beta.
|
|
4
|
+
"version": "0.4.0-beta.3",
|
|
5
5
|
"description": "extra-small AI SDK.",
|
|
6
6
|
"author": "Moeru AI",
|
|
7
7
|
"license": "MIT",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"dist"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@xsai/stream-text": "~0.4.0-beta.
|
|
33
|
-
"xsschema": "~0.4.0-beta.
|
|
32
|
+
"@xsai/stream-text": "~0.4.0-beta.3",
|
|
33
|
+
"xsschema": "~0.4.0-beta.3"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@valibot/to-json-schema": "^1.0.0",
|