From 75aee902b646bcdfbf53478c846cdb196c68ee65 Mon Sep 17 00:00:00 2001 From: Stan Girard Date: Wed, 16 Oct 2024 11:44:55 +0200 Subject: [PATCH] docs(fix): fixed warnings from griffe --- .gitignore | 1 + backend/core/quivr_core/base_config.py | 3 ++- backend/core/quivr_core/brain/brain.py | 4 ++-- backend/core/quivr_core/chat.py | 2 +- backend/core/quivr_core/config.py | 5 ----- backend/docs/pyproject.toml | 1 + 6 files changed, 7 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 89fbda293a27..ce5464783f76 100644 --- a/.gitignore +++ b/.gitignore @@ -103,3 +103,4 @@ backend/core/examples/chatbot/.chainlit/translations/en-US.json .tox Pipfile *.pkl +backend/docs/site/* diff --git a/backend/core/quivr_core/base_config.py b/backend/core/quivr_core/base_config.py index 7d7bc816380d..694076021538 100644 --- a/backend/core/quivr_core/base_config.py +++ b/backend/core/quivr_core/base_config.py @@ -2,6 +2,7 @@ import yaml from pydantic import BaseModel, ConfigDict +from typing import Self class QuivrBaseConfig(BaseModel): @@ -23,7 +24,7 @@ class QuivrBaseConfig(BaseModel): model_config = ConfigDict(extra="forbid") @classmethod - def from_yaml(cls, file_path: str | Path): + def from_yaml(cls, file_path: str | Path) -> Self: """ Create an instance of the class from a YAML file. diff --git a/backend/core/quivr_core/brain/brain.py b/backend/core/quivr_core/brain/brain.py index 50f20123f8fa..53eb6c6d7142 100644 --- a/backend/core/quivr_core/brain/brain.py +++ b/backend/core/quivr_core/brain/brain.py @@ -217,7 +217,7 @@ def load(cls, folder_path: str | Path) -> Self: vector_db=vector_db, ) - async def save(self, folder_path: str | Path): + async def save(self, folder_path: str | Path) -> str: """ Save the brain to a folder path. @@ -324,7 +324,7 @@ async def afrom_files( embedder: Embeddings | None = None, skip_file_error: bool = False, processor_kwargs: dict[str, Any] | None = None, - ): + ) -> Self: """ Create a brain from a list of file paths. diff --git a/backend/core/quivr_core/chat.py b/backend/core/quivr_core/chat.py index 15da1c05394e..f5ea0692c4f6 100644 --- a/backend/core/quivr_core/chat.py +++ b/backend/core/quivr_core/chat.py @@ -30,7 +30,7 @@ def __init__(self, chat_id: UUID, brain_id: UUID | None) -> None: # TODO(@aminediro): maybe use a deque() instead ? self._msgs: list[ChatMessage] = [] - def get_chat_history(self, newest_first: bool = False): + def get_chat_history(self, newest_first: bool = False) -> List[ChatMessage]: """ Retrieves the chat history, optionally sorted in reverse chronological order. diff --git a/backend/core/quivr_core/config.py b/backend/core/quivr_core/config.py index c1abcc471eb9..25181a40a029 100644 --- a/backend/core/quivr_core/config.py +++ b/backend/core/quivr_core/config.py @@ -255,8 +255,6 @@ def __init__(self, **data): This method sets up the initial configuration, including setting the LLM model config and API key. - Args: - **data: Keyword arguments for initializing the config. """ super().__init__(**data) self.set_llm_model_config() @@ -369,9 +367,6 @@ class RerankerConfig(QuivrBaseConfig): def __init__(self, **data): """ Initialize the RerankerConfig. - - Args: - **data: Keyword arguments for initializing the config. """ super().__init__(**data) self.validate_model() diff --git a/backend/docs/pyproject.toml b/backend/docs/pyproject.toml index 595d7000c0d4..01de36161ab4 100644 --- a/backend/docs/pyproject.toml +++ b/backend/docs/pyproject.toml @@ -31,6 +31,7 @@ venv_sync= "uv pip sync --python ./.venv/bin/python ./requirements.lock" venv_create_sync = {chain = ["venv_create", "venv_sync"]} check_deps = "basedpyright --project ./pyproject.toml" docs = "mkdocs serve" +build_docs = "mkdocs build --strict" [tool.basedpyright] include = ["src/"]