docs(fix): fixed warnings from griffe (#3381)

# Description

Please include a summary of the changes and the related issue. Please
also include relevant motivation and context.

## Checklist before requesting a review

Please delete options that are not relevant.

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my code
- [ ] I have commented hard-to-understand areas
- [ ] I have ideally added tests that prove my fix is effective or that
my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged

## Screenshots (if appropriate):
This commit is contained in:
Stan Girard 2024-10-16 11:48:33 +02:00 committed by GitHub
parent 029625e322
commit 1a3879839a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 7 additions and 9 deletions

1
.gitignore vendored
View File

@ -103,3 +103,4 @@ backend/core/examples/chatbot/.chainlit/translations/en-US.json
.tox
Pipfile
*.pkl
backend/docs/site/*

View File

@ -2,6 +2,7 @@ from pathlib import Path
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.

View File

@ -217,7 +217,7 @@ class Brain:
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 @@ class Brain:
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.

View File

@ -30,7 +30,7 @@ class ChatHistory:
# 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.

View File

@ -255,8 +255,6 @@ class LLMEndpointConfig(QuivrBaseConfig):
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()

View File

@ -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/"]