@langchain/langgraph 0.1.0-rc.1 → 0.1.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.
@@ -5,7 +5,4 @@ export declare function messagesStateReducer(left: BaseMessage[], right: Message
5
5
  export declare class MessageGraph extends StateGraph<BaseMessage[], BaseMessage[], Messages> {
6
6
  constructor();
7
7
  }
8
- export interface MessagesState {
9
- messages: BaseMessage[];
10
- }
11
8
  export {};
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ /* __LC_ALLOW_ENTRYPOINT_SIDE_EFFECTS__ */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.MessagesAnnotation = void 0;
5
+ const annotation_js_1 = require("./annotation.cjs");
6
+ const message_js_1 = require("./message.cjs");
7
+ exports.MessagesAnnotation = annotation_js_1.Annotation.Root({
8
+ messages: (0, annotation_js_1.Annotation)({
9
+ reducer: message_js_1.messagesStateReducer,
10
+ default: () => [],
11
+ }),
12
+ });
@@ -0,0 +1,4 @@
1
+ import { BaseMessage } from "@langchain/core/messages";
2
+ export declare const MessagesAnnotation: import("./annotation.js").AnnotationRoot<{
3
+ messages: import("../channels/binop.js").BinaryOperatorAggregate<BaseMessage[], BaseMessage[]>;
4
+ }>;
@@ -0,0 +1,9 @@
1
+ /* __LC_ALLOW_ENTRYPOINT_SIDE_EFFECTS__ */
2
+ import { Annotation } from "./annotation.js";
3
+ import { messagesStateReducer } from "./message.js";
4
+ export const MessagesAnnotation = Annotation.Root({
5
+ messages: Annotation({
6
+ reducer: messagesStateReducer,
7
+ default: () => [],
8
+ }),
9
+ });
package/dist/index.cjs CHANGED
@@ -15,7 +15,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
16
16
  };
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.MessagesAnnotation = void 0;
18
19
  const async_local_storage_js_1 = require("./setup/async_local_storage.cjs");
19
20
  // Initialize global async local storage instance for tracing
20
21
  (0, async_local_storage_js_1.initializeAsyncLocalStorageSingleton)();
21
22
  __exportStar(require("./web.cjs"), exports);
23
+ var messages_annotation_js_1 = require("./graph/messages_annotation.cjs");
24
+ Object.defineProperty(exports, "MessagesAnnotation", { enumerable: true, get: function () { return messages_annotation_js_1.MessagesAnnotation; } });
package/dist/index.d.ts CHANGED
@@ -1 +1,2 @@
1
1
  export * from "./web.js";
2
+ export { MessagesAnnotation } from "./graph/messages_annotation.js";
package/dist/index.js CHANGED
@@ -3,3 +3,4 @@ import { initializeAsyncLocalStorageSingleton } from "./setup/async_local_storag
3
3
  // Initialize global async local storage instance for tracing
4
4
  initializeAsyncLocalStorageSingleton();
5
5
  export * from "./web.js";
6
+ export { MessagesAnnotation } from "./graph/messages_annotation.js";
@@ -4,7 +4,7 @@ import { Runnable, RunnableToolLike } from "@langchain/core/runnables";
4
4
  import { StructuredToolInterface } from "@langchain/core/tools";
5
5
  import { BaseCheckpointSaver } from "@langchain/langgraph-checkpoint";
6
6
  import { START } from "../graph/index.js";
7
- import { MessagesState } from "../graph/message.js";
7
+ import { MessagesAnnotation } from "../graph/messages_annotation.js";
8
8
  import { CompiledStateGraph } from "../graph/state.js";
9
9
  import { All } from "../pregel/types.js";
10
10
  import { ToolNode } from "./tool_node.js";
@@ -14,7 +14,7 @@ export interface AgentState {
14
14
  export type N = typeof START | "agent" | "tools";
15
15
  export type CreateReactAgentParams = {
16
16
  llm: BaseChatModel;
17
- tools: ToolNode<MessagesState> | (StructuredToolInterface | RunnableToolLike)[];
17
+ tools: ToolNode<typeof MessagesAnnotation.State> | (StructuredToolInterface | RunnableToolLike)[];
18
18
  messageModifier?: SystemMessage | string | ((messages: BaseMessage[]) => BaseMessage[]) | ((messages: BaseMessage[]) => Promise<BaseMessage[]>) | Runnable;
19
19
  checkpointSaver?: BaseCheckpointSaver;
20
20
  interruptBefore?: N[] | All;
@@ -3,13 +3,13 @@ import { RunnableToolLike } from "@langchain/core/runnables";
3
3
  import { StructuredToolInterface } from "@langchain/core/tools";
4
4
  import { RunnableCallable } from "../utils.js";
5
5
  import { END } from "../graph/graph.js";
6
- import { MessagesState } from "../graph/message.js";
6
+ import { MessagesAnnotation } from "../graph/messages_annotation.js";
7
7
  export type ToolNodeOptions = {
8
8
  name?: string;
9
9
  tags?: string[];
10
10
  handleToolErrors?: boolean;
11
11
  };
12
- export declare class ToolNode<T extends BaseMessage[] | MessagesState> extends RunnableCallable<T, T> {
12
+ export declare class ToolNode<T extends BaseMessage[] | typeof MessagesAnnotation.State> extends RunnableCallable<T, T> {
13
13
  /**
14
14
  A node that runs the tools requested in the last AIMessage. It can be used
15
15
  either in StateGraph with a "messages" key or in MessageGraph. If multiple
@@ -21,4 +21,4 @@ export declare class ToolNode<T extends BaseMessage[] | MessagesState> extends R
21
21
  constructor(tools: (StructuredToolInterface | RunnableToolLike)[], options?: ToolNodeOptions);
22
22
  private run;
23
23
  }
24
- export declare function toolsCondition(state: BaseMessage[] | MessagesState): "tools" | typeof END;
24
+ export declare function toolsCondition(state: BaseMessage[] | typeof MessagesAnnotation.State): "tools" | typeof END;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langchain/langgraph",
3
- "version": "0.1.0-rc.1",
3
+ "version": "0.1.0",
4
4
  "description": "LangGraph",
5
5
  "type": "module",
6
6
  "engines": {
@@ -37,12 +37,20 @@
37
37
  "uuid": "^10.0.0",
38
38
  "zod": "^3.23.8"
39
39
  },
40
+ "peerDependencies": {
41
+ "better-sqlite3": "^9.5.0"
42
+ },
43
+ "peerDependenciesMeta": {
44
+ "better-sqlite3": {
45
+ "optional": true
46
+ }
47
+ },
40
48
  "devDependencies": {
41
49
  "@jest/globals": "^29.5.0",
42
50
  "@langchain/anthropic": "^0.2.12",
43
51
  "@langchain/community": "^0.2.25",
44
52
  "@langchain/openai": "^0.2.4",
45
- "@langchain/scripts": "^0.0.22",
53
+ "@langchain/scripts": "^0.0.23",
46
54
  "@swc/core": "^1.3.90",
47
55
  "@swc/jest": "^0.2.29",
48
56
  "@tsconfig/recommended": "^1.0.3",