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

[Feature Request] Prompt caching #1353

Open
gius opened this issue Nov 11, 2024 · 3 comments
Open

[Feature Request] Prompt caching #1353

gius opened this issue Nov 11, 2024 · 3 comments
Labels

Comments

@gius
Copy link

gius commented Nov 11, 2024

Do you plan to make use of Prompt caching? It should make multiple commands for a single MR faster and cheaper.

https://openai.com/index/api-prompt-caching/
https://www.anthropic.com/news/prompt-caching

@mrT23
Copy link
Collaborator

mrT23 commented Nov 14, 2024

According to the documentation, caching happens automatically.

image

@gius
Copy link
Author

gius commented Nov 19, 2024

My use case is when you run multiple commands (/describe, /review, /improve) on a single MR. In that case, the part you want to cache is the MR diff.

As I understand the documentation, in case of OpenAI, you'd need all three commands to start with the same text (probably a shared intro followed with the diff) and move the specific instructions to the end of the prompt.
For Claude, you need to put the diff into a separate section marked with "cache_control": {"type": "ephemeral"}

@mrT23
Copy link
Collaborator

mrT23 commented Nov 20, 2024

The prompt needs to be different for the different command

Even the code diff is presented differently (with\without lines, token cap, metadata, ...)

So to your question - we probably dont support auto caching

@mrT23 mrT23 added the answered label Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants