diff --git a/litellm/llms/ollama.py b/litellm/llms/ollama.py index f2a9b0df4d1..e2be1c2d5de 100644 --- a/litellm/llms/ollama.py +++ b/litellm/llms/ollama.py @@ -195,7 +195,7 @@ async def ollama_acompletion(url, data, model_response, encoding, logging_obj): raise OllamaError(status_code=resp.status, message=text) completion_string = "" - async for line in resp.content.iter_any(): + async for line in resp.content: if line: try: json_chunk = line.decode("utf-8") diff --git a/litellm/main.py b/litellm/main.py index 52d2ae5b663..1e2a8323a4c 100644 --- a/litellm/main.py +++ b/litellm/main.py @@ -2026,11 +2026,9 @@ async def atext_completion(*args, **kwargs): response = text_completion(*args, **kwargs) else: # Await normally - init_response = await loop.run_in_executor(None, func_with_context) - if isinstance(init_response, dict) or isinstance(init_response, ModelResponse): ## CACHING SCENARIO - response = init_response - elif asyncio.iscoroutine(init_response): - response = await init_response + response = await loop.run_in_executor(None, func_with_context) + if asyncio.iscoroutine(response): + response = await response else: # Call the synchronous function using run_in_executor response = await loop.run_in_executor(None, func_with_context)