Community[patch]: Missing "stream" parameter in cloudflare_workersai (#23987)

### Description
Missing "stream" parameter. Without it, you'd never receive a stream of
tokens when using stream() or astream()

### Issue
No existing issue available
This commit is contained in:
Paolo Ráez 2024-07-18 03:09:39 +01:00 committed by GitHub
parent 570566b858
commit 0dec72cab0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -70,7 +70,9 @@ class CloudflareWorkersAI(LLM):
"""Call Cloudflare Workers API"""
headers = {"Authorization": f"Bearer {self.api_token}"}
data = {"prompt": prompt, "stream": self.streaming, **params}
response = requests.post(self.endpoint_url, headers=headers, json=data)
response = requests.post(
self.endpoint_url, headers=headers, json=data, stream=self.streaming
)
return response
def _process_response(self, response: requests.Response) -> str: