Skip to content

Adding prompt caching#1293

Merged
jamesbraza merged 6 commits intomainfrom
caching
Feb 20, 2026
Merged

Adding prompt caching#1293
jamesbraza merged 6 commits intomainfrom
caching

Conversation

@jamesbraza
Copy link
Copy Markdown
Collaborator

@jamesbraza jamesbraza commented Feb 19, 2026

This PR adds cache_breakpoint throughout the code base cache_control_injection_points to LiteLLM Router so we can get some caching and save money

@jamesbraza jamesbraza self-assigned this Feb 19, 2026
Copilot AI review requested due to automatic review settings February 19, 2026 00:08
@jamesbraza jamesbraza added the enhancement New feature or request label Feb 19, 2026
@cursor
Copy link
Copy Markdown

cursor bot commented Feb 19, 2026

You have run out of free Bugbot PR reviews for this billing cycle. This will reset on March 5.

To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Feb 19, 2026
@dosubot
Copy link
Copy Markdown

dosubot bot commented Feb 19, 2026

Related Documentation

Checked 1 published document(s) in 1 knowledge base(s). No updates required.

How did I do? Any feedback?  Join Discord

Copy link
Copy Markdown
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 implements prompt caching support to reduce LLM API costs by adding cache_breakpoint=True to system messages that are reused across multiple requests.

Changes:

  • Added cache_breakpoint=True to system messages in evidence gathering, query processing, and agent operations
  • Updated dependency fhaviary from version 0.27 to 0.33 to support the cache_breakpoint feature
  • Enhanced test coverage with assertions to verify prompt caching behavior for Anthropic models

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/paperqa/core.py Added cache_breakpoint to system messages in evidence-gathering function
src/paperqa/docs.py Added cache_breakpoint to reusable system message in query operations
src/paperqa/agents/main.py Added cache_breakpoint to agent system prompt that's reused on every turn
pyproject.toml Updated fhaviary dependency to v0.33 for cache_breakpoint support
tests/test_paperqa.py Extended Anthropic test with caching assertions and padding to meet minimum token requirements

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

Copy link
Copy Markdown
Collaborator

@sidnarayanan sidnarayanan left a comment

Choose a reason for hiding this comment

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

Approving, but I haven't looked at why CI is failing

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Feb 19, 2026
@jamesbraza jamesbraza merged commit 7cdc9ac into main Feb 20, 2026
6 of 7 checks passed
@jamesbraza jamesbraza deleted the caching branch February 20, 2026 23:58
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:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants