From 8c535c6eedf347e1b7bba40f3ac5993d7920b527 Mon Sep 17 00:00:00 2001 From: Pavel Tisnovsky Date: Mon, 2 Dec 2024 08:56:43 +0100 Subject: [PATCH] Added missing types Signed-off-by: Pavel Tisnovsky --- ols/src/rag_index/index_loader.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ols/src/rag_index/index_loader.py b/ols/src/rag_index/index_loader.py index 8595788d..c31fed8e 100644 --- a/ols/src/rag_index/index_loader.py +++ b/ols/src/rag_index/index_loader.py @@ -2,7 +2,7 @@ """Module for loading index.""" import logging -from typing import Optional +from typing import Any, Optional from ols.app.models.config import ReferenceContent @@ -14,7 +14,7 @@ # we load it only when it is required. # As these dependencies are lazily loaded, we can't use them in type hints. # So this module is excluded from mypy checks as a whole. -def load_llama_index_deps(): +def load_llama_index_deps() -> None: """Load llama_index dependencies.""" global Settings global StorageContext @@ -51,7 +51,7 @@ def __init__(self, index_config: Optional[ReferenceContent]) -> None: self._embed_model = self._get_embed_model() self._load_index() - def _get_embed_model(self): + def _get_embed_model(self) -> Any: """Get embed model according to configuration.""" if self._embed_model_path is not None: from llama_index.embeddings.huggingface import HuggingFaceEmbedding @@ -95,7 +95,7 @@ def _load_index(self) -> None: logger.exception(f"Error loading vector index:\n{err}") @property - def vector_index(self): + def vector_index(self) -> Optional[ReferenceContent]: """Get index.""" if self._index is None: logger.warning(