[PR #5950] docs(examples/rag/langgraph_agentic_rag): Remove redundant format_docs helper in generate function #4742

Closed
opened 2026-02-20 17:50:40 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langchain-ai/langgraph/pull/5950

State: closed
Merged: No


Description:
The generate function in the Agentic RAG workflow previously defined a format_docs helper to join document content. However, the documents passed to the function are already a single string returned by the retriever tool, and this helper function has never been used.

This PR:

  • Reduces confusion and improves code readability.
  • Removes the unused format_docs function.
  • Cleans up the generate function to directly use docs as context.

Changes:

  • generate function in edges.py (or wherever defined):
  • Removed the nested format_docs function.
  • Continue passing docs directly to rag_chain.invoke.

Why:

  • docs is already a string; no need to transform it further.
  • Simplifies the code and improves maintainability.
**Original Pull Request:** https://github.com/langchain-ai/langgraph/pull/5950 **State:** closed **Merged:** No --- Description: The generate function in the Agentic RAG workflow previously defined a format_docs helper to join document content. However, the documents passed to the function are already a single string returned by the retriever tool, and this helper function has never been used. This PR: - Reduces confusion and improves code readability. - Removes the unused format_docs function. - Cleans up the generate function to directly use docs as context. Changes: - generate function in edges.py (or wherever defined): - Removed the nested format_docs function. - Continue passing docs directly to rag_chain.invoke. Why: - docs is already a string; no need to transform it further. - Simplifies the code and improves maintainability.
yindo added the pull-request label 2026-02-20 17:50:40 -05:00
yindo closed this issue 2026-02-20 17:50:40 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraph#4742