0xPlaygrounds / 0xPlaygrounds/rig
feat: support OpenAI prompt cache breakpoints (Responses API)
- 主要言語
- Rust
- スター
- 8.6k
- フォーク
- 959
- 平均マージ
- 4時間 32分
- マージ済み PR(30日)
- 117
説明
- [x] I have looked for existing issues (including closed) about this
## Feature Request
Support OpenAI's [explicit prompt cache breakpoints](https://developers.openai.com/api/docs/guides/prompt-caching#prompt-cache-breakpoints) (GPT-5.6+): the per-block `prompt_cache_breakpoint` field on `input_text` / `input_image` / `input_file` content parts, and the request-level `prompt_cache_options` object.
### Motivation
rig's Responses API already carries `prompt_cache_key` and `prompt_cache_retention`, but has no way to express the new breakpoint fields. `prompt_cache_options` passed via request `additional_params` is silently dropped today, because `AdditionalParameters` is a closed struct. This is the OpenAI counterpart of the manual `cache_control` placement proposed for Anthropic in #2168.
### Proposal
- Wire types `PromptCacheBreakpoint` (`{"mode": "explicit"}` — the only valid value) and `PromptCacheOptions { mode, ttl }`; a `prompt_cache_options` field on `AdditionalParameters`.
- A documented `additional_params` key, `OPENAI_PROMPT_CACHE_BREAKPOINT_KEY` (`"openai_prompt_cache_breakpoint"`), on generic `Text` / `Image` / `Document` blocks, extracted by **both** message conversion paths onto the corresponding content part (same key-in-`additional_params` pattern as the Anthropic proposal and the existing Anthropic document `title`/`citations` keys).
PR to follow. Same design note as #2168: the carrier mechanism is speculative — happy to redo it differently.
### Alternatives
- First-class fields on generic message types, or typed attach helpers — same trade-offs as discussed in #2168.
- The Chat Completions API also supports these fields on its content parts; this proposal covers the Responses API only. Can follow up with Chat Completions support if wanted.
コントリビューションガイド
調査の方向性
The issue is about extending rig's Responses API to support OpenAI's prompt cache breakpoints. Start by examining the existing `AdditionalParameters` struct and the message conversion paths for `Text`, `Image`, and `Document` blocks. Look for the handling of `additional_params` keys like `OPENAI_PROMPT_CACHE_BREAKPOINT_KEY`. The PR mentioned in the description may provide a reference implementation. Check the linked issue #2168 for context on the `cache_control` pattern. 'Done' means the new fields are correctly wired and extracted in both conversion paths.
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- rust
- 領域
- ai-infra-agents, backend-api-design
- issue の種類
- 機能追加
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 静か
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 45/100