From 8809ccb23c025b4467fab0a91ad3d0133880c66e Mon Sep 17 00:00:00 2001 From: Obie Fernandez Date: Mon, 21 Oct 2024 07:54:19 -0600 Subject: [PATCH] make content check a little more resilient --- lib/raix/message_adapters/base.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/raix/message_adapters/base.rb b/lib/raix/message_adapters/base.rb index 0e13b71..029bd29 100644 --- a/lib/raix/message_adapters/base.rb +++ b/lib/raix/message_adapters/base.rb @@ -40,7 +40,7 @@ def content(message) raise ArgumentError, "Invalid message format: #{message.inspect}" end.tap do |msg| # convert to anthropic multipart format if model is claude-3 and cache_at is set - if model["anthropic/claude-3"] && cache_at && msg[:content].length > cache_at.to_i + if model.to_s.include?("anthropic/claude-3") && cache_at && msg[:content].to_s.length > cache_at.to_i msg[:content] = [{ type: "text", text: msg[:content], cache_control: { type: "ephemeral" } }] end end