Skip to content

[Bug]: FastAPI is required when not using litellm proxy and using Langfuse #5204

Description

@mumumumu

What happened?

I'm using the LiteLLM Python SDK to integrate with Langfuse and I'm seeing an import error after recently bumping from version 1.37.9 to 1.43.10.

Based on the traceback, I believe it's due to this import.

Is this import necessary for people that aren't using the LiteLLM Proxy Server?

Relevant log output

web-1       | Traceback (most recent call last):
web-1       |   File "/usr/local/lib/python3.12/site-packages/litellm/integrations/langfuse.py", line 523, in _log_langfuse_v2
web-1       |     log_provider_specific_information_as_span(trace, clean_metadata)
web-1       |   File "/usr/local/lib/python3.12/site-packages/litellm/integrations/langfuse.py", line 679, in log_provider_specific_information_as_span
web-1       |     from litellm.proxy.proxy_server import premium_user
web-1       |   File "/usr/local/lib/python3.12/site-packages/litellm/proxy/proxy_server.py", line 54, in <module>
web-1       |     raise ImportError(f"Missing dependency {e}. Run `pip install 'litellm[proxy]'`")
web-1       | ImportError: Missing dependency No module named 'orjson'. Run `pip install 'litellm[proxy]'`
web-1       |
web-1       | [14/Aug/2024 14:34:02] ERROR LiteLLM - Langfuse Layer Error - Traceback (most recent call last):
web-1       |   File "/usr/local/lib/python3.12/site-packages/litellm/proxy/proxy_server.py", line 50, in <module>
web-1       |     import orjson
web-1       | ModuleNotFoundError: No module named 'orjson'
web-1       |
web-1       | During handling of the above exception, another exception occurred:
web-1       |
web-1       | Traceback (most recent call last):
web-1       |   File "/usr/local/lib/python3.12/site-packages/litellm/integrations/langfuse.py", line 523, in _log_langfuse_v2
web-1       |     log_provider_specific_information_as_span(trace, clean_metadata)
web-1       |   File "/usr/local/lib/python3.12/site-packages/litellm/integrations/langfuse.py", line 679, in log_provider_specific_information_as_span
web-1       |     from litellm.proxy.proxy_server import premium_user
web-1       |   File "/usr/local/lib/python3.12/site-packages/litellm/proxy/proxy_server.py", line 54, in <module>
web-1       |     raise ImportError(f"Missing dependency {e}. Run `pip install 'litellm[proxy]'`")
web-1       | ImportError: Missing dependency No module named 'orjson'. Run `pip install 'litellm[proxy]'`

Twitter / LinkedIn details

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions