feat(prompts): steer models toward $$ math delimiters (#1057)

Add a math formatting hint to the chat, source chat, Ask and
transformation prompts: emit display math as $$...$$ and inline math
as $...$ so formulas render via KaTeX, reserving fenced latex code
blocks for when the user explicitly asks for the LaTeX source itself.

Closes #1051
This commit is contained in:
Luis Novo 2026-07-11 18:25:39 -03:00 • committed by GitHub
parent 8bcfe01f4c
commit dd63bcb05c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 19 additions and 0 deletions

View file

@ -10,6 +10,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Release confidence process, documented and executable: `.github/RELEASE_PROCESS.md` now covers the risk-based test matrix (buckets A/B/C), the Docker image gate, the fix-loop re-test policy and the communication/credits/retro structure, backed by a new decision record (ADR-005) and versioned tooling under `scripts/release-test/` — `make release-test TAG= OLD_TAG=` runs fresh-install + upgrade scenarios against real images, and `make release-stack TAG= [DUMP=]` boots a browsable, isolated release-candidate stack (optionally with a copy of dev data) for manual verification
### Changed
- Chat, source chat, Ask and transformation prompts now steer models to write math as `$$...$$` (display) / `$...$` (inline) so formulas render via KaTeX, reserving fenced `latex` code blocks for when the user explicitly asks for the LaTeX source (#1051)
### Removed
- Dead Streamlit-era service layer (~2,000 lines): `api/client.py` (a synchronous HTTP client that called the app's own API) and 13 `api/*_service.py` wrappers that consumed the app's own HTTP API — none were imported by any router, command or test. Also removed the toy `process_text`/`analyze_data` demo commands (`commands/example_commands.py`) from the background worker
- Pre-1.6 embedding job compatibility shims (the `embed_single_item`, `embed_chunk` and `vectorize_source` command handlers) — they existed only so jobs queued by a pre-1.6 version could drain after an upgrade, and any worker restarted on 1.6+ has no such jobs. **Upgrade note:** if you are upgrading from a version older than 1.6 with embedding jobs still queued, drain the queue on a 1.x release before upgrading past this change. Also removed dead tooling config from `pyproject.toml`: the `[tool.mypy]` block (the real config is `mypy.ini`) and Streamlit-era ruff per-file-ignores for files that no longer exist

View file

@ -26,6 +26,10 @@ Here are the answers you received for each of your queries.
Based on the user question, the context and the retrieved answers, please formulate a final response to the user.
# MATH FORMATTING
When showing math, write display math as $$...$$ and inline math as $...$ so formulas render properly. Only use fenced ```latex code blocks when the user explicitly asks for the LaTeX source itself.
# CITING SOURCES
It's very important that your response contains references to the searched documents so the user can follow-up and read more about the topic. The way you do that is by adding the id of the specific document in between brackets like this: [document_id]. The references will be present on all the answers you have been provided.

View file

@ -23,6 +23,10 @@ The user has selected this context to help you with your response:
{{context}}
{% endif %}
# MATH FORMATTING
When showing math, write display math as $$...$$ and inline math as $...$ so formulas render properly. Only use fenced ```latex code blocks when the user explicitly asks for the LaTeX source itself.
# CITING INSTRUCTIONS
If your answer is based off of any item in the context, it's very important that your response contains references to the searched documents so the user can follow-up and read more about the topic. The way you do that is by adding the id of the specific document in between brackets like this: [document_id].

View file

@ -27,6 +27,10 @@ When a user asks you a question, analyze both the source content and the availab
{{ context }}
{% endif %}
# MATH FORMATTING
When showing math, write display math as $$...$$ and inline math as $...$ so formulas render properly. Only use fenced ```latex code blocks when the user explicitly asks for the LaTeX source itself.
# CITING INSTRUCTIONS
When referencing information from the source or its insights, always include citations using the document IDs. This helps users track the specific content you're referencing.

View file

@ -1,3 +1,7 @@
{{ instructions }}
# MATH FORMATTING
When showing math, write display math as $$...$$ and inline math as $...$ so formulas render properly. Only use fenced ```latex code blocks when the user explicitly asks for the LaTeX source itself.
# INPUT