Skip to content

Commit

Permalink
Delay LiteLLM import to improve speed on decompiler init
Browse files Browse the repository at this point in the history
  • Loading branch information
mahaloz committed Aug 26, 2024
1 parent c8ddbd7 commit 86d0db2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dailalib/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "3.4.4"
__version__ = "3.4.5"

from .api import AIAPI, LiteLLMAIAPI
from libbs.api import DecompilerInterface
Expand Down
4 changes: 3 additions & 1 deletion dailalib/api/litellm/litellm_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from typing import Optional
import os

from litellm import completion
import tiktoken

from ..ai_api import AIAPI
Expand Down Expand Up @@ -52,6 +51,9 @@ def query_model(
model: Optional[str] = None,
max_tokens=None,
):
# delay import because litellm attempts to query the server on import to collect cost information.
from litellm import completion

if not self.api_key:
raise ValueError(f"Model API key is not set. Please set it before querying the model {self.model}")

Expand Down

0 comments on commit 86d0db2

Please sign in to comment.