mirror of
https://github.com/aljazceru/enclava.git
synced 2025-12-17 15:34:36 +01:00
adding ollama embeddings and expanding to metadata search
This commit is contained in:
@@ -19,8 +19,8 @@ class EmbeddingService:
|
||||
"""Service for generating text embeddings using a local transformer model"""
|
||||
|
||||
def __init__(self, model_name: Optional[str] = None):
|
||||
self.model_name = model_name or getattr(settings, "RAG_EMBEDDING_MODEL", "BAAI/bge-small-en")
|
||||
self.dimension = 384 # bge-small produces 384-d vectors
|
||||
self.model_name = model_name or getattr(settings, "RAG_EMBEDDING_MODEL", "BAAI/bge-m3")
|
||||
self.dimension = 1024 # bge-m3 produces 1024-d vectors
|
||||
self.initialized = False
|
||||
self.local_model = None
|
||||
self.backend = "uninitialized"
|
||||
@@ -127,7 +127,7 @@ class EmbeddingService:
|
||||
|
||||
def _generate_fallback_embedding(self, text: str) -> List[float]:
|
||||
"""Generate a single fallback embedding"""
|
||||
dimension = self.dimension or 384
|
||||
dimension = self.dimension or 1024
|
||||
# Use hash for reproducible random embeddings
|
||||
np.random.seed(hash(text) % 2**32)
|
||||
return np.random.random(dimension).tolist()
|
||||
|
||||
Reference in New Issue
Block a user