reduce import time by 6x (#1396)

* reduce import by 6x

* fix linting
This commit is contained in:
Brandon Hancock (bhancock_ai)
2024-10-06 16:55:32 -04:00
committed by GitHub
parent 0dfe3bcb0a
commit 5d8f8cbc79
7 changed files with 43 additions and 29 deletions

View File

@@ -1,8 +1,5 @@
from typing import Any, Optional, Type
import instructor
from litellm import completion
class InternalInstructor:
"""Class that wraps an agent llm with instructor."""
@@ -28,6 +25,10 @@ class InternalInstructor:
if self.agent and not self.llm:
self.llm = self.agent.function_calling_llm or self.agent.llm
# Lazy import
import instructor
from litellm import completion
self._client = instructor.from_litellm(
completion,
mode=instructor.Mode.TOOLS,

View File

@@ -1,4 +1,5 @@
from litellm.integrations.custom_logger import CustomLogger
from crewai.agents.agent_builder.utilities.base_token_process import TokenProcess