langchain 0.0.174 → 0.0.176

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.
Files changed (69) hide show
  1. package/dist/chat_models/googlevertexai/common.cjs +46 -7
  2. package/dist/chat_models/googlevertexai/common.d.ts +7 -2
  3. package/dist/chat_models/googlevertexai/common.js +47 -8
  4. package/dist/chat_models/googlevertexai/index.cjs +4 -3
  5. package/dist/chat_models/googlevertexai/index.js +4 -3
  6. package/dist/chat_models/googlevertexai/web.cjs +2 -1
  7. package/dist/chat_models/googlevertexai/web.js +2 -1
  8. package/dist/embeddings/googlevertexai.cjs +1 -1
  9. package/dist/embeddings/googlevertexai.js +1 -1
  10. package/dist/experimental/hubs/makersuite/googlemakersuitehub.d.ts +2 -2
  11. package/dist/experimental/multimodal_embeddings/googlevertexai.cjs +1 -1
  12. package/dist/experimental/multimodal_embeddings/googlevertexai.d.ts +2 -1
  13. package/dist/experimental/multimodal_embeddings/googlevertexai.js +2 -2
  14. package/dist/experimental/plan_and_execute/agent_executor.cjs +7 -4
  15. package/dist/experimental/plan_and_execute/agent_executor.d.ts +4 -3
  16. package/dist/experimental/plan_and_execute/agent_executor.js +8 -5
  17. package/dist/experimental/plan_and_execute/prompt.cjs +25 -9
  18. package/dist/experimental/plan_and_execute/prompt.d.ts +9 -1
  19. package/dist/experimental/plan_and_execute/prompt.js +23 -8
  20. package/dist/llms/googlevertexai/common.cjs +46 -13
  21. package/dist/llms/googlevertexai/common.d.ts +8 -3
  22. package/dist/llms/googlevertexai/common.js +46 -13
  23. package/dist/llms/googlevertexai/index.cjs +4 -3
  24. package/dist/llms/googlevertexai/index.js +4 -3
  25. package/dist/llms/googlevertexai/web.cjs +2 -1
  26. package/dist/llms/googlevertexai/web.js +2 -1
  27. package/dist/load/import_constants.cjs +4 -0
  28. package/dist/load/import_constants.js +4 -0
  29. package/dist/storage/convex.cjs +145 -0
  30. package/dist/storage/convex.d.ts +85 -0
  31. package/dist/storage/convex.js +141 -0
  32. package/dist/stores/message/convex.cjs +120 -0
  33. package/dist/stores/message/convex.d.ts +60 -0
  34. package/dist/stores/message/convex.js +116 -0
  35. package/dist/types/googlevertexai-types.d.ts +12 -10
  36. package/dist/util/convex.cjs +77 -0
  37. package/dist/util/convex.d.ts +26 -0
  38. package/dist/util/convex.js +74 -0
  39. package/dist/util/googlevertexai-connection.cjs +298 -10
  40. package/dist/util/googlevertexai-connection.d.ts +76 -7
  41. package/dist/util/googlevertexai-connection.js +294 -9
  42. package/dist/util/googlevertexai-gauth.cjs +36 -0
  43. package/dist/util/googlevertexai-gauth.d.ts +8 -0
  44. package/dist/util/googlevertexai-gauth.js +32 -0
  45. package/dist/util/googlevertexai-webauth.cjs +38 -2
  46. package/dist/util/googlevertexai-webauth.d.ts +2 -6
  47. package/dist/util/googlevertexai-webauth.js +38 -2
  48. package/dist/vectorstores/convex.cjs +177 -0
  49. package/dist/vectorstores/convex.d.ts +113 -0
  50. package/dist/vectorstores/convex.js +173 -0
  51. package/dist/vectorstores/googlevertexai.d.ts +4 -4
  52. package/dist/vectorstores/milvus.cjs +4 -2
  53. package/dist/vectorstores/milvus.js +4 -2
  54. package/dist/vectorstores/vercel_postgres.cjs +29 -7
  55. package/dist/vectorstores/vercel_postgres.d.ts +1 -1
  56. package/dist/vectorstores/vercel_postgres.js +29 -7
  57. package/package.json +38 -1
  58. package/storage/convex.cjs +1 -0
  59. package/storage/convex.d.ts +1 -0
  60. package/storage/convex.js +1 -0
  61. package/stores/message/convex.cjs +1 -0
  62. package/stores/message/convex.d.ts +1 -0
  63. package/stores/message/convex.js +1 -0
  64. package/util/convex.cjs +1 -0
  65. package/util/convex.d.ts +1 -0
  66. package/util/convex.js +1 -0
  67. package/vectorstores/convex.cjs +1 -0
  68. package/vectorstores/convex.d.ts +1 -0
  69. package/vectorstores/convex.js +1 -0
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GoogleVertexAILLMConnection = exports.GoogleVertexAIConnection = exports.GoogleConnection = void 0;
3
+ exports.GoogleVertexAIStream = exports.GoogleVertexAILLMConnection = exports.simpleValue = exports.complexValue = exports.GoogleVertexAIConnection = exports.GoogleConnection = void 0;
4
4
  class GoogleConnection {
5
- constructor(caller, client) {
5
+ constructor(caller, client, streaming) {
6
6
  Object.defineProperty(this, "caller", {
7
7
  enumerable: true,
8
8
  configurable: true,
@@ -15,13 +15,19 @@ class GoogleConnection {
15
15
  writable: true,
16
16
  value: void 0
17
17
  });
18
+ Object.defineProperty(this, "streaming", {
19
+ enumerable: true,
20
+ configurable: true,
21
+ writable: true,
22
+ value: void 0
23
+ });
18
24
  this.caller = caller;
19
25
  this.client = client;
26
+ this.streaming = streaming ?? false;
20
27
  }
21
28
  async _request(data, options) {
22
29
  const url = await this.buildUrl();
23
30
  const method = this.buildMethod();
24
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
25
31
  const opts = {
26
32
  url,
27
33
  method,
@@ -29,6 +35,12 @@ class GoogleConnection {
29
35
  if (data && method === "POST") {
30
36
  opts.data = data;
31
37
  }
38
+ if (this.streaming) {
39
+ opts.responseType = "stream";
40
+ }
41
+ else {
42
+ opts.responseType = "json";
43
+ }
32
44
  try {
33
45
  const callResponse = await this.caller.callWithOptions({ signal: options?.signal }, async () => this.client.request(opts));
34
46
  const response = callResponse; // Done for typecast safety, I guess
@@ -42,8 +54,8 @@ class GoogleConnection {
42
54
  }
43
55
  exports.GoogleConnection = GoogleConnection;
44
56
  class GoogleVertexAIConnection extends GoogleConnection {
45
- constructor(fields, caller, client) {
46
- super(caller, client);
57
+ constructor(fields, caller, client, streaming) {
58
+ super(caller, client, streaming);
47
59
  Object.defineProperty(this, "endpoint", {
48
60
  enumerable: true,
49
61
  configurable: true,
@@ -73,9 +85,86 @@ class GoogleVertexAIConnection extends GoogleConnection {
73
85
  }
74
86
  }
75
87
  exports.GoogleVertexAIConnection = GoogleVertexAIConnection;
88
+ function complexValue(value) {
89
+ if (value === null || typeof value === "undefined") {
90
+ // I dunno what to put here. An error, probably
91
+ return undefined;
92
+ }
93
+ else if (typeof value === "object") {
94
+ if (Array.isArray(value)) {
95
+ return {
96
+ list_val: value.map((avalue) => complexValue(avalue)),
97
+ };
98
+ }
99
+ else {
100
+ const ret = {};
101
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
102
+ const v = value;
103
+ Object.keys(v).forEach((key) => {
104
+ ret[key] = complexValue(v[key]);
105
+ });
106
+ return { struct_val: ret };
107
+ }
108
+ }
109
+ else if (typeof value === "number") {
110
+ if (Number.isInteger(value)) {
111
+ return { int_val: value };
112
+ }
113
+ else {
114
+ return { float_val: value };
115
+ }
116
+ }
117
+ else {
118
+ return {
119
+ string_val: [value],
120
+ };
121
+ }
122
+ }
123
+ exports.complexValue = complexValue;
124
+ function simpleValue(val) {
125
+ if (val && typeof val === "object" && !Array.isArray(val)) {
126
+ // eslint-disable-next-line no-prototype-builtins
127
+ if (val.hasOwnProperty("stringVal")) {
128
+ return val.stringVal[0];
129
+ // eslint-disable-next-line no-prototype-builtins
130
+ }
131
+ else if (val.hasOwnProperty("boolVal")) {
132
+ return val.boolVal[0];
133
+ // eslint-disable-next-line no-prototype-builtins
134
+ }
135
+ else if (val.hasOwnProperty("listVal")) {
136
+ const { listVal } = val;
137
+ return listVal.map((aval) => simpleValue(aval));
138
+ // eslint-disable-next-line no-prototype-builtins
139
+ }
140
+ else if (val.hasOwnProperty("structVal")) {
141
+ const ret = {};
142
+ const struct = val.structVal;
143
+ Object.keys(struct).forEach((key) => {
144
+ ret[key] = simpleValue(struct[key]);
145
+ });
146
+ return ret;
147
+ }
148
+ else {
149
+ const ret = {};
150
+ const struct = val;
151
+ Object.keys(struct).forEach((key) => {
152
+ ret[key] = simpleValue(struct[key]);
153
+ });
154
+ return ret;
155
+ }
156
+ }
157
+ else if (Array.isArray(val)) {
158
+ return val.map((aval) => simpleValue(aval));
159
+ }
160
+ else {
161
+ return val;
162
+ }
163
+ }
164
+ exports.simpleValue = simpleValue;
76
165
  class GoogleVertexAILLMConnection extends GoogleVertexAIConnection {
77
- constructor(fields, caller, client) {
78
- super(fields, caller, client);
166
+ constructor(fields, caller, client, streaming) {
167
+ super(fields, caller, client, streaming);
79
168
  Object.defineProperty(this, "model", {
80
169
  enumerable: true,
81
170
  configurable: true,
@@ -93,16 +182,215 @@ class GoogleVertexAILLMConnection extends GoogleVertexAIConnection {
93
182
  }
94
183
  async buildUrl() {
95
184
  const projectId = await this.client.getProjectId();
96
- const url = `https://${this.endpoint}/v1/projects/${projectId}/locations/${this.location}/publishers/google/models/${this.model}:predict`;
185
+ const method = this.streaming ? "serverStreamingPredict" : "predict";
186
+ const url = `https://${this.endpoint}/v1/projects/${projectId}/locations/${this.location}/publishers/google/models/${this.model}:${method}`;
97
187
  return url;
98
188
  }
99
- async request(instances, parameters, options) {
100
- const data = {
189
+ formatStreamingData(inputs, parameters) {
190
+ return {
191
+ inputs: [inputs.map((i) => complexValue(i))],
192
+ parameters: complexValue(parameters),
193
+ };
194
+ }
195
+ formatStandardData(instances, parameters) {
196
+ return {
101
197
  instances,
102
198
  parameters,
103
199
  };
200
+ }
201
+ formatData(instances, parameters) {
202
+ return this.streaming
203
+ ? this.formatStreamingData(instances, parameters)
204
+ : this.formatStandardData(instances, parameters);
205
+ }
206
+ async request(instances, parameters, options) {
207
+ const data = this.formatData(instances, parameters);
104
208
  const response = await this._request(data, options);
105
209
  return response;
106
210
  }
107
211
  }
108
212
  exports.GoogleVertexAILLMConnection = GoogleVertexAILLMConnection;
213
+ class GoogleVertexAIStream {
214
+ constructor() {
215
+ Object.defineProperty(this, "_buffer", {
216
+ enumerable: true,
217
+ configurable: true,
218
+ writable: true,
219
+ value: ""
220
+ });
221
+ Object.defineProperty(this, "_bufferOpen", {
222
+ enumerable: true,
223
+ configurable: true,
224
+ writable: true,
225
+ value: true
226
+ });
227
+ Object.defineProperty(this, "_firstRun", {
228
+ enumerable: true,
229
+ configurable: true,
230
+ writable: true,
231
+ value: true
232
+ });
233
+ // Set up a potential Promise that the handler can resolve.
234
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
235
+ Object.defineProperty(this, "_chunkResolution", {
236
+ enumerable: true,
237
+ configurable: true,
238
+ writable: true,
239
+ value: void 0
240
+ });
241
+ // If there is no Promise (it is null), the handler must add it to the queue
242
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
243
+ Object.defineProperty(this, "_chunkPending", {
244
+ enumerable: true,
245
+ configurable: true,
246
+ writable: true,
247
+ value: null
248
+ });
249
+ // A queue that will collect chunks while there is no Promise
250
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
251
+ Object.defineProperty(this, "_chunkQueue", {
252
+ enumerable: true,
253
+ configurable: true,
254
+ writable: true,
255
+ value: []
256
+ });
257
+ }
258
+ /**
259
+ * Add data to the buffer. This may cause chunks to be generated, if available.
260
+ * @param data
261
+ */
262
+ appendBuffer(data) {
263
+ this._buffer += data;
264
+ // Our first time, skip to the opening of the array
265
+ if (this._firstRun) {
266
+ this._skipTo("[");
267
+ this._firstRun = false;
268
+ }
269
+ this._parseBuffer();
270
+ }
271
+ /**
272
+ * Indicate there is no more data that will be added to the text buffer.
273
+ * This should be called when all the data has been read and added to indicate
274
+ * that we should process everything remaining in the buffer.
275
+ */
276
+ closeBuffer() {
277
+ this._bufferOpen = false;
278
+ this._parseBuffer();
279
+ }
280
+ /**
281
+ * Skip characters in the buffer till we get to the start of an object.
282
+ * Then attempt to read a full object.
283
+ * If we do read a full object, turn it into a chunk and send it to the chunk handler.
284
+ * Repeat this for as much as we can.
285
+ */
286
+ _parseBuffer() {
287
+ let obj = null;
288
+ do {
289
+ this._skipTo("{");
290
+ obj = this._getFullObject();
291
+ if (obj !== null) {
292
+ const chunk = this._simplifyObject(obj);
293
+ this._handleChunk(chunk);
294
+ }
295
+ } while (obj !== null);
296
+ if (!this._bufferOpen) {
297
+ // No more data will be added, and we have parsed everything we could,
298
+ // so everything else is garbage.
299
+ this._handleChunk(null);
300
+ this._buffer = "";
301
+ }
302
+ }
303
+ /**
304
+ * If the string is present, move the start of the buffer to the first occurrence
305
+ * of that string. This is useful for skipping over elements or parts that we're not
306
+ * really interested in parsing. (ie - the opening characters, comma separators, etc.)
307
+ * @param start The string to start the buffer with
308
+ */
309
+ _skipTo(start) {
310
+ const index = this._buffer.indexOf(start);
311
+ if (index > 0) {
312
+ this._buffer = this._buffer.slice(index);
313
+ }
314
+ }
315
+ /**
316
+ * Given what is in the buffer, parse a single object out of it.
317
+ * If a complete object isn't available, return null.
318
+ * Assumes that we are at the start of an object to parse.
319
+ */
320
+ _getFullObject() {
321
+ let ret = null;
322
+ // Loop while we don't have something to return AND we have something in the buffer
323
+ let index = 0;
324
+ while (ret === null && this._buffer.length > index) {
325
+ // Advance to the next close bracket after our current index
326
+ index = this._buffer.indexOf("}", index + 1);
327
+ // If we don't find one, exit with null
328
+ if (index === -1) {
329
+ return null;
330
+ }
331
+ // If we have one, try to turn it into an object to return
332
+ try {
333
+ const objStr = this._buffer.substring(0, index + 1);
334
+ ret = JSON.parse(objStr);
335
+ // We only get here if it parsed it ok
336
+ // If we did turn it into an object, remove it from the buffer
337
+ this._buffer = this._buffer.slice(index + 1);
338
+ }
339
+ catch (xx) {
340
+ // It didn't parse it correctly, so we swallow the exception and continue
341
+ }
342
+ }
343
+ return ret;
344
+ }
345
+ _simplifyObject(obj) {
346
+ return simpleValue(obj);
347
+ }
348
+ /**
349
+ * Register that we have another chunk available for consumption.
350
+ * If we are waiting for a chunk, resolve the promise waiting for it immediately.
351
+ * If not, then add it to the queue.
352
+ * @param chunk
353
+ */
354
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
355
+ _handleChunk(chunk) {
356
+ if (this._chunkPending) {
357
+ this._chunkResolution(chunk);
358
+ this._chunkPending = null;
359
+ }
360
+ else {
361
+ this._chunkQueue.push(chunk);
362
+ }
363
+ }
364
+ /**
365
+ * Get the next chunk that is coming from the stream.
366
+ * This chunk may be null, usually indicating the last chunk in the stream.
367
+ */
368
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
369
+ async nextChunk() {
370
+ if (this._chunkQueue.length > 0) {
371
+ // If there is data in the queue, return the next queue chunk
372
+ return this._chunkQueue.shift();
373
+ }
374
+ else {
375
+ // Otherwise, set up a promise that handleChunk will cause to be resolved
376
+ this._chunkPending = new Promise((resolve) => {
377
+ this._chunkResolution = resolve;
378
+ });
379
+ return this._chunkPending;
380
+ }
381
+ }
382
+ /**
383
+ * Is the stream done?
384
+ * A stream is only done if all of the following are true:
385
+ * - There is no more data to be added to the text buffer
386
+ * - There is no more data in the text buffer
387
+ * - There are no chunks that are waiting to be consumed
388
+ */
389
+ get streamDone() {
390
+ return (!this._bufferOpen &&
391
+ this._buffer.length === 0 &&
392
+ this._chunkQueue.length === 0 &&
393
+ this._chunkPending === null);
394
+ }
395
+ }
396
+ exports.GoogleVertexAIStream = GoogleVertexAIStream;
@@ -1,25 +1,94 @@
1
1
  import { BaseLanguageModelCallOptions } from "../base_language/index.js";
2
2
  import { AsyncCaller, AsyncCallerCallOptions } from "./async_caller.js";
3
- import type { GoogleVertexAIBaseLLMInput, GoogleVertexAIBasePrediction, GoogleVertexAIConnectionParams, GoogleVertexAILLMResponse, GoogleVertexAIModelParams, GoogleResponse, GoogleAbstractedClient } from "../types/googlevertexai-types.js";
3
+ import type { GoogleVertexAIBaseLLMInput, GoogleVertexAIBasePrediction, GoogleVertexAIConnectionParams, GoogleVertexAILLMPredictions, GoogleVertexAIModelParams, GoogleResponse, GoogleAbstractedClient, GoogleAbstractedClientOpsMethod } from "../types/googlevertexai-types.js";
4
4
  export declare abstract class GoogleConnection<CallOptions extends AsyncCallerCallOptions, ResponseType extends GoogleResponse> {
5
5
  caller: AsyncCaller;
6
6
  client: GoogleAbstractedClient;
7
- constructor(caller: AsyncCaller, client: GoogleAbstractedClient);
7
+ streaming: boolean;
8
+ constructor(caller: AsyncCaller, client: GoogleAbstractedClient, streaming?: boolean);
8
9
  abstract buildUrl(): Promise<string>;
9
- abstract buildMethod(): string;
10
+ abstract buildMethod(): GoogleAbstractedClientOpsMethod;
10
11
  _request(data: unknown | undefined, options: CallOptions): Promise<ResponseType>;
11
12
  }
12
13
  export declare abstract class GoogleVertexAIConnection<CallOptions extends AsyncCallerCallOptions, ResponseType extends GoogleResponse, AuthOptions> extends GoogleConnection<CallOptions, ResponseType> implements GoogleVertexAIConnectionParams<AuthOptions> {
13
14
  endpoint: string;
14
15
  location: string;
15
16
  apiVersion: string;
16
- constructor(fields: GoogleVertexAIConnectionParams<AuthOptions> | undefined, caller: AsyncCaller, client: GoogleAbstractedClient);
17
- buildMethod(): string;
17
+ constructor(fields: GoogleVertexAIConnectionParams<AuthOptions> | undefined, caller: AsyncCaller, client: GoogleAbstractedClient, streaming?: boolean);
18
+ buildMethod(): GoogleAbstractedClientOpsMethod;
18
19
  }
19
- export declare class GoogleVertexAILLMConnection<CallOptions extends BaseLanguageModelCallOptions, InstanceType, PredictionType extends GoogleVertexAIBasePrediction, AuthOptions> extends GoogleVertexAIConnection<CallOptions, PredictionType, AuthOptions> implements GoogleVertexAIBaseLLMInput<AuthOptions> {
20
+ export declare function complexValue(value: unknown): unknown;
21
+ export declare function simpleValue(val: unknown): unknown;
22
+ export declare class GoogleVertexAILLMConnection<CallOptions extends BaseLanguageModelCallOptions, InstanceType, PredictionType extends GoogleVertexAIBasePrediction, AuthOptions> extends GoogleVertexAIConnection<CallOptions, GoogleVertexAILLMResponse<PredictionType>, AuthOptions> implements GoogleVertexAIBaseLLMInput<AuthOptions> {
20
23
  model: string;
21
24
  client: GoogleAbstractedClient;
22
- constructor(fields: GoogleVertexAIBaseLLMInput<AuthOptions> | undefined, caller: AsyncCaller, client: GoogleAbstractedClient);
25
+ constructor(fields: GoogleVertexAIBaseLLMInput<AuthOptions> | undefined, caller: AsyncCaller, client: GoogleAbstractedClient, streaming?: boolean);
23
26
  buildUrl(): Promise<string>;
27
+ formatStreamingData(inputs: InstanceType[], parameters: GoogleVertexAIModelParams): unknown;
28
+ formatStandardData(instances: InstanceType[], parameters: GoogleVertexAIModelParams): unknown;
29
+ formatData(instances: InstanceType[], parameters: GoogleVertexAIModelParams): unknown;
24
30
  request(instances: InstanceType[], parameters: GoogleVertexAIModelParams, options: CallOptions): Promise<GoogleVertexAILLMResponse<PredictionType>>;
25
31
  }
32
+ export interface GoogleVertexAILLMResponse<PredictionType extends GoogleVertexAIBasePrediction> extends GoogleResponse {
33
+ data: GoogleVertexAIStream | GoogleVertexAILLMPredictions<PredictionType>;
34
+ }
35
+ export declare class GoogleVertexAIStream {
36
+ _buffer: string;
37
+ _bufferOpen: boolean;
38
+ _firstRun: boolean;
39
+ /**
40
+ * Add data to the buffer. This may cause chunks to be generated, if available.
41
+ * @param data
42
+ */
43
+ appendBuffer(data: string): void;
44
+ /**
45
+ * Indicate there is no more data that will be added to the text buffer.
46
+ * This should be called when all the data has been read and added to indicate
47
+ * that we should process everything remaining in the buffer.
48
+ */
49
+ closeBuffer(): void;
50
+ /**
51
+ * Skip characters in the buffer till we get to the start of an object.
52
+ * Then attempt to read a full object.
53
+ * If we do read a full object, turn it into a chunk and send it to the chunk handler.
54
+ * Repeat this for as much as we can.
55
+ */
56
+ _parseBuffer(): void;
57
+ /**
58
+ * If the string is present, move the start of the buffer to the first occurrence
59
+ * of that string. This is useful for skipping over elements or parts that we're not
60
+ * really interested in parsing. (ie - the opening characters, comma separators, etc.)
61
+ * @param start The string to start the buffer with
62
+ */
63
+ _skipTo(start: string): void;
64
+ /**
65
+ * Given what is in the buffer, parse a single object out of it.
66
+ * If a complete object isn't available, return null.
67
+ * Assumes that we are at the start of an object to parse.
68
+ */
69
+ _getFullObject(): object | null;
70
+ _simplifyObject(obj: unknown): object;
71
+ _chunkResolution: (chunk: any) => void;
72
+ _chunkPending: Promise<any> | null;
73
+ _chunkQueue: any[];
74
+ /**
75
+ * Register that we have another chunk available for consumption.
76
+ * If we are waiting for a chunk, resolve the promise waiting for it immediately.
77
+ * If not, then add it to the queue.
78
+ * @param chunk
79
+ */
80
+ _handleChunk(chunk: any): void;
81
+ /**
82
+ * Get the next chunk that is coming from the stream.
83
+ * This chunk may be null, usually indicating the last chunk in the stream.
84
+ */
85
+ nextChunk(): Promise<any>;
86
+ /**
87
+ * Is the stream done?
88
+ * A stream is only done if all of the following are true:
89
+ * - There is no more data to be added to the text buffer
90
+ * - There is no more data in the text buffer
91
+ * - There are no chunks that are waiting to be consumed
92
+ */
93
+ get streamDone(): boolean;
94
+ }