added updates geneseek
Browse files- data/ingested_hashes.txt +5 -0
- eval.py +2 -0
- main.py +1 -0
- run_ingest_all.py +11 -0
data/ingested_hashes.txt
CHANGED
|
@@ -1 +1,6 @@
|
|
| 1 |
5db83d178bdb1dfa9ffa7a8f0d45be91
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
5db83d178bdb1dfa9ffa7a8f0d45be91
|
| 2 |
+
99c5e9c29163c23a553ef99db781173f
|
| 3 |
+
bd55faa478dc3a25a6cde772d66cb61f
|
| 4 |
+
ec5d37f6f9c7551c9846d7cab7addaa4
|
| 5 |
+
a5d52faacf5282017118299ca768662a
|
| 6 |
+
325adbda069e9b52dcb6fc830c85f430
|
eval.py
CHANGED
|
@@ -3,6 +3,7 @@ from datasets import Dataset
|
|
| 3 |
from ragas import evaluate
|
| 4 |
from ragas.llms import LangchainLLMWrapper
|
| 5 |
from ragas.embeddings import LangchainEmbeddingsWrapper
|
|
|
|
| 6 |
from ragas.metrics import (
|
| 7 |
faithfulness,
|
| 8 |
answer_relevancy,
|
|
@@ -137,6 +138,7 @@ def run_evaluation():
|
|
| 137 |
metrics=[faithfulness, answer_relevancy, context_precision, context_recall],
|
| 138 |
llm=evaluator_llm,
|
| 139 |
embeddings=evaluator_embeddings,
|
|
|
|
| 140 |
)
|
| 141 |
|
| 142 |
print("\nEvaluation Scores:")
|
|
|
|
| 3 |
from ragas import evaluate
|
| 4 |
from ragas.llms import LangchainLLMWrapper
|
| 5 |
from ragas.embeddings import LangchainEmbeddingsWrapper
|
| 6 |
+
from ragas.run_config import RunConfig
|
| 7 |
from ragas.metrics import (
|
| 8 |
faithfulness,
|
| 9 |
answer_relevancy,
|
|
|
|
| 138 |
metrics=[faithfulness, answer_relevancy, context_precision, context_recall],
|
| 139 |
llm=evaluator_llm,
|
| 140 |
embeddings=evaluator_embeddings,
|
| 141 |
+
run_config=RunConfig(timeout=120, max_workers=4)
|
| 142 |
)
|
| 143 |
|
| 144 |
print("\nEvaluation Scores:")
|
main.py
CHANGED
|
@@ -69,6 +69,7 @@ async def upload_document(file: UploadFile = File(...)):
|
|
| 69 |
|
| 70 |
@app.post("/chat", response_model=ChatResponse)
|
| 71 |
async def chat_endpoint(request: ChatRequest):
|
|
|
|
| 72 |
if rag_chain is None:
|
| 73 |
raise HTTPException(503, "No documents ingested yet. Please upload a file first.")
|
| 74 |
try:
|
|
|
|
| 69 |
|
| 70 |
@app.post("/chat", response_model=ChatResponse)
|
| 71 |
async def chat_endpoint(request: ChatRequest):
|
| 72 |
+
global rag_chain
|
| 73 |
if rag_chain is None:
|
| 74 |
raise HTTPException(503, "No documents ingested yet. Please upload a file first.")
|
| 75 |
try:
|
run_ingest_all.py
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# run_ingest_all.py (place in root)
|
| 2 |
+
from src.ingest import ingest_file
|
| 3 |
+
from src import config
|
| 4 |
+
import os
|
| 5 |
+
|
| 6 |
+
for fname in os.listdir(config.RAW_DATA_DIR):
|
| 7 |
+
fpath = str(config.RAW_DATA_DIR / fname)
|
| 8 |
+
print(f"Ingesting: {fname}")
|
| 9 |
+
ingest_file(fpath)
|
| 10 |
+
|
| 11 |
+
config.qdrant_client.close()
|