langgenius / dify

Dify is an open-source LLM app development platform. Dify's intuitive interface combines AI workflow, RAG pipeline, agent capabilities, model management, observability features and more, letting you quickly go from prototype to production.
https://dify.ai
Other
52.45k stars 7.65k forks source link

Prompt Caching by Anthropic Claude #7382

Open amatiytsiv opened 3 months ago

amatiytsiv commented 3 months ago

Self Checks

1. Is this request related to a challenge you're experiencing? Tell me about your story.

anthropic announced support for caching it would be nice to have it in model config options: https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching

2. Additional context or comments

No response

3. Can you help us with this feature?

amatiytsiv commented 2 months ago

any plans on implementing this possibility into dify core and tools as by other tools I can see a significant profit from using these as money saving

dnyg commented 2 months ago

It is a bit of a complicated feature to implement, because cache is not set in model config options - but per prompt.

So we need a way through the UI to specify that a certain prompt should be cached - similar to how you can enable jinja templates with a slider.

I have made a working version that just uses specific tags to trigger caching, but I don't think Dify would be interested in this solution, as it's a poor UX solution

amatiytsiv commented 2 months ago

It is a bit of a complicated feature to implement, because cache is not set in model config options - but per prompt.

So we need a way through the UI to specify that a certain prompt should be cached - similar to how you can enable jinja templates with a slider.

I have made a working version that just uses specific tags to trigger caching, but I don't think Dify would be interested in this solution, as it's a poor UX solution

I believe conversational checkbox next to send button is way to go for now. But most importantly it also has to be implemented as configurable variable in workflow and agents, it can serve as quick job done, avoiding or even preparing good RAG

dosubot[bot] commented 1 week ago

Hi, @amatiytsiv. I'm Dosu, and I'm helping the Dify team manage their backlog. I'm marking this issue as stale.

Issue Summary

Next Steps

Thank you for your understanding and contribution!