perf(claude): the prompt caching is used by default (#413)

This commit is contained in:
yetone 2024-08-31 13:54:49 +08:00 committed by GitHub
parent 6b11ac7fd5
commit 0c9e715829
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -28,12 +28,9 @@ M.parse_message = function(prompt_opts)
local user_prompt_obj = { local user_prompt_obj = {
type = "text", type = "text",
text = user_prompt, text = user_prompt,
cache_control = { type = "ephemeral" },
} }
if Utils.tokens.calculate_tokens(user_prompt_obj.text) > 1024 then
user_prompt_obj.cache_control = { type = "ephemeral" }
end
table.insert(message_content, user_prompt_obj) table.insert(message_content, user_prompt_obj)
end end