Skip to content

Commit

Permalink
Community[patch]: Missing "stream" parameter in cloudflare_workersai (l…
Browse files Browse the repository at this point in the history
…angchain-ai#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
  • Loading branch information
kharenzze authored Jul 18, 2024
1 parent 570566b commit 0dec72c
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ def _call_api(self, prompt: str, params: Dict[str, Any]) -> requests.Response:
"""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:
Expand Down

0 comments on commit 0dec72c

Please sign in to comment.