@langchain/langgraph 0.0.11 → 0.0.12

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.
@@ -21,9 +21,10 @@ class Branch {
21
21
  this.condition = condition;
22
22
  this.ends = ends;
23
23
  }
24
+ async runnable(
24
25
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
25
- runnable(input, options) {
26
- const result = this.condition(input, options?.config);
26
+ input, options) {
27
+ const result = await this.condition(input, options?.config);
27
28
  let destination;
28
29
  if (this.ends) {
29
30
  destination = this.ends[result];
@@ -107,9 +108,6 @@ class Graph {
107
108
  if (!this.nodes[startKey]) {
108
109
  throw new Error(`Need to addNode \`${startKey}\` first`);
109
110
  }
110
- if (condition.constructor.name === "AsyncFunction") {
111
- throw new Error("Condition cannot be an async function");
112
- }
113
111
  if (conditionalEdgeMapping) {
114
112
  const mappingValues = Array.from(Object.values(conditionalEdgeMapping));
115
113
  const nodesValues = Object.keys(this.nodes);
@@ -11,7 +11,7 @@ declare class Branch {
11
11
  constructor(condition: CallableFunction, ends?: EndsMap);
12
12
  runnable(input: any, options?: {
13
13
  config?: RunnableConfig;
14
- }): Runnable;
14
+ }): Promise<Runnable>;
15
15
  }
16
16
  export declare class Graph<RunInput = any, RunOutput = any> {
17
17
  nodes: Record<string, Runnable<RunInput, RunOutput>>;
@@ -18,9 +18,10 @@ class Branch {
18
18
  this.condition = condition;
19
19
  this.ends = ends;
20
20
  }
21
+ async runnable(
21
22
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
22
- runnable(input, options) {
23
- const result = this.condition(input, options?.config);
23
+ input, options) {
24
+ const result = await this.condition(input, options?.config);
24
25
  let destination;
25
26
  if (this.ends) {
26
27
  destination = this.ends[result];
@@ -104,9 +105,6 @@ export class Graph {
104
105
  if (!this.nodes[startKey]) {
105
106
  throw new Error(`Need to addNode \`${startKey}\` first`);
106
107
  }
107
- if (condition.constructor.name === "AsyncFunction") {
108
- throw new Error("Condition cannot be an async function");
109
- }
110
108
  if (conditionalEdgeMapping) {
111
109
  const mappingValues = Array.from(Object.values(conditionalEdgeMapping));
112
110
  const nodesValues = Object.keys(this.nodes);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langchain/langgraph",
3
- "version": "0.0.11",
3
+ "version": "0.0.12",
4
4
  "description": "LangGraph",
5
5
  "type": "module",
6
6
  "engines": {
@@ -37,11 +37,11 @@
37
37
  "author": "LangChain",
38
38
  "license": "MIT",
39
39
  "dependencies": {
40
- "@langchain/core": "^0.1.50"
40
+ "@langchain/core": "^0.1.51"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@jest/globals": "^29.5.0",
44
- "@langchain/community": "^0.0.42",
44
+ "@langchain/community": "^0.0.43",
45
45
  "@langchain/openai": "^0.0.23",
46
46
  "@langchain/scripts": "~0.0",
47
47
  "@swc/core": "^1.3.90",