📕(summarize) Let the model choose which doc to summarize#282
📕(summarize) Let the model choose which doc to summarize#282camilleAND wants to merge 1 commit intomainfrom
Conversation
WalkthroughAdded an optional Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 🧹 Recent nitpick comments
Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
|
Note Docstrings generation - SUCCESS |
Docstrings generation was requested by @camilleAND. * #282 (comment) The following files were modified: * `src/backend/chat/tools/document_summarize.py`



Add
doc_indexargument todocument_summarizetoolThis PR updates the document_summarize tool to support summarizing specific documents within a conversation.
Changes
Added an optional doc_index argument (integer) to the document_summarize function.
Updated the tool's docstring and examples to explain how to use doc_index (e.g., 0 for the first document, -1 for the last).
Implemented logic to filter the list of text attachments based on the provided index.
Added error handling for out-of-range indices, raising a ModelRetry exception to allow the model to correct itself.
Preserved existing behavior: if doc_index is None (default), all text documents are summarized together.
This allows the LLM to handle user requests like "summarize the last document" or "summarize the first document" more effectively by targeting a specific file instead of processing all available attachments.
Summary by CodeRabbit