Skip to content

[langgraph]: please, someone do the simplest thing of putting the js docs into an IDE and seeing all the errors #530

@markgoho

Description

@markgoho

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.

Image
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.

Image
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}`);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    langgraphFor docs changes to LangGraph

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions