mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 10:44:24 +00:00
test(utils.py): additional logging
This commit is contained in:
parent
681da80e55
commit
c489f41964
1 changed files with 2 additions and 1 deletions
|
@ -4377,11 +4377,12 @@ class CustomStreamWrapper:
|
|||
return {"text": text, "is_finished": is_finished, "finish_reason": finish_reason}
|
||||
elif str_line.startswith("data:"):
|
||||
data_json = json.loads(str_line[5:])
|
||||
print_verbose(f"delta content: {data_json['choices'][0]['text']}")
|
||||
print_verbose(f"delta content: {data_json}")
|
||||
text = data_json["choices"][0].get("text", "")
|
||||
if data_json["choices"][0].get("finish_reason", None):
|
||||
is_finished = True
|
||||
finish_reason = data_json["choices"][0]["finish_reason"]
|
||||
print_verbose(f"text: {text}; is_finished: {is_finished}; finish_reason: {finish_reason}")
|
||||
return {"text": text, "is_finished": is_finished, "finish_reason": finish_reason}
|
||||
elif "error" in str_line:
|
||||
raise ValueError(f"Unable to parse response. Original response: {str_line}")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue