Implement logging strategy (#444)

* Logging strategy and convert all prints() to logging invocations
This commit is contained in:
cybermaggedon 2025-07-30 23:18:38 +01:00 committed by GitHub
parent 3e0651222b
commit dd70aade11
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
117 changed files with 1216 additions and 667 deletions

View file

@ -4,10 +4,14 @@ Embeddings service, applies an embeddings model selected from HuggingFace.
Input is text, output is embeddings vector.
"""
import logging
from ... base import EmbeddingsService
from langchain_huggingface import HuggingFaceEmbeddings
# Module logger
logger = logging.getLogger(__name__)
default_ident = "embeddings"
default_model="all-MiniLM-L6-v2"
@ -22,13 +26,13 @@ class Processor(EmbeddingsService):
**params | { "model": model }
)
print("Get model...", flush=True)
logger.info(f"Loading HuggingFace embeddings model: {model}")
self.embeddings = HuggingFaceEmbeddings(model_name=model)
async def on_embeddings(self, text):
embeds = self.embeddings.embed_documents([text])
print("Done.", flush=True)
logger.debug("Embeddings generation complete")
return embeds
@staticmethod