langchain 0.0.190 → 0.0.191
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.
|
@@ -62,6 +62,10 @@ class HttpResponseOutputParser extends output_parser_js_1.BaseTransformOutputPar
|
|
|
62
62
|
*/
|
|
63
63
|
async parse(text) {
|
|
64
64
|
const chunk = await this.outputParser.parse(text);
|
|
65
|
+
const encoder = new TextEncoder();
|
|
66
|
+
if (this.contentType === "text/event-stream") {
|
|
67
|
+
return encoder.encode(`event: data\ndata: ${JSON.stringify(chunk)}\n\n`);
|
|
68
|
+
}
|
|
65
69
|
let parsedChunk;
|
|
66
70
|
if (typeof chunk === "string") {
|
|
67
71
|
parsedChunk = chunk;
|
|
@@ -69,10 +73,6 @@ class HttpResponseOutputParser extends output_parser_js_1.BaseTransformOutputPar
|
|
|
69
73
|
else {
|
|
70
74
|
parsedChunk = JSON.stringify(chunk);
|
|
71
75
|
}
|
|
72
|
-
const encoder = new TextEncoder();
|
|
73
|
-
if (this.contentType === "text/event-stream") {
|
|
74
|
-
return encoder.encode(`event: data\ndata: ${parsedChunk}\n\n`);
|
|
75
|
-
}
|
|
76
76
|
return encoder.encode(parsedChunk);
|
|
77
77
|
}
|
|
78
78
|
getFormatInstructions() {
|
|
@@ -59,6 +59,10 @@ export class HttpResponseOutputParser extends BaseTransformOutputParser {
|
|
|
59
59
|
*/
|
|
60
60
|
async parse(text) {
|
|
61
61
|
const chunk = await this.outputParser.parse(text);
|
|
62
|
+
const encoder = new TextEncoder();
|
|
63
|
+
if (this.contentType === "text/event-stream") {
|
|
64
|
+
return encoder.encode(`event: data\ndata: ${JSON.stringify(chunk)}\n\n`);
|
|
65
|
+
}
|
|
62
66
|
let parsedChunk;
|
|
63
67
|
if (typeof chunk === "string") {
|
|
64
68
|
parsedChunk = chunk;
|
|
@@ -66,10 +70,6 @@ export class HttpResponseOutputParser extends BaseTransformOutputParser {
|
|
|
66
70
|
else {
|
|
67
71
|
parsedChunk = JSON.stringify(chunk);
|
|
68
72
|
}
|
|
69
|
-
const encoder = new TextEncoder();
|
|
70
|
-
if (this.contentType === "text/event-stream") {
|
|
71
|
-
return encoder.encode(`event: data\ndata: ${parsedChunk}\n\n`);
|
|
72
|
-
}
|
|
73
73
|
return encoder.encode(parsedChunk);
|
|
74
74
|
}
|
|
75
75
|
getFormatInstructions() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "langchain",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.191",
|
|
4
4
|
"description": "Typescript bindings for langchain",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -809,7 +809,7 @@
|
|
|
809
809
|
"build:esm": "NODE_OPTIONS=--max-old-space-size=4096 tsc --outDir dist/ && rimraf dist/tests dist/**/tests",
|
|
810
810
|
"build:cjs": "NODE_OPTIONS=--max-old-space-size=4096 tsc --outDir dist-cjs/ -p tsconfig.cjs.json && node scripts/move-cjs-to-dist.js && rimraf dist-cjs",
|
|
811
811
|
"build:watch": "node scripts/create-entrypoints.js && tsc --outDir dist/ --watch",
|
|
812
|
-
"build:scripts": "node scripts/create-entrypoints.js && node scripts/check-tree-shaking.js
|
|
812
|
+
"build:scripts": "node scripts/create-entrypoints.js && node scripts/check-tree-shaking.js",
|
|
813
813
|
"conditional:api_refs": "bash scripts/build-api-refs.sh",
|
|
814
814
|
"lint": "NODE_OPTIONS=--max-old-space-size=4096 eslint src && dpdm --exit-code circular:1 --no-warning --no-tree src/*.ts src/**/*.ts",
|
|
815
815
|
"lint:fix": "yarn lint --fix",
|