What happened?
I've encountered a ModuleNotFoundError for fastapi when using what appears to be a core function of the litellm library.
It seems that some modules within the core library have a dependency on fastapi, but fastapi is not included as a core dependency of the package. This dependency seems to be required even when not using the proxy features, causing a crash in standard library usage.
I found the issue in v1.80.10, but I think the error occurred in v1.80.5 when update_responses_input_with_model_file_ids was added to the response() function.
When installing with the existing Python SDK, fastapi is optional and will not be installed.
Relevant log output
### Traceback
Traceback (most recent call last):
File "<venv>/lib/python3.12/site-packages/litellm/responses/main.py", line 584, in responses
input = cast(Union[str, ResponseInputParam], update_responses_input_with_model_file_ids(input=input))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<venv>/lib/python3.12/site-packages/litellm/litellm_core_utils/prompt_templates/common_utils.py", line 450, in update_responses_input_with_model_file_ids
from litellm.proxy.openai_files_endpoints.common_utils import (
File "<venv>/lib/python3.12/site-packages/litellm/proxy/openai_files_endpoints/common_utils.py", line 7, in <module>
from fastapi import Request
ModuleNotFoundError: No module named 'fastapi'
`
### Root Cause
The file litellm/proxy/openai_files_endpoints/common_utils.py imports fastapi at the module level:
from fastapi import Request # Line 7
This module is imported by litellm/litellm_core_utils/prompt_templates/common_utils.py (line 450) during the execution of responses(), which is a core function that should work without proxy dependencies.
What part of LiteLLM is this about?
SDK (litellm Python package)
What LiteLLM version are you on ?
v1.80.10
Twitter / LinkedIn details
No response
What happened?
I've encountered a ModuleNotFoundError for fastapi when using what appears to be a core function of the litellm library.
It seems that some modules within the core library have a dependency on fastapi, but fastapi is not included as a core dependency of the package. This dependency seems to be required even when not using the
proxyfeatures, causing a crash in standard library usage.I found the issue in v1.80.10, but I think the error occurred in v1.80.5 when update_responses_input_with_model_file_ids was added to the response() function.
When installing with the existing Python SDK, fastapi is optional and will not be installed.
Relevant log output
What part of LiteLLM is this about?
SDK (litellm Python package)
What LiteLLM version are you on ?
v1.80.10
Twitter / LinkedIn details
No response