From 69d90b5436524ea3cf4206274731d8c9989008f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patryk=20Wy=C5=BCgowski?= Date: Wed, 11 Sep 2024 10:22:21 +0200 Subject: [PATCH] Fix pylint and mypy errors. --- .github/workflows/ci.yml | 2 +- .../src/ragnarok_common/embeddings/litellm.py | 3 +-- .../ragnarok-dev-kit/src/ragnarok_dev_kit/app/main.py | 8 ++++---- .../src/ragnarok_dev_kit/discovery/prompt_discovery.py | 1 - 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fe1de654..3ea6ddf7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -141,7 +141,7 @@ jobs: run: | # run with coverage to not execute tests twice source venv/bin/activate - coverage run -m pytest -v -p no:warnings --junitxml=report.xml + coverage run -m pytest -v -p no:warnings --junitxml=report.xml coverage report coverage xml diff --git a/packages/ragnarok-common/src/ragnarok_common/embeddings/litellm.py b/packages/ragnarok-common/src/ragnarok_common/embeddings/litellm.py index d1821e45..4a8654fc 100644 --- a/packages/ragnarok-common/src/ragnarok_common/embeddings/litellm.py +++ b/packages/ragnarok-common/src/ragnarok_common/embeddings/litellm.py @@ -1,7 +1,5 @@ from typing import Optional -from ragnarok_common.embeddings.exceptions import EmbeddingConnectionError, EmbeddingStatusError, EmbeddingResponseError - try: import litellm @@ -10,6 +8,7 @@ HAS_LITELLM = False from ragnarok_common.embeddings.base import Embeddings +from ragnarok_common.embeddings.exceptions import EmbeddingConnectionError, EmbeddingResponseError, EmbeddingStatusError class LiteLLMEmbeddings(Embeddings): diff --git a/packages/ragnarok-dev-kit/src/ragnarok_dev_kit/app/main.py b/packages/ragnarok-dev-kit/src/ragnarok_dev_kit/app/main.py index 050eac08..292ec980 100644 --- a/packages/ragnarok-dev-kit/src/ragnarok_dev_kit/app/main.py +++ b/packages/ragnarok-dev-kit/src/ragnarok_dev_kit/app/main.py @@ -5,10 +5,10 @@ import jinja2 import typer from pydantic import BaseModel +from ragnarok_dev_kit.discovery.prompt_discovery import PromptDiscovery from ragnarok_common.llms import LiteLLM from ragnarok_common.llms.clients import LiteLLMOptions -from ragnarok_dev_kit.discovery.prompt_discovery import PromptDiscovery class PromptState: @@ -26,7 +26,7 @@ class PromptState: "Render Prompt" button and reflects in the "Rendered Prompt" field. It is used for communication with the LLM. llm_model_name (str): The name of the selected LLM model. - llm_api_key (str): The API key for the chosen LLM model. + llm_api_key (str | None): The API key for the chosen LLM model. temp_field_name (str): Temporary field name used internally. """ @@ -35,7 +35,7 @@ class PromptState: dynamic_tb: dict = {} current_prompt = None llm_model_name: str = "" - llm_api_key: str = "" + llm_api_key: str | None = "" temp_field_name: str = "" @@ -170,7 +170,7 @@ def get_input_type_fields(obj: BaseModel) -> list[dict]: @typer_app.command() -def run_app(prompts_paths: str, llm_model: str, llm_api_key: str = None) -> None: +def run_app(prompts_paths: str, llm_model: str, llm_api_key: str | None = None) -> None: """ Launches the interactive application for working with Large Language Models (LLMs). diff --git a/packages/ragnarok-dev-kit/src/ragnarok_dev_kit/discovery/prompt_discovery.py b/packages/ragnarok-dev-kit/src/ragnarok_dev_kit/discovery/prompt_discovery.py index 5a85ff96..5353ac3d 100644 --- a/packages/ragnarok-dev-kit/src/ragnarok_dev_kit/discovery/prompt_discovery.py +++ b/packages/ragnarok-dev-kit/src/ragnarok_dev_kit/discovery/prompt_discovery.py @@ -92,4 +92,3 @@ def discover(self) -> dict: )._asdict() return result_dict -