Skip to content

✨(back) upgrade agent and tool prompts for DINUM assistant - #642

Merged
providenz merged 1 commit into
mainfrom
camand/upgrade_prompts
Aug 13, 2026
Merged

✨(back) upgrade agent and tool prompts for DINUM assistant#642
providenz merged 1 commit into
mainfrom
camand/upgrade_prompts

Conversation

@camilleAND

@camilleAND camilleAND commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Replace generic AI_AGENT_INSTRUCTIONS with DINUM-scoped system prompt and cleaned descriptions with APO.

#674

Summary by CodeRabbit

  • Improvements

    • Improved document search and summarization guidance, including mixed document and current-events requests.
    • Refined web search behavior for time-sensitive and factual questions.
    • Clarified self-documentation and document filtering behavior.
    • Enhanced French responses with clearer reliability, administrative-procedure, formatting, and safety guidance.
    • Improved Markdown, mathematical notation, and French typography consistency.
  • Bug Fixes

    • Fixed the Docs button icon display.
  • Documentation

    • Added unreleased changelog entries for these improvements.

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 102ad1de-3377-4924-b945-1b8ea433d4fe

📥 Commits

Reviewing files that changed from the base of the PR and between 58677d5 and 84fa450.

📒 Files selected for processing (1)
  • CHANGELOG.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • CHANGELOG.md

Walkthrough

The 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.

Changes

Prompt guidance updates

Layer / File(s) Summary
Chat tool routing guidance
src/backend/chat/tools/descriptions.py
Retrieval, summarization, project-library, web-search, and self-documentation prompts now define tool-selection rules, document ID constraints, freshness handling, and direct summarizer output.
Default agent instruction prompt
src/backend/conversations/settings.py, CHANGELOG.md
The default prompt now specifies French administrative assistance, capability limits, reliability requirements, document-tool behavior, distress guidance, and Markdown, typography, and LaTeX formatting rules. The changelog records these updates.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Mergeability Score: ⚪ Minimal · up to 84fa4

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

  • suitenumerique/conversations#592: Related conversation and document summarization prompt infrastructure changes in descriptions.py and conversations/settings.py.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main changes to the DINUM assistant’s agent and tool prompts.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch camand/upgrade_prompts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
src/backend/conversations/settings.py (1)

790-793: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Avoid promising an unconditional Docs export button.

DOCS_BASE_URL defaults to None, and DOCS_BASE_URL === undefined hides 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

📥 Commits

Reviewing files that changed from the base of the PR and between 0671ac0 and f9c8925.

📒 Files selected for processing (2)
  • src/backend/chat/tools/descriptions.py
  • src/backend/conversations/settings.py

Comment thread src/backend/chat/tools/descriptions.py
Comment on lines 83 to 91
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."
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 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.

@camilleAND
camilleAND force-pushed the camand/upgrade_prompts branch from f9c8925 to eaa7582 Compare July 31, 2026 13:43
@providenz
providenz force-pushed the camand/upgrade_prompts branch from eaa7582 to 58677d5 Compare August 12, 2026 15:47

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 win

Merge the duplicate ### Changed section.

At Line 27, the [unreleased] section repeats the ### Changed heading. Move - 💄(front) correct icon Docs button under the existing ### Changed heading 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

📥 Commits

Reviewing files that changed from the base of the PR and between eaa7582 and 58677d5.

📒 Files selected for processing (2)
  • CHANGELOG.md
  • src/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>
@providenz
providenz force-pushed the camand/upgrade_prompts branch from 58677d5 to 84fa450 Compare August 13, 2026 07:49
@sonarqubecloud

Copy link
Copy Markdown

@providenz
providenz merged commit 84fa450 into main Aug 13, 2026
29 of 31 checks passed
@providenz
providenz deleted the camand/upgrade_prompts branch August 13, 2026 08:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants