Skip to content

Commit 5a3f000

Browse files
orvillemlnhsingh
andauthored
fix(docs): Custom RAG Grade Documents sample (#1155)
Corrected errors in Typescript sample for "Grade documents" section. ## Overview Found a few issues while trying the Custom RAG sample code. Submitting a few changes to correct the documentation. ## Type of change **Type:** Fix typo/bug ## Related issues/PRs <!-- Link to related issues, feature PRs, or discussions (if applicable) To automatically close an issue when this PR is merged, use closing keywords: - "closes #123" or "fixes #123" or "resolves #123" For regular references without auto-closing, just use: - "#123" or "See issue #123" Examples: - closes #456 (will auto-close issue #456 when PR is merged) - See #789 for context (will reference but not auto-close issue #789) --> - GitHub issue: - Feature PR: <!-- For LangChain employees, if applicable: --> - Linear issue: - Slack thread: ## Checklist <!-- Put an 'x' in all boxes that apply --> - [x] I have read the [contributing guidelines](README.md) - [ ] I have tested my changes locally using `docs dev` - [x] All code examples have been tested and work correctly - [ ] I have used **root relative** paths for internal links - [ ] I have updated navigation in `src/docs.json` if needed - I have gotten approval from the relevant reviewers - (Internal team members only / optional) I have created a preview deployment using the [Create Preview Branch workflow](https://github.com/langchain-ai/docs/actions/workflows/create-preview-branch.yml) ## Additional notes <!-- Any other information that would be helpful for reviewers --> Co-authored-by: Lauren Hirata Singh <lauren@langchain.dev>
1 parent 50f157c commit 5a3f000

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/oss/langgraph/agentic-rag.mdx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ Note that the components will operate on the [`MessagesState`](/oss/langgraph/gr
457457
temperature: 0,
458458
}).withStructuredOutput(gradeDocumentsSchema);
459459

460-
const score = await chain.invoke({
460+
const score = await prompt.pipe(model).invoke({
461461
question: messages.at(0)?.content,
462462
context: messages.at(-1)?.content,
463463
});
@@ -470,13 +470,15 @@ Note that the components will operate on the [`MessagesState`](/oss/langgraph/gr
470470
```
471471
2. Run this with irrelevant documents in the tool response:
472472
```typescript
473+
import { ToolMessage } from "@langchain/core/messages";
474+
473475
const input = {
474476
messages: [
475477
new HumanMessage("What does Lilian Weng say about types of reward hacking?"),
476478
new AIMessage({
477479
tool_calls: [
478480
{
479-
type: "tool_call"
481+
type: "tool_call",
480482
name: "retrieve_blog_posts",
481483
args: { query: "types of reward hacking" },
482484
id: "1",
@@ -499,7 +501,7 @@ Note that the components will operate on the [`MessagesState`](/oss/langgraph/gr
499501
new AIMessage({
500502
tool_calls: [
501503
{
502-
type: "tool_call"
504+
type: "tool_call",
503505
name: "retrieve_blog_posts",
504506
args: { query: "types of reward hacking" },
505507
id: "1",

0 commit comments

Comments
 (0)