From 9a38408b1a8795106b97e5a5cc9878ac8571cbc1 Mon Sep 17 00:00:00 2001 From: Orville McDonald Date: Mon, 27 Oct 2025 23:22:29 -0700 Subject: [PATCH] Update agentic-rag.mdx Grade Documents sample Corrected errors in Typescript sample for "Grade documents" section. --- src/oss/langgraph/agentic-rag.mdx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/oss/langgraph/agentic-rag.mdx b/src/oss/langgraph/agentic-rag.mdx index 4fae096b5f..f760ba75b9 100644 --- a/src/oss/langgraph/agentic-rag.mdx +++ b/src/oss/langgraph/agentic-rag.mdx @@ -457,7 +457,7 @@ Note that the components will operate on the [`MessagesState`](/oss/langgraph/gr temperature: 0, }).withStructuredOutput(gradeDocumentsSchema); - const score = await chain.invoke({ + const score = await prompt.pipe(model).invoke({ question: messages.at(0)?.content, context: messages.at(-1)?.content, }); @@ -470,13 +470,15 @@ Note that the components will operate on the [`MessagesState`](/oss/langgraph/gr ``` 2. Run this with irrelevant documents in the tool response: ```typescript + import { ToolMessage } from "@langchain/core/messages"; + const input = { messages: [ new HumanMessage("What does Lilian Weng say about types of reward hacking?"), new AIMessage({ tool_calls: [ { - type: "tool_call" + type: "tool_call", name: "retrieve_blog_posts", args: { query: "types of reward hacking" }, id: "1", @@ -499,7 +501,7 @@ Note that the components will operate on the [`MessagesState`](/oss/langgraph/gr new AIMessage({ tool_calls: [ { - type: "tool_call" + type: "tool_call", name: "retrieve_blog_posts", args: { query: "types of reward hacking" }, id: "1",