Support OpenAI prompt_cache_breakpoint on Responses API input content

Cerrado
#6,831 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@brandon-julio-t ya está trabajando en esto.

Desde el 1/8/2026.

  • #6833 de @brandon-julio-t — abierto

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
56/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Tranquilo
Stack tecnológico
typescript
Área
api

Línea de trabajo

Start with the InputTextContent, InputImageContent, InputFileContent, and InputContent definitions in packages/ai/openai/src/OpenAiSchema.ts, then inspect the system, user, image, and PDF conversions in packages/ai/openai/src/OpenAiLanguageModel.ts. Define an OpenAI-specific way to carry a breakpoint through prompt conversion and verify that the intended input_text, input_image, and input_file blocks emit it without conflating request-level cache options.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Support OpenAI prompt_cache_breakpoint on Responses API input content

Summary

@effect/ai-openai currently has no way to mark an explicit OpenAI prompt-cache breakpoint on a Responses API input content block.

OpenAI's GPT-5.6 prompt-caching API supports prompt_cache_breakpoint on input_text, input_image, and input_file blocks. This is distinct from prompt_cache_key, which is a request-level cache-routing control.

Version checked

Why this matters

GPT-5.6 and later cache exact prefixes at cache breakpoints. With the default implicit policy, the service places a breakpoint at the latest user or tool message. If a stable system prompt or document is followed by changing content, the implicit breakpoint can repeatedly select a changing prefix instead of the stable reusable prefix.

An explicit breakpoint lets an application mark the end of the stable prefix. Combined with prompt_cache_options.mode: "explicit", it can also prevent writes for changing suffixes.

See OpenAI's current documentation for the behavior and supported blocks:

Evidence in Effect

The high-level Responses content schemas have no breakpoint field:

The prompt translator constructs those blocks without a breakpoint:

A repository-wide search of packages/ai/openai and packages/ai/openai-compat at c9b56ab507f224426ee8388dc450da447ec4715f finds no prompt_cache_breakpoint or prompt_cache_options support.

Expected behavior

Effect prompt content should provide an OpenAI-specific way to request:

{
  "type": "input_text",
  "text": "stable reusable instructions",
  "prompt_cache_breakpoint": {
    "mode": "explicit"
  }
}

The same capability should be representable for input_image and input_file parts supported by OpenAI.

The exact Effect API could use provider options on prompt parts or another provider-specific mechanism. The important behavior is that the marker survives prompt conversion and is emitted on the intended content block.

Request-level prompt_cache_key and prompt_cache_options support is tracked separately in #6830 because those fields belong to OpenAiLanguageModel.Config rather than individual prompt content blocks.

Related work

  • #6342 reported that encoding system messages as strings prevented OpenAI cache hits.
  • #6549 changed system-message encoding to an input_text block, which is one of the content types on which OpenAI now supports explicit breakpoints.
  • #6504 / #6519 added the cache-write usage accounting needed to measure explicit caching behavior.
Lenguaje dominante
TypeScript
Estrellas
16.7k
Forks
808
Merge medio
11 h 3 min
PR fusionados (30 d)
840

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

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de Effect-TS/effect

Todos los issues de Effect-TS/effect

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.