[PR #1334] [MERGED] Update agentic-rag.mdx: rewrite_question Node: Role and Content based… #1476

Closed
opened 2026-02-17 17:22:24 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/docs/pull/1334
Author: @SrijanShovit225
Created: 11/7/2025
Status: Merged
Merged: 11/13/2025
Merged by: @lnhsingh

Base: mainHead: patch-1


📝 Commits (2)

  • cf61181 Update agentic-rag.mdx: rewrite_question Node: Role and Content based dictionary replaced with LangChain Human Message
  • 758a35e Merge branch 'main' into patch-1

📊 Changes

1 file changed (+4 additions, -2 deletions)

View changed files

📝 src/oss/langgraph/agentic-rag.mdx (+4 -2)

📄 Description

… dictionary replaced with LangChain Human Message

As per the docs live officially, in the rewrite_question node, the response of the model for rewriting the query is returned in dictionary format to messages in the state.

return {"messages": [{"role": "user", "content": response.content}]}

I understand this has been done keeping in mind to modify the message's role from ai/assistant to user in the state. While this is not critical for the time being, it might cause errors while printing graph's streaming updates.

for node, update in chunk.items():
print("Update from node", node)
update["messages"][-1].pretty_print()
print("\n\n")

This might have been skipped due to running an example where rewrite node was not required.

However, if the rewrite node comes into play, it would push the dictionary-based format of messages and not the standard Messages class format. The pretty print function is valid only on Message classes and not a dictionary; this would lead to an attribute error: AttributeError: 'dict' object has no attribute 'pretty_print'

For AI learners, especially those who have been exploring LangChain v1.0 docs might get blocked due to this while following the tutorial.

Please merge this one so that it adds to the quality and trust for LangChain docs.

Overview

Type of change

Type: [Replace with: New documentation page / Update existing documentation / Fix typo/bug/link/formatting / Remove outdated content / Other]

Related issues/PRs

  • GitHub issue:
  • Feature PR:
  • Linear issue:
  • Slack thread:

Checklist

  • I have read the contributing guidelines
  • I have tested my changes locally using docs dev
  • 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

Additional notes


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langchain-ai/docs/pull/1334 **Author:** [@SrijanShovit225](https://github.com/SrijanShovit225) **Created:** 11/7/2025 **Status:** ✅ Merged **Merged:** 11/13/2025 **Merged by:** [@lnhsingh](https://github.com/lnhsingh) **Base:** `main` ← **Head:** `patch-1` --- ### 📝 Commits (2) - [`cf61181`](https://github.com/langchain-ai/docs/commit/cf611814cc947bd6af138277655ec99e08a2d2c3) Update agentic-rag.mdx: rewrite_question Node: Role and Content based dictionary replaced with LangChain Human Message - [`758a35e`](https://github.com/langchain-ai/docs/commit/758a35eafa12870eec95ca95115a6518e794e710) Merge branch 'main' into patch-1 ### 📊 Changes **1 file changed** (+4 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `src/oss/langgraph/agentic-rag.mdx` (+4 -2) </details> ### 📄 Description … dictionary replaced with LangChain Human Message As per the docs live officially, in the rewrite_question node, the response of the model for rewriting the query is returned in dictionary format to messages in the state. return {"messages": [{"role": "user", "content": response.content}]} I understand this has been done keeping in mind to modify the message's role from ai/assistant to user in the state. While this is not critical for the time being, it might cause errors while printing graph's streaming updates. for node, update in chunk.items(): print("Update from node", node) update["messages"][-1].pretty_print() print("\n\n") This might have been skipped due to running an example where rewrite node was not required. However, if the rewrite node comes into play, it would push the dictionary-based format of messages and not the standard Messages class format. The pretty print function is valid only on Message classes and not a dictionary; this would lead to an attribute error: AttributeError: 'dict' object has no attribute 'pretty_print' For AI learners, especially those who have been exploring LangChain v1.0 docs might get blocked due to this while following the tutorial. Please merge this one so that it adds to the quality and trust for LangChain docs. ## Overview <!-- Brief description of what documentation is being added/updated --> ## Type of change **Type:** [Replace with: New documentation page / Update existing documentation / Fix typo/bug/link/formatting / Remove outdated content / Other] ## 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 --> - [ ] 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 - [x] I have used **root relative** paths for internal links - [x] 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 --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-17 17:22:24 -05:00
yindo closed this issue 2026-02-17 17:22:24 -05:00
yindo changed title from [PR #1334] Update agentic-rag.mdx: rewrite_question Node: Role and Content based… to [PR #1334] [MERGED] Update agentic-rag.mdx: rewrite_question Node: Role and Content based… 2026-06-05 18:12:51 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/docs#1476