Skip to content

Commit b01272f

Browse files
committed
remove anthropic prompt caching from tools section
Turns out it's too short to be cached (about 300 tokens, where the min is 1024).
1 parent 3a3796c commit b01272f

File tree

1 file changed

+1
-14
lines changed

1 file changed

+1
-14
lines changed

node/providers/anthropic.ts

+1-14
Original file line numberDiff line numberDiff line change
@@ -108,20 +108,7 @@ export class AnthropicProvider implements Provider {
108108
});
109109

110110
const tools: Anthropic.Tool[] = ToolManager.TOOL_SPECS.map(
111-
(t, idx): Anthropic.Tool => {
112-
if (idx == ToolManager.TOOL_SPECS.length - 1) {
113-
/** Assuming that the ordering when the prompt is sent to anthropic will be:
114-
* system
115-
* tools
116-
*
117-
* So marking the last tool with cache_control should use the first cache breakpoint to tag the end of this opening section.
118-
*/
119-
return {
120-
...t,
121-
input_schema: t.input_schema as Anthropic.Messages.Tool.InputSchema,
122-
cache_control: { type: "ephemeral" },
123-
};
124-
}
111+
(t): Anthropic.Tool => {
125112
return {
126113
...t,
127114
input_schema: t.input_schema as Anthropic.Messages.Tool.InputSchema,

0 commit comments

Comments
 (0)