mirror of
https://github.com/pacnpal/Roo-Code.git
synced 2025-12-20 12:21:13 -05:00
Fix haiku prompt caching when tool prompt doesnt meet min required tokens
This commit is contained in:
@@ -56,9 +56,7 @@ export class AnthropicHandler implements ApiHandler {
|
|||||||
}
|
}
|
||||||
return message
|
return message
|
||||||
}),
|
}),
|
||||||
tools: tools.map((tool, index) =>
|
tools, // cache breakpoints go from tools > system > messages, and since tools dont change, we can just set the breakpoint at the end of system (this avoids having to set a breakpoint at the end of tools which by itself does not meet min requirements for haiku caching)
|
||||||
index === tools.length - 1 ? { ...tool, cache_control: { type: "ephemeral" } } : tool
|
|
||||||
),
|
|
||||||
tool_choice: { type: "auto" },
|
tool_choice: { type: "auto" },
|
||||||
},
|
},
|
||||||
(() => {
|
(() => {
|
||||||
|
|||||||
@@ -215,45 +215,35 @@ const ModelInfoView = ({ modelInfo }: { modelInfo: ModelInfo }) => {
|
|||||||
}).format(price)
|
}).format(price)
|
||||||
}
|
}
|
||||||
|
|
||||||
const showPromptCachingPrices =
|
|
||||||
modelInfo.supportsPromptCache && modelInfo.cacheWritesPrice && modelInfo.cacheReadsPrice
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<p style={{ fontSize: "12px", marginTop: "2px", color: "var(--vscode-descriptionForeground)" }}>
|
<p style={{ fontSize: "12px", marginTop: "2px", color: "var(--vscode-descriptionForeground)" }}>
|
||||||
<ModelInfoSupportsItem
|
|
||||||
isSupported={modelInfo.supportsPromptCache}
|
|
||||||
supportsLabel="Supports prompt caching"
|
|
||||||
doesNotSupportLabel="Does not support prompt caching"
|
|
||||||
/>{" "}
|
|
||||||
<VSCodeLink href="https://www.anthropic.com/news/prompt-caching" style={{ display: "inline" }}>
|
|
||||||
(what is this?)
|
|
||||||
</VSCodeLink>
|
|
||||||
<br />
|
|
||||||
<ModelInfoSupportsItem
|
<ModelInfoSupportsItem
|
||||||
isSupported={modelInfo.supportsImages}
|
isSupported={modelInfo.supportsImages}
|
||||||
supportsLabel="Supports images"
|
supportsLabel="Supports images"
|
||||||
doesNotSupportLabel="Does not support images"
|
doesNotSupportLabel="Does not support images"
|
||||||
/>
|
/>
|
||||||
<br />
|
<br />
|
||||||
|
<ModelInfoSupportsItem
|
||||||
|
isSupported={modelInfo.supportsPromptCache}
|
||||||
|
supportsLabel="Supports prompt caching"
|
||||||
|
doesNotSupportLabel="Does not support prompt caching"
|
||||||
|
/>
|
||||||
|
<br />
|
||||||
<span style={{ fontWeight: 500 }}>Max output:</span> {modelInfo.maxTokens.toLocaleString()} tokens
|
<span style={{ fontWeight: 500 }}>Max output:</span> {modelInfo.maxTokens.toLocaleString()} tokens
|
||||||
<br />
|
<br />
|
||||||
<span style={{ fontWeight: 500 }}>
|
<span style={{ fontWeight: 500 }}>Input price:</span> {formatPrice(modelInfo.inputPrice)}/million tokens
|
||||||
{showPromptCachingPrices ? "Base input price:" : "Input price:"}
|
{modelInfo.supportsPromptCache && modelInfo.cacheWritesPrice && modelInfo.cacheReadsPrice && (
|
||||||
</span>{" "}
|
|
||||||
{formatPrice(modelInfo.inputPrice)} per million tokens
|
|
||||||
{showPromptCachingPrices && (
|
|
||||||
<>
|
<>
|
||||||
<br />
|
<br />
|
||||||
<span style={{ fontWeight: 500 }}>Prompt caching write price:</span>{" "}
|
<span style={{ fontWeight: 500 }}>Cache writes price:</span>{" "}
|
||||||
{formatPrice(modelInfo.cacheWritesPrice || 0)} per million tokens
|
{formatPrice(modelInfo.cacheWritesPrice || 0)}/million tokens
|
||||||
<br />
|
<br />
|
||||||
<span style={{ fontWeight: 500 }}>Prompt caching read price:</span>{" "}
|
<span style={{ fontWeight: 500 }}>Cache reads price:</span>{" "}
|
||||||
{formatPrice(modelInfo.cacheReadsPrice || 0)} per million tokens
|
{formatPrice(modelInfo.cacheReadsPrice || 0)}/million tokens
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
<br />
|
<br />
|
||||||
<span style={{ fontWeight: 500 }}>Output price:</span> {formatPrice(modelInfo.outputPrice)} per million
|
<span style={{ fontWeight: 500 }}>Output price:</span> {formatPrice(modelInfo.outputPrice)}/million tokens
|
||||||
tokens
|
|
||||||
</p>
|
</p>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user