Lean into provider-native caching (explicit Gemini context caching, docs, visibility)
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- python
- Lĩnh vực
- ai, documentation
Hướng nghiên cứu
Bắt đầu với _provider_google.py và accessor Chat.files mới, sau đó so sánh cách xử lý cache trong _provider_anthropic.py và _provider_openai.py. Làm rõ thiết kế API cho việc cache ngữ cảnh Gemini một cách tường minh, hướng dẫn caching và bất kỳ việc expose tham số nhỏ nào. Được xem là hoàn tất khi hành vi caching provider-native đã thống nhất và tài liệu bao quát cached_input, các giá trị mặc định của provider, các đánh đổi của TTL và các prompt thân thiện với cache.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Motivation
Client-side response caches (LangChain's set_llm_cache, LiteLLM's caching layer) date from early 2023, before Anthropic prompt caching (Aug 2024), OpenAI automatic prompt caching (Oct 2024), or Gemini context caching existed. The providers now solve the underlying cost/latency problem better, and chatlas already leans into that harder than most frameworks:
- Anthropic/Bedrock:
cache="5m"on by default, withcache_controlinjection and cache-write cost multipliers (1.25×/2×) reflected inget_cost()(_provider_anthropic.py). - OpenAI: automatic server-side caching;
cached_tokensextracted and priced (_provider_openai.py). - Google: implicit-cache token counts tracked (
_provider_google.py). get_tokens()/get_cost()exposecached_inputas a first-class field; prior art in #103, #133, #158, #243 (all closed).
What remains is closing the gaps, not adding a new cache layer.
Proposed work
- Explicit Gemini context caching — the one concrete API gap. Support Google's explicit caching (
client.caches.create(...)with a TTL, then reference the cached content across calls). This dovetails with the newChat.filesaccessor: same "register once, reference cheaply across turns" model. Whether it surfaces as achat.files-like accessor, a content type (cf. #136content_ephemeral()), or aChatGoogle()parameter is the main design question. - A caching guide in the docs — the current defaults are good but invisible. Cover: what each provider does automatically, how to read
cached_inputfromget_tokens()to check your hit rate, Anthropic TTL tradeoffs ("5m"vs"1h"write multipliers), and how to keep prompts cache-friendly (stable prefix; don't churn the system prompt or tool set mid-conversation). - Small parameter exposure — e.g. OpenAI's
prompt_cache_keyrouting hint for improving hit rates. Low priority for chatlas's typical single-process user, but cheap. - Cross-issue design note — prefix caches reward immutable history, so history compaction (#356) and mutable system prompts are cache-busting operations. The #356 design should account for the one-time cost cliff after a compaction.
Non-goal: client-side response cache
A LangChain-style client-side response cache is out of scope. Its one honest use case — replaying an identical request without paying again (prompt caching discounts input tokens but never eliminates the call or the output tokens) — is better served elsewhere:
- Notebook/script re-runs: that's a persistence problem — reload the earlier conversation (#352
chat.save()/Chat.load()) instead of re-asking the model. - Tests/CI: VCR-style request recording (what chatlas's own test suite uses via
pytest-recording) is purpose-built for this. - Treating nondeterministic calls as cacheable pure functions also has real surprise potential (a cache silently freezes responses that users expect to vary).
Part of the July 2026 competitive-review workstreams (#360).
- Ngôn ngữ chính
- Python
- Star
- 179
- Fork
- 32
- Merge trung bình
- 1 ngày 3 giờ
- Pull request đã merge (30 ngày)
- 10
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của posit-dev/chatlas
-
A streaming text delta that repeats everything streamed so far is missing from the recorded turnCó thể đã có người làm @cpsievert đã nhận 81 ngày trước. Đang mởai-triage:done Priority: Medium
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày
-
ai-triage:needs-review documentation
Độ khó 2/5 1-2 ngày Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 42/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 1-2 ngày Mức phù hợp với người mới 35/100
Maintainer thường phản hồi trong vòng 1 ngày
-
ai-triage:done Priority: Low
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của posit-dev/chatlas
Issue tương tự
-
bot-triaged module: decompositions module: edge cases module: int overflow module: primTorch oncall: pt2 triage review
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[TV SHOW]: Dynasty (1981)Đang mởcountry:US rating:6 request-theme type:TV SHOW
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 65/100
LizardByte/ThemerrDB#10501 · 1 bình luận ·
-
triage/confirmed
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
agentscope-ai/agentscope#4563 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
comp/desktop desktop/chat P3 type/bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
NousResearch/hermes-agent#164451 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
external integration integration-submission
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
langchain-ai/docs#8426 ·
Maintainer thường phản hồi trong vòng 1 ngày