fix: make docker compose build and start the API
The image context was backend/, so COPY frontend/ failed. Build from the repo root, place Python modules on the import path, and pin packages that exist on PyPI. The web process no longer loads the LLM at startup.
This commit is contained in:
1 parent
67739dcf7e
commit
7af7ba530d
19 files changed
+342
-250
No files matched your search
@@ -0,0 +1,19 @@
|
||||
from sentence_transformers import SentenceTransformer
|
||||
import numpy as np
|
||||
|
||||
class EmbeddingService:
|
||||
def __init__(self, model_name="all-MiniLM-L6-v2"):
|
||||
self.model = SentenceTransformer(model_name)
|
||||
self.dimension = 384
|
||||
|
||||
def embed(self, texts: list[str]) -> np.ndarray:
|
||||
"""Generate embeddings for a list of texts."""
|
||||
return self.model.encode(texts, convert_to_numpy=True)
|
||||
|
||||
def embed_query(self, text: str) -> np.ndarray:
|
||||
"""Generate embedding for a single query."""
|
||||
return self.model.encode([text], convert_to_numpy=True)[0]
|
||||
|
||||
def get_dimension(self) -> int:
|
||||
"""Return embedding dimension."""
|
||||
return self.dimension
|
||||
Reference in new issue
Block a user