✨(back) upgrade agent and tool prompts for DINUM assistant - #642
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughThe pull request revises chat-tool prompts and replaces the default agent instruction prompt with detailed French-language guidance for tool selection, document handling, reliability, administrative procedures, distress responses, and formatting. ChangesPrompt guidance updates
Estimated code review effort: 3 (Moderate) | ~20 minutes Mergeability Score: ⚪ Minimal · up to This prompt and tool-description update presents no actionable merge-blocking risk at the current head and is merge-ready after normal checks and review. Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
src/backend/conversations/settings.py (1)
790-793: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAvoid promising an unconditional Docs export button.
DOCS_BASE_URLdefaults toNone, andDOCS_BASE_URL === undefinedhides the “Edit in Docs” menu. Reframe this instruction conditionally, e.g. “if the export button is displayed,” or gate the prompt on whether Docs integration is configured.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/backend/conversations/settings.py` around lines 790 - 793, Update the user-facing instructions near the export guidance so they do not promise that a Docs export button is always available. Make the wording conditional on the export button being displayed, or gate the guidance on configured Docs integration while preserving the restriction that only the user can initiate the export.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/backend/chat/tools/descriptions.py`:
- Around line 8-9: Update the guidance at src/backend/chat/tools/descriptions.py
lines 8-9 and 43-47 so extract-then-summarize requests preserve the
retrieved-passage scope: require synthesis directly from document_search_rag
results or a summarization interface that accepts those passages, rather than
the whole-document summarize tool.
- Around line 83-91: The self_documentation routing prompt must cover all
clearly assistant-specific meta questions, including references by the
assistant’s name, without requiring second-person wording. Update
SELF_DOCUMENTATION_SYSTEM_PROMPT at src/backend/chat/tools/descriptions.py:83-91
accordingly; revise the generic-AI exclusion at
src/backend/chat/tools/descriptions.py:93-105 to remove direct-address wording
as a mandatory condition while preserving exclusions for generic AI/LLM
questions, document content, and tasks to perform.
---
Nitpick comments:
In `@src/backend/conversations/settings.py`:
- Around line 790-793: Update the user-facing instructions near the export
guidance so they do not promise that a Docs export button is always available.
Make the wording conditional on the export button being displayed, or gate the
guidance on configured Docs integration while preserving the restriction that
only the user can initiate the export.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: bb99738e-1c36-4704-9d87-12f8b292cd5e
📒 Files selected for processing (2)
src/backend/chat/tools/descriptions.pysrc/backend/conversations/settings.py
| SELF_DOCUMENTATION_SYSTEM_PROMPT = ( | ||
| "For meta questions about this assistant itself (identity, model, " | ||
| "For meta questions about THIS assistant itself (identity, model, " | ||
| "capabilities, limitations, privacy, internet access, accepted files, " | ||
| "or hosting), call the self_documentation tool before answering. " | ||
| "Do not call it for questions about attached documents, web search " | ||
| "or general knowledge." | ||
| "hosting, or when it uses web search), call the self_documentation tool " | ||
| "before answering. This applies when the user addresses you directly " | ||
| "(you / tu / vous) about what you can do or how you work. " | ||
| "Do not call it for generic questions about AI or LLMs in general, " | ||
| "for document content, or for tasks you should perform." | ||
| ) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Route all clearly assistant-specific meta questions.
The direct-address requirement excludes questions such as “Quel modèle utilise l’Assistant IA ?” or “Quelle est la politique de confidentialité de cet assistant ?”. Those are about this assistant, but lack “vous/tu”; the model may answer from training data instead of official self-documentation.
src/backend/chat/tools/descriptions.py#L83-L91: trigger when the question clearly concerns this assistant, whether phrased directly or by its name.src/backend/chat/tools/descriptions.py#L93-L105: retain the generic-AI exclusion, but remove direct second-person wording as a mandatory condition.
📍 Affects 1 file
src/backend/chat/tools/descriptions.py#L83-L91(this comment)src/backend/chat/tools/descriptions.py#L93-L105
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/backend/chat/tools/descriptions.py` around lines 83 - 91, The
self_documentation routing prompt must cover all clearly assistant-specific meta
questions, including references by the assistant’s name, without requiring
second-person wording. Update SELF_DOCUMENTATION_SYSTEM_PROMPT at
src/backend/chat/tools/descriptions.py:83-91 accordingly; revise the generic-AI
exclusion at src/backend/chat/tools/descriptions.py:93-105 to remove
direct-address wording as a mandatory condition while preserving exclusions for
generic AI/LLM questions, document content, and tasks to perform.
f9c8925 to
eaa7582
Compare
eaa7582 to
58677d5
Compare
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
CHANGELOG.md (1)
27-29: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winMerge the duplicate
### Changedsection.At Line 27, the
[unreleased]section repeats the### Changedheading. Move- 💄(front) correct icon Docs buttonunder the existing### Changedheading at Line 15.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@CHANGELOG.md` around lines 27 - 29, Remove the duplicate ### Changed heading in the [unreleased] section and place the “correct icon Docs button” entry under the existing ### Changed heading near the top of the section, preserving the changelog entry.Source: Linters/SAST tools
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@CHANGELOG.md`:
- Around line 27-29: Remove the duplicate ### Changed heading in the
[unreleased] section and place the “correct icon Docs button” entry under the
existing ### Changed heading near the top of the section, preserving the
changelog entry.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: aabf9c88-d43c-4ba8-a873-76e36245617a
📒 Files selected for processing (2)
CHANGELOG.mdsrc/backend/conversations/settings.py
🚧 Files skipped from review as they are similar to previous changes (1)
- src/backend/conversations/settings.py
Replace generic AI_AGENT_INSTRUCTIONS with DINUM-scoped system prompt and cleaned descriptions with APO. Signed-off-by: Laurent Paoletti <lp@providenz.fr>
58677d5 to
84fa450
Compare
|



Replace generic AI_AGENT_INSTRUCTIONS with DINUM-scoped system prompt and cleaned descriptions with APO.
#674
Summary by CodeRabbit
Improvements
Bug Fixes
Documentation