@langchain/core 0.1.18 → 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.
@@ -18,8 +18,12 @@ class BaseListChatMessageHistory extends serializable_js_1.Serializable {
18
18
  addUserMessage(message) {
19
19
  return this.addMessage(new index_js_1.HumanMessage(message));
20
20
  }
21
+ /** @deprecated Use addAIMessage instead */
21
22
  addAIChatMessage(message) {
22
23
  return this.addMessage(new index_js_1.AIMessage(message));
23
24
  }
25
+ addAIMessage(message) {
26
+ return this.addMessage(new index_js_1.AIMessage(message));
27
+ }
24
28
  }
25
29
  exports.BaseListChatMessageHistory = BaseListChatMessageHistory;
@@ -18,6 +18,8 @@ export declare abstract class BaseChatMessageHistory extends Serializable {
18
18
  export declare abstract class BaseListChatMessageHistory extends Serializable {
19
19
  abstract addMessage(message: BaseMessage): Promise<void>;
20
20
  addUserMessage(message: string): Promise<void>;
21
+ /** @deprecated Use addAIMessage instead */
21
22
  addAIChatMessage(message: string): Promise<void>;
23
+ addAIMessage(message: string): Promise<void>;
22
24
  abstract getMessages(): Promise<BaseMessage[]>;
23
25
  }
@@ -14,7 +14,11 @@ export class BaseListChatMessageHistory extends Serializable {
14
14
  addUserMessage(message) {
15
15
  return this.addMessage(new HumanMessage(message));
16
16
  }
17
+ /** @deprecated Use addAIMessage instead */
17
18
  addAIChatMessage(message) {
18
19
  return this.addMessage(new AIMessage(message));
19
20
  }
21
+ addAIMessage(message) {
22
+ return this.addMessage(new AIMessage(message));
23
+ }
20
24
  }
@@ -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.18",
3
+ "version": "0.1.20-rc.0",
4
4
  "description": "Core LangChain.js abstractions and schemas",
5
5
  "type": "module",
6
6
  "engines": {
@@ -15,21 +15,24 @@
15
15
  "scripts": {
16
16
  "build": "yarn clean && yarn build:esm && yarn build:cjs && yarn run build:scripts",
17
17
  "build:esm": "NODE_OPTIONS=--max-old-space-size=4096 tsc --outDir dist/ && rimraf dist/tests dist/**/tests",
18
- "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",
19
- "build:watch": "node scripts/create-entrypoints.js && tsc --outDir dist/ --watch",
20
- "build:scripts": "node scripts/create-entrypoints.js && node scripts/check-tree-shaking.js",
18
+ "build:cjs": "NODE_OPTIONS=--max-old-space-size=4096 tsc --outDir dist-cjs/ -p tsconfig.cjs.json && yarn move-cjs-to-dist && rimraf dist-cjs",
19
+ "build:watch": "yarn create-entrypoints && tsc --outDir dist/ --watch",
20
+ "build:scripts": "yarn create-entrypoints && yarn check-tree-shaking",
21
21
  "lint:eslint": "NODE_OPTIONS=--max-old-space-size=4096 eslint --cache --ext .ts,.js src/",
22
22
  "lint:dpdm": "dpdm --exit-code circular:1 --no-warning --no-tree src/*.ts src/**/*.ts",
23
23
  "lint": "yarn lint:eslint && yarn lint:dpdm",
24
24
  "lint:fix": "yarn lint:eslint --fix && yarn lint:dpdm",
25
- "clean": "rimraf .turbo/ dist/ && NODE_OPTIONS=--max-old-space-size=4096 node scripts/create-entrypoints.js pre",
25
+ "clean": "rimraf .turbo/ dist/ && NODE_OPTIONS=--max-old-space-size=4096 yarn create-entrypoints -- --pre",
26
26
  "prepack": "yarn build",
27
27
  "release": "release-it --only-version --config .release-it.json",
28
28
  "test": "NODE_OPTIONS=--experimental-vm-modules jest --testPathIgnorePatterns=\\.int\\.test.ts --testTimeout 30000 --maxWorkers=50%",
29
29
  "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch --testPathIgnorePatterns=\\.int\\.test.ts",
30
30
  "test:single": "NODE_OPTIONS=--experimental-vm-modules yarn run jest --config jest.config.cjs --testTimeout 100000",
31
- "format": "prettier --config .prettierrc --write \"src\" \"scripts\"",
32
- "format:check": "prettier --config .prettierrc --check \"src\" \"scripts\""
31
+ "format": "prettier --config .prettierrc --write \"src\"",
32
+ "format:check": "prettier --config .prettierrc --check \"src\"",
33
+ "move-cjs-to-dist": "yarn lc-build --config ./langchain.config.js --move-cjs-dist",
34
+ "create-entrypoints": "yarn lc-build --config ./langchain.config.js --create-entrypoints",
35
+ "check-tree-shaking": "yarn lc-build --config ./langchain.config.js --tree-shaking"
33
36
  },
34
37
  "author": "LangChain",
35
38
  "license": "MIT",
@@ -48,6 +51,7 @@
48
51
  },
49
52
  "devDependencies": {
50
53
  "@jest/globals": "^29.5.0",
54
+ "@langchain/scripts": "^0.0.2",
51
55
  "@swc/core": "^1.3.90",
52
56
  "@swc/jest": "^0.2.29",
53
57
  "dpdm": "^3.12.0",
@@ -440,9 +444,6 @@
440
444
  "utils/types.d.ts",
441
445
  "vectorstores.cjs",
442
446
  "vectorstores.js",
443
- "vectorstores.d.ts",
444
- "index.cjs",
445
- "index.js",
446
- "index.d.ts"
447
+ "vectorstores.d.ts"
447
448
  ]
448
449
  }
package/index.cjs DELETED
@@ -1 +0,0 @@
1
- module.exports = require('./dist/index.cjs');
package/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from './dist/index.js'
package/index.js DELETED
@@ -1 +0,0 @@
1
- export * from './dist/index.js'