mirror of
https://github.com/razzant/ouroboros.git
synced 2026-08-26 11:31:48 +00:00
fix: cache_control TTL ordering — tools ttl must be >= system ttl for Anthropic API
Anthropic requires cache_control TTL blocks in non-increasing order across tools → system → messages. Tools had default 5m TTL while system[0] had 1h, causing 400 BadRequest on every LLM call since v4.14.0 prompt caching. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
aed7a7c504
commit
176567bf51
1 changed files with 1 additions and 1 deletions
|
|
@ -186,7 +186,7 @@ class LLMClient:
|
|||
tools_with_cache = [t for t in tools] # shallow copy
|
||||
if tools_with_cache:
|
||||
last_tool = {**tools_with_cache[-1]} # copy last tool
|
||||
last_tool["cache_control"] = {"type": "ephemeral"}
|
||||
last_tool["cache_control"] = {"type": "ephemeral", "ttl": "1h"}
|
||||
tools_with_cache[-1] = last_tool
|
||||
kwargs["tools"] = tools_with_cache
|
||||
kwargs["tool_choice"] = tool_choice
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue