-
Notifications
You must be signed in to change notification settings - Fork 57
Description
Type of issue
issue / bug
Language
JavaScript
Description
lots of errors in the quickstart for LangGraph -- would be fixed by not relying on .mdx files...but here we are
All the tools have the fundamental error of the tool functions argument being typed as any instead of being inferred from the schema.

const add = tool(({ a, b }) => a + b, {
name: 'add',
description: 'Add two numbers',
schema: z.object({
a: z.number().describe('First number'),
b: z.number().describe('Second number'),
}),
});
The argument type passed into new StateGraph
seems to be pretty messed up.

const agent = new StateGraph(MessagesState)
.addNode('llmCall', llmCall)
.addNode('toolNode', toolNode)
.addEdge(START, 'llmCall')
.addConditionalEdges('llmCall', shouldContinue, ['toolNode', END])
.addEdge('toolNode', 'llmCall')
.compile();
I can't find a single valid example of passing in a State-type object to new StateGraph()
that doesn't error out like this.
This code wouldn't pass most enterprise-level typechecking.
Additionally, the shouldContinue
has an error, but it's too long to take a screenshot of, can someone who actually uses TypeScript take a look at the TS documentation and make sure it isn't riddled with errors?
Finally, result.message is of type unknown and so you can't iterate over it because it's not an array or something else iterable.
for (const message of result.messages) {
console.log(`[${message.getType()}]: ${message.text}`);
}