Merge branch 'main' into fix-streaming-anthropic-2

This commit is contained in:
Ishaan Jaff 2023-08-28 09:05:51 -07:00 committed by GitHub
commit 8c35ffe884
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
89 changed files with 4930 additions and 675 deletions

View file

@ -81,16 +81,17 @@ class AnthropicLLM:
api_key=self.api_key,
additional_args={"complete_input_dict": data},
)
# COMPLETION CALL
response = requests.post(
self.completion_url, headers=self.headers, data=json.dumps(data), stream=optional_params["stream"]
)
print(optional_params)
if "stream" in optional_params and optional_params["stream"] is True:
print("IS STREAMING")
## COMPLETION CALL
if "stream" in optional_params and optional_params["stream"] == True:
response = requests.post(
self.completion_url, headers=self.headers, data=json.dumps(data), stream=optional_params["stream"]
)
return response.iter_lines()
else:
# LOGGING
response = requests.post(
self.completion_url, headers=self.headers, data=json.dumps(data)
)
## LOGGING
self.logging_obj.post_call(
input=prompt,
api_key=self.api_key,