Skip to content
Open
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: 2 additions & 4 deletions src/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@

from typing import Optional

from llama_stack.distribution.library_client import (
AsyncLlamaStackAsLibraryClient, # type: ignore
LlamaStackAsLibraryClient, # type: ignore
)
from llama_stack_client import AsyncLlamaStackClient, LlamaStackClient # type: ignore
from models.config import LLamaStackConfiguration
from utils.types import Singleton
Expand All @@ -26,6 +22,7 @@ def load(self, llama_stack_config: LLamaStackConfiguration) -> None:
if llama_stack_config.use_as_library_client is True:
if llama_stack_config.library_client_config_path is not None:
logger.info("Using Llama stack as library client")
from llama_stack.distribution.library_client import LlamaStackAsLibraryClient # type: ignore
client = LlamaStackAsLibraryClient(
llama_stack_config.library_client_config_path
)
Comment on lines 24 to 28
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Fold long import and document the deliberate late import

The inner import fixes the logging bug, but the line exceeds 100 chars and still raises import-outside-toplevel. Break it and add an explicit pragma.

-                from llama_stack.distribution.library_client import LlamaStackAsLibraryClient  # type: ignore
+# pylint: disable=import-outside-toplevel
+                from llama_stack.distribution.library_client import (
+                    LlamaStackAsLibraryClient,
+                )  # type: ignore
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
logger.info("Using Llama stack as library client")
from llama_stack.distribution.library_client import LlamaStackAsLibraryClient # type: ignore
client = LlamaStackAsLibraryClient(
llama_stack_config.library_client_config_path
)
logger.info("Using Llama stack as library client")
# pylint: disable=import-outside-toplevel
from llama_stack.distribution.library_client import (
LlamaStackAsLibraryClient,
) # type: ignore
client = LlamaStackAsLibraryClient(
llama_stack_config.library_client_config_path
)
🧰 Tools
🪛 GitHub Actions: Python linter

[warning] 25-25: pylint: Line too long (109/100) (line-too-long)


[warning] 25-25: pylint: Import outside toplevel (llama_stack.distribution.library_client.LlamaStackAsLibraryClient) (import-outside-toplevel)

🤖 Prompt for AI Agents
In src/client.py around lines 24 to 28, the import statement inside the function
is too long and triggers an import-outside-toplevel warning. Break the import
into multiple lines to keep it under 100 characters and add a comment with a
pragma to explicitly ignore the import-outside-toplevel warning, documenting
that the late import is deliberate to fix the logging bug.

Expand Down Expand Up @@ -62,6 +59,7 @@ async def load(self, llama_stack_config: LLamaStackConfiguration) -> None:
if llama_stack_config.use_as_library_client is True:
if llama_stack_config.library_client_config_path is not None:
logger.info("Using Llama stack as library client")
from llama_stack.distribution.library_client import AsyncLlamaStackAsLibraryClient # type: ignore
client = AsyncLlamaStackAsLibraryClient(
llama_stack_config.library_client_config_path
)
Expand Down
Loading