Lean into provider-native caching (explicit Gemini context caching, docs, visibility)
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Necesita aclaración
- Estado de actividad
- Tranquilo
- Stack tecnológico
- python
- Área
- ai, documentation
Línea de trabajo
Empieza con _provider_google.py y el nuevo accessor Chat.files; después, compara el manejo de la caché en _provider_anthropic.py y _provider_openai.py. Aclara el diseño de la API para el almacenamiento explícito en caché del contexto de Gemini, la guía de caching y cualquier pequeña exposición de parámetros. Se considera terminado cuando el comportamiento de caching provider-native acordado y la documentación cubran cached_input, los valores predeterminados del proveedor, las ventajas y desventajas del TTL y los prompts compatibles con la caché.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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).
- Lenguaje dominante
- Python
- Estrellas
- 179
- Forks
- 32
- Merge medio
- 1 d 3 h
- PR fusionados (30 d)
- 10
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de posit-dev/chatlas
-
A streaming text delta that repeats everything streamed so far is missing from the recorded turnPosiblemente ocupada @cpsievert la tomó hace 81 días. Abiertoai-triage:done Priority: Medium
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Los mantenedores suelen responder en 1 día
-
ai-triage:needs-review documentation
Dificultad 2/5 1-2 días Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 42/100
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 1-2 días Aptitud para principiantes 35/100
Los mantenedores suelen responder en 1 día
-
ai-triage:done Priority: Low
Dificultad 3/5 1-2 días Aptitud para principiantes 55/100
Los mantenedores suelen responder en 1 día
Todos los issues de posit-dev/chatlas
Issues similares
-
bot-triaged module: decompositions module: edge cases module: int overflow module: primTorch oncall: pt2 triage review
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
[TV SHOW]: Dynasty (1981)Abiertocountry:US rating:6 request-theme type:TV SHOW
Dificultad 1/5 Menos de una hora Aptitud para principiantes 65/100
LizardByte/ThemerrDB#10501 · 1 comentario ·
-
triage/confirmed
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
agentscope-ai/agentscope#4563 ·
Los mantenedores suelen responder en 2 días
-
comp/desktop desktop/chat P3 type/bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
NousResearch/hermes-agent#164451 ·
Los mantenedores suelen responder en 1 día
-
external integration integration-submission
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
langchain-ai/docs#8426 ·
Los mantenedores suelen responder en 1 día