From 0dec72cab08cad712a6916368dc37c70faefb7a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paolo=20R=C3=A1ez?= Date: Thu, 18 Jul 2024 03:09:39 +0100 Subject: [PATCH] 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 --- .../langchain_community/llms/cloudflare_workersai.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libs/community/langchain_community/llms/cloudflare_workersai.py b/libs/community/langchain_community/llms/cloudflare_workersai.py index 54b41418c42..314a32223e8 100644 --- a/libs/community/langchain_community/llms/cloudflare_workersai.py +++ b/libs/community/langchain_community/llms/cloudflare_workersai.py @@ -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: