Skip to content

Commit d282e7e

Browse files
fix: handle non-str case
1 parent f0f84d6 commit d282e7e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

litellm/llms/ollama/completion/transformation.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,8 +331,10 @@ def transform_response(
331331
response_text = response_json.get("response", "")
332332
content = None
333333
reasoning_content = None
334-
if response_text is not None:
334+
if response_text is not None and isinstance(response_text, str):
335335
reasoning_content, content = _parse_content_for_reasoning(response_text)
336+
else:
337+
content = response_text # type: ignore
336338
model_response.choices[0].message.content = content # type: ignore
337339
model_response.choices[0].message.reasoning_content = reasoning_content # type: ignore
338340
model_response.created = int(time.time())

0 commit comments

Comments
 (0)