Skip to content

Commit

Permalink
FIX: Cloudflare Workers AI embeddings
Browse files Browse the repository at this point in the history
Regressed on 534b0df
  • Loading branch information
xfalcox committed Dec 20, 2024
1 parent 6a7a45f commit b6ea353
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/inference/cloudflare_workers_ai.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b6ea353

Please sign in to comment.