Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions server/src/flowforge_server/services/ai.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import redis.asyncio as redis
from pydantic import BaseModel

from flowforge_server.config import get_settings

# Lazy-load litellm so the server process (which never calls AI) doesn't pay the
# ~100MB import cost. The executor loads it on first use and it stays cached.
_litellm: Any = None
Expand All @@ -27,8 +29,6 @@ def _get_litellm() -> Any:
_litellm = _mod
return _litellm

from flowforge_server.config import get_settings

if TYPE_CHECKING:
from sqlalchemy.ext.asyncio import AsyncSession

Expand Down Expand Up @@ -637,7 +637,7 @@ async def complete_stream(
if tool_choice != "auto":
completion_params["tool_choice"] = tool_choice

response = await litellm.acompletion(**completion_params)
response = await _get_litellm().acompletion(**completion_params)

# Track accumulated data
accumulated_content = ""
Expand Down
Loading