Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Anthropic plugin system prompt caching #176

Merged
merged 4 commits into from
Nov 27, 2024

Conversation

srgtuszy
Copy link
Contributor

This pull request is related to:

  • A bug
  • A new feature
  • Documentation
  • Other (please specify)

I have checked the following:

  • I have read and understood the contribution guidelines and the code of conduct;
  • I have added new tests (for bug fixes/features);
  • I have added/updated the documentation (for bug fixes / features).

Description:
I added a flag to control prompt caching in anthropic plugin. Usually, system prompts can have lots of instructions and examples for the LLM to follow, which makes it a good target to cache. In order to enable the prompt caching, two things need to happen:

  • An appropriate header must be sent.
  • The system prompt needs to have an additional key sent.

I introduced a flag to control the cache which is passed with the plugin options: cacheSystemPrompt. The flag then is propagated down to toAnthropicRequestBody method where the extra cache_control key is injected into the system prompt based on that.

Sorry, something went wrong.

Verified

This commit was signed with the committer’s verified signature. The key has expired.
ondrejmirtes Ondřej Mirtes
@srgtuszy srgtuszy requested a review from Dabolus as a code owner November 27, 2024 19:45
@srgtuszy srgtuszy changed the title Antropic plugin system prompt caching feat: Antropic plugin system prompt caching Nov 27, 2024
@srgtuszy srgtuszy changed the title feat: Antropic plugin system prompt caching feat: Anthropic plugin system prompt caching Nov 27, 2024
@xavidop xavidop enabled auto-merge November 27, 2024 20:33
@xavidop xavidop merged commit 948e3f7 into TheFireCo:main Nov 27, 2024
1 check passed
@srgtuszy srgtuszy deleted the feat/anthropic-context-caching branch November 27, 2024 21:03
@EPMatt
Copy link
Contributor

EPMatt commented Nov 28, 2024

@allcontributors add @srgtuszy as test, code contributor

Copy link
Contributor

@EPMatt

I've put up a pull request to add @srgtuszy! 🎉

@EPMatt
Copy link
Contributor

EPMatt commented Nov 28, 2024

@allcontributors add @srgtuszy as code, test contributor

Copy link
Contributor

@EPMatt

I've put up a pull request to add @srgtuszy! 🎉

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.

None yet

3 participants