Add per-turn prompt cache TTL options (#59480)

## What changed

- Expose `PromptCacheTtl` through `TurnStartOptions` and `RecoverTurnRequest`, supporting `30m` and `12h` minimum cache lifetimes.
- Carry the selected TTL through turn execution and compaction into `prompt_cache_options.ttl` on Responses HTTP and WebSocket requests. Omit the field when unset and keep the selection scoped to the turn.
- Include prompt cache options in WebSocket request reuse checks.

## Testing

Add coverage for both TTL values and omission on a subsequent turn without an override, and extend WebSocket serialization coverage to include prompt cache options.

GitOrigin-RevId: 8529306e6ad6030fe77c5e6bf19f3810717c0c5e
This commit is contained in:
Rohan Mehta
2026-11-04 19:58:24 +00:00
committed by copyberry
parent c9296fa1a9
commit 41cbd5b9b2
26 changed files with 106 additions and 0 deletions
+4
View File
@@ -355,6 +355,7 @@ async fn responses_client_stream_request_preserves_item_ids() -> Result<()> {
include: Vec::new(),
service_tier: None,
prompt_cache_key: None,
prompt_cache_options: None,
text: None,
client_metadata: None,
access_programs: None,
@@ -411,6 +412,7 @@ async fn responses_client_stream_request_sends_routing_fields_ahead_of_large_inp
include: Vec::new(),
service_tier: Some("priority".into()),
prompt_cache_key: None,
prompt_cache_options: None,
text: None,
client_metadata: None,
access_programs: None,
@@ -501,6 +503,7 @@ async fn streaming_client_retries_on_transport_error() -> Result<()> {
include: Vec::new(),
service_tier: None,
prompt_cache_key: None,
prompt_cache_options: None,
text: None,
client_metadata: None,
access_programs: None,
@@ -626,6 +629,7 @@ async fn azure_store_sends_ids_and_headers() -> Result<()> {
include: Vec::new(),
service_tier: None,
prompt_cache_key: None,
prompt_cache_options: None,
text: None,
client_metadata: None,
access_programs: None,