Skip to content

[Feature]: Improve import speed #7605

@lsorber

Description

@lsorber

The Feature

Simply importing LiteLLM can take up to 1 second, which is rather slow. Could the import speed be improved?

Minimal reproducible example:

uv run --python 3.10 --with litellm python -X importtime -c "import litellm"

Output:

import time: self [us] | cumulative | imported package
...
import time:    353694 |    1098960 | litellm

From the logs, you can see that litellm.utils already takes 250ms to load for example.

Motivation, pitch

If a project has 3 such dependencies, it would take 3 seconds to import that project.

Are you a ML Ops Team?

No

Twitter / LinkedIn details

@laurentsorber

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions