@langchain/core 0.1.19 → 0.1.20-rc.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.
@@ -16,16 +16,19 @@ export interface StoredGeneration {
16
16
  message?: StoredMessage;
17
17
  }
18
18
  export type MessageType = "human" | "ai" | "generic" | "system" | "function" | "tool";
19
- export type MessageContent = string | ({
19
+ export type MessageContentText = {
20
20
  type: "text";
21
21
  text: string;
22
- } | {
22
+ };
23
+ export type MessageContentImageUrl = {
23
24
  type: "image_url";
24
25
  image_url: string | {
25
26
  url: string;
26
27
  detail?: "auto" | "low" | "high";
27
28
  };
28
- })[];
29
+ };
30
+ export type MessageContentComplex = MessageContentText | MessageContentImageUrl;
31
+ export type MessageContent = string | MessageContentComplex[];
29
32
  export interface FunctionCall {
30
33
  /**
31
34
  * The arguments to call the function with, as generated by the model in JSON
@@ -101,6 +101,9 @@ class IterableReadableStream extends ReadableStream {
101
101
  // Fix: `else if (value)` will hang the streaming when nullish value (e.g. empty string) is pulled
102
102
  controller.enqueue(value);
103
103
  },
104
+ async cancel(reason) {
105
+ await generator?.return(reason);
106
+ },
104
107
  });
105
108
  }
106
109
  }
@@ -98,6 +98,9 @@ export class IterableReadableStream extends ReadableStream {
98
98
  // Fix: `else if (value)` will hang the streaming when nullish value (e.g. empty string) is pulled
99
99
  controller.enqueue(value);
100
100
  },
101
+ async cancel(reason) {
102
+ await generator?.return(reason);
103
+ },
101
104
  });
102
105
  }
103
106
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langchain/core",
3
- "version": "0.1.19",
3
+ "version": "0.1.20-rc.0",
4
4
  "description": "Core LangChain.js abstractions and schemas",
5
5
  "type": "module",
6
6
  "engines": {