Spaces:
Sleeping
Sleeping
feat: chunking retrieval updated
Browse files- requirements.txt +1 -1
- src/chatbot/embedding.py +3 -3
- src/chatbot/schemas.py +1 -1
- src/chatbot/service.py +1 -1
- src/main.py +0 -4
requirements.txt
CHANGED
|
@@ -29,7 +29,7 @@ idna==3.11
|
|
| 29 |
Mako==1.3.10
|
| 30 |
MarkupSafe==3.0.3
|
| 31 |
mpmath==1.3.0
|
| 32 |
-
numpy==2.
|
| 33 |
onnxruntime==1.23.2
|
| 34 |
packaging==25.0
|
| 35 |
passlib==1.7.4
|
|
|
|
| 29 |
Mako==1.3.10
|
| 30 |
MarkupSafe==3.0.3
|
| 31 |
mpmath==1.3.0
|
| 32 |
+
numpy==2.2.6
|
| 33 |
onnxruntime==1.23.2
|
| 34 |
packaging==25.0
|
| 35 |
passlib==1.7.4
|
src/chatbot/embedding.py
CHANGED
|
@@ -9,10 +9,10 @@ MODEL_ID = "onnx-community/embeddinggemma-300m-ONNX"
|
|
| 9 |
|
| 10 |
class EmbeddingModel:
|
| 11 |
def __init__(self):
|
| 12 |
-
print("
|
| 13 |
self.tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
|
| 14 |
|
| 15 |
-
print("
|
| 16 |
|
| 17 |
self.model_path = hf_hub_download(
|
| 18 |
repo_id=MODEL_ID,
|
|
@@ -25,7 +25,7 @@ class EmbeddingModel:
|
|
| 25 |
|
| 26 |
model_dir = os.path.dirname(self.model_path)
|
| 27 |
|
| 28 |
-
print("
|
| 29 |
self.session = ort.InferenceSession(
|
| 30 |
self.model_path,
|
| 31 |
providers=["CPUExecutionProvider"],
|
|
|
|
| 9 |
|
| 10 |
class EmbeddingModel:
|
| 11 |
def __init__(self):
|
| 12 |
+
print("Loading tokenizer…")
|
| 13 |
self.tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
|
| 14 |
|
| 15 |
+
print("Downloading ONNX model files…")
|
| 16 |
|
| 17 |
self.model_path = hf_hub_download(
|
| 18 |
repo_id=MODEL_ID,
|
|
|
|
| 25 |
|
| 26 |
model_dir = os.path.dirname(self.model_path)
|
| 27 |
|
| 28 |
+
print("Creating inference session…")
|
| 29 |
self.session = ort.InferenceSession(
|
| 30 |
self.model_path,
|
| 31 |
providers=["CPUExecutionProvider"],
|
src/chatbot/schemas.py
CHANGED
|
@@ -37,4 +37,4 @@ class SemanticSearchResult(BaseModel):
|
|
| 37 |
|
| 38 |
class ManualTextRequest(BaseModel):
|
| 39 |
kb_id: uuid.UUID
|
| 40 |
-
text: str
|
|
|
|
| 37 |
|
| 38 |
class ManualTextRequest(BaseModel):
|
| 39 |
kb_id: uuid.UUID
|
| 40 |
+
text: str
|
src/chatbot/service.py
CHANGED
|
@@ -68,4 +68,4 @@ async def store_manual_text(kb_id: UUID, text: str, session: AsyncSession):
|
|
| 68 |
"chunk_index": next_index,
|
| 69 |
"status": "stored",
|
| 70 |
"text": text
|
| 71 |
-
}
|
|
|
|
| 68 |
"chunk_index": next_index,
|
| 69 |
"status": "stored",
|
| 70 |
"text": text
|
| 71 |
+
}
|
src/main.py
CHANGED
|
@@ -19,10 +19,6 @@ app.include_router(auth_router)
|
|
| 19 |
|
| 20 |
app.include_router(profile)
|
| 21 |
|
| 22 |
-
# app.include_router(assets)
|
| 23 |
-
|
| 24 |
-
# app.include_router(leave)
|
| 25 |
-
|
| 26 |
app.include_router(chatbot)
|
| 27 |
|
| 28 |
|
|
|
|
| 19 |
|
| 20 |
app.include_router(profile)
|
| 21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
app.include_router(chatbot)
|
| 23 |
|
| 24 |
|