Skip to content

Commit

Permalink
Added missing types
Browse files Browse the repository at this point in the history
Signed-off-by: Pavel Tisnovsky <[email protected]>
  • Loading branch information
tisnik committed Dec 2, 2024
1 parent ab05cf0 commit 8c535c6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ols/src/rag_index/index_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 8c535c6

Please sign in to comment.