Skip to content

Conversation

@jamesbraza
Copy link
Collaborator

@jamesbraza jamesbraza commented Oct 27, 2025

--- is a basic Markdown hrule (link), which is also enforced by prettier in actual .md files.

This PR cleans up our prompting a bunch:

  1. Moves our prompts to match this hrule convention, which has a few benefits:
    • Our prompt rendering better aligns with Markdown renderers
      • This may benefit how models perform on our prompts
    • Less prompt tokens
  2. Inserts a placeholder (no text) if a Context has empty string text, to avoid model confusion.
  3. Removes extra --- on table creation
  4. Removes extra whitespace from qa_prompt

After this PR, here is a Context creation prompt involving a table:

Summarize the excerpt below to help answer a question.

Excerpt from Meeson2019 pages 25-31: Meeson, Richard, et al. "The Influence of Gap Size on the Development of Fracture Union with a Micro External Fixator." *Journal of the Mechanical Behavior of Biomedical Materials*, vol. 97, 2019, doi:10.1016/j.jmbbm.2019.07.015. Accessed 2025.

---

Placeholder

---

Markdown tables from Meeson2019 pages 25-31: Meeson, Richard, et al. "The Influence of Gap Size on the Development of Fracture Union with a Micro External Fixator." *Journal of the Mechanical Behavior of Biomedical Materials*, vol. 97, 2019, doi:10.1016/j.jmbbm.2019.07.015. Accessed 2025.. If the markdown is poorly formatted, defer to the images.

|% TISSUE|1.0mm Gap|1.5mm Gap|2.0mm Gap|
|---|---|---|---|
|**Bone**|45.6±33.0|39.1±23.9|23.2±26.6|
|**Cartilage**|36.7±22.1|43.1±24.6|37.2±17.9|
|**Fibrous**|14.7±30.6|15.3±37.4|36.1±40.8|
|**Vascular**<br>|3.0±1.9|2.4±2.0|3.5±3.4|

---

Question: What osteotomy gap (mm) has the bone volume per slice?

Do not directly answer the question, instead summarize to give evidence to help answer the question. Stay detailed; report specific numbers, equations, or direct quotes (marked with quotation marks). Reply "Not applicable" if the excerpt is irrelevant. At the end of your response, provide an integer score from 1-10 on a newline indicating relevance to question. Do not explain your score.

Relevant Information Summary (25 to 50 words):

@jamesbraza jamesbraza self-assigned this Oct 27, 2025
Copilot AI review requested due to automatic review settings October 27, 2025 19:54
@jamesbraza jamesbraza added the enhancement New feature or request label Oct 27, 2025
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Oct 27, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR standardizes horizontal rule formatting in prompts by replacing ---- and ------------ with the standard Markdown --- hrule, reducing token usage and improving compatibility with Markdown renderers. Additionally, it adds (no text) placeholder when context text is empty to prevent model confusion.

Key changes:

  • Standardized all horizontal rules to --- format
  • Added placeholder text for empty contexts
  • Updated test assertions to match new separator format

Reviewed Changes

Copilot reviewed 5 out of 12 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/test_paperqa.py Updated test assertion to expect --- separator instead of ----
tests/cassettes/test_partly_embedded_texts[True].yaml Test cassette updated with new prompt format and API version changes
src/paperqa/settings.py Changed context section separator from ---- to ---
src/paperqa/prompts.py Standardized all horizontal rules to --- and reorganized prompt templates
src/paperqa/core.py Added (no text) placeholder for empty text and removed extra separator in table formatting

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jamesbraza jamesbraza force-pushed the simplifying-prompt-lines branch from 7895e53 to 9491b9b Compare October 27, 2025 20:40
Copy link
Collaborator

@mskarlin mskarlin left a comment

Choose a reason for hiding this comment

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

lgtm

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Oct 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants