Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix: Convert object to a correct type (#15634)

Lucas Sugibe8854f62ebf
diff --git a/litellm/files/main.py b/litellm/files/main.py
index 7bc2c136726..9c85fa10565 100644
--- a/litellm/files/main.py
+++ b/litellm/files/main.py
@@ -276,7 +276,7 @@ async def afile_retrieve(
extra_headers: Optional[Dict[str, str]] = None,
extra_body: Optional[Dict[str, str]] = None,
**kwargs,
-):
+) -> OpenAIFileObject:
"""
Async: Get file contents
@@ -305,7 +305,7 @@ async def afile_retrieve(
else:
response = init_response
- return response
+ return OpenAIFileObject(**response.model_dump())
except Exception as e:
raise e
@@ -419,6 +419,7 @@ def file_retrieve(
request=httpx.Request(method="create_thread", url="https://github.com/BerriAI/litellm"), # type: ignore
),
)
+
return cast(FileObject, response)
except Exception as e:
raise e