0xPlaygrounds / 0xPlaygrounds/rig

feat: support OpenAI prompt cache breakpoints (Responses API)

Offen
#2,170 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Rust
Sterne
8.6k
Forks
959
Ø Merge
4 Std. 32 Min.
Gemergte PRs (30 T.)
117

Beschreibung

- [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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
rust
Bereich
ai-infra-agents, backend-api-design
Issue-Typ
Feature
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Ruhig
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.