We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Following the guide here: https://langchain-ai.github.io/langgraphjs/concepts/low_level/#multiple-schemas
import { Annotation, StateGraph } from "@langchain/langgraph"; const InputStateAnnotation = Annotation.Root({ user_input: Annotation<string>, }); const OutputStateAnnotation = Annotation.Root({ graph_output: Annotation<string>, }); const OverallStateAnnotation = Annotation.Root({ foo: Annotation<string>, bar: Annotation<string>, user_input: Annotation<string>, graph_output: Annotation<string>, }); const node1 = async (state: typeof InputStateAnnotation.State) => { // Write to OverallStateAnnotation return { foo: state.user_input + " name" }; }; const node2 = async (state: typeof OverallStateAnnotation.State) => { // Read from OverallStateAnnotation, write to OverallStateAnnotation return { bar: state.foo + " is" }; }; const node3 = async (state: typeof OverallStateAnnotation.State) => { // Read from OverallStateAnnotation, write to OutputStateAnnotation return { graph_output: state.bar + " Lance" }; }; const graph = new StateGraph({ input: InputStateAnnotation, output: OutputStateAnnotation, stateSchema: OverallStateAnnotation, }) .addNode("node1", node1) .addNode("node2", node2) .addNode("node3", node3) .addEdge("__start__", "node1") .addEdge("node1", "node2") .addEdge("node2", "node3") .compile(); await graph.invoke({ user_input: "My" });
While this can be run from LangGraph studio, in VSCode there is an error on this line:
stateSchema: OverallStateAnnotation,
Type 'AnnotationRoot<{ foo: { (): LastValue<string>; (annotation: SingleReducer<string, string>): BinaryOperatorAggregate<string, string>; Root: <S extends StateDefinition>(sd: S) => AnnotationRoot<...>; }; bar: { ...; }; user_input: { ...; }; graph_output: { ...; }; }>' is not assignable to type 'AnnotationRoot<{ user_input: { (): LastValue<string>; (annotation: SingleReducer<string, string>): BinaryOperatorAggregate<string, string>; Root: <S extends StateDefinition>(sd: S) => AnnotationRoot<...>; }; }>'. Types of property 'Node' are incompatible. Type 'NodeType<{ foo: { (): LastValue<string>; (annotation: SingleReducer<string, string>): BinaryOperatorAggregate<string, string>; Root: <S extends StateDefinition>(sd: S) => AnnotationRoot<...>; }; bar: { ...; }; user_input: { ...; }; graph_output: { ...; }; }>' is not assignable to type 'NodeType<{ user_input: { (): LastValue<string>; (annotation: SingleReducer<string, string>): BinaryOperatorAggregate<string, string>; Root: <S extends StateDefinition>(sd: S) => AnnotationRoot<...>; }; }>'. Type 'RunnableFunc<StateType<{ foo: { (): LastValue<string>; (annotation: SingleReducer<string, string>): BinaryOperatorAggregate<string, string>; Root: <S extends StateDefinition>(sd: S) => AnnotationRoot<...>; }; bar: { ...; }; user_input: { ...; }; graph_output: { ...; }; }>, UpdateType<...> | Partial<...>, RunnableCon...' is not assignable to type 'NodeType<{ user_input: { (): LastValue<string>; (annotation: SingleReducer<string, string>): BinaryOperatorAggregate<string, string>; Root: <S extends StateDefinition>(sd: S) => AnnotationRoot<...>; }; }>'. Type 'RunnableFunc<StateType<{ foo: { (): LastValue<string>; (annotation: SingleReducer<string, string>): BinaryOperatorAggregate<string, string>; Root: <S extends StateDefinition>(sd: S) => AnnotationRoot<...>; }; bar: { ...; }; user_input: { ...; }; graph_output: { ...; }; }>, UpdateType<...> | Partial<...>, RunnableCon...' is not assignable to type 'RunnableFunc<StateType<{ user_input: { (): LastValue<string>; (annotation: SingleReducer<string, string>): BinaryOperatorAggregate<string, string>; Root: <S extends StateDefinition>(sd: S) => AnnotationRoot<...>; }; }>, UpdateType<...> | Partial<...>, RunnableConfig<...>>'. Type 'StateType<{ user_input: { (): LastValue<string>; (annotation: SingleReducer<string, string>): BinaryOperatorAggregate<string, string>; Root: <S extends StateDefinition>(sd: S) => AnnotationRoot<...>; }; }>' is missing the following properties from type 'StateType<{ foo: { (): LastValue<string>; (annotation: SingleReducer<string, string>): BinaryOperatorAggregate<string, string>; Root: <S extends StateDefinition>(sd: S) => AnnotationRoot<...>; }; bar: { ...; }; user_input: { ...; }; graph_output: { ...; }; }>': foo, bar, graph_outputts(2322)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Following the guide here: https://langchain-ai.github.io/langgraphjs/concepts/low_level/#multiple-schemas
While this can be run from LangGraph studio, in VSCode there is an error on this line:
The text was updated successfully, but these errors were encountered: