From b6ea353b0e35d13eb0237627033c90d70d8c5f2a Mon Sep 17 00:00:00 2001 From: Rafael Silva Date: Fri, 20 Dec 2024 17:11:27 -0300 Subject: [PATCH] FIX: Cloudflare Workers AI embeddings Regressed on 534b0df --- lib/inference/cloudflare_workers_ai.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/inference/cloudflare_workers_ai.rb b/lib/inference/cloudflare_workers_ai.rb index b0cd59266..d6e0dfb3e 100644 --- a/lib/inference/cloudflare_workers_ai.rb +++ b/lib/inference/cloudflare_workers_ai.rb @@ -27,10 +27,12 @@ def perform!(content) "Authorization" => "Bearer #{api_token}", } + payload = { text: [content] } + endpoint = "https://api.cloudflare.com/client/v4/accounts/#{account_id}/ai/run/@cf/#{model}" conn = Faraday.new { |f| f.adapter FinalDestination::FaradayAdapter } - response = conn.post(endpoint, content.to_json, headers) + response = conn.post(endpoint, payload.to_json, headers) case response.status when 200