Spaces:
Runtime error
Runtime error
successfully created post request for query
Browse files- backend/__pycache__/main.cpython-313.pyc +0 -0
- backend/main.py +21 -0
- backend/models/__pycache__/schemas.cpython-313.pyc +0 -0
- backend/models/schemas.py +2 -2
- backend/routes/__pycache__/query.cpython-313.pyc +0 -0
- rag_pipeline/eval_ragas/__pycache__/metrics.cpython-313.pyc +0 -0
- rag_pipeline/generation/__pycache__/generate.cpython-313.pyc +0 -0
- rag_pipeline/reranking/__pycache__/rerank.cpython-313.pyc +0 -0
- rag_pipeline/retrieval/__pycache__/bm25.cpython-313.pyc +0 -0
- rag_pipeline/retrieval/__pycache__/hybrid.cpython-313.pyc +0 -0
- rag_pipeline/retrieval/__pycache__/semantic.cpython-313.pyc +0 -0
backend/__pycache__/main.cpython-313.pyc
ADDED
|
Binary file (1.35 kB). View file
|
|
|
backend/main.py
CHANGED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastapi import FastAPI
|
| 2 |
+
from rag_pipeline.app import Pipeline
|
| 3 |
+
from fastapi.middleware.cors import CORSMiddleware
|
| 4 |
+
from contextlib import asynccontextmanager
|
| 5 |
+
from backend.routes.query import router
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
@asynccontextmanager
|
| 9 |
+
async def lifespan(app: FastAPI):
|
| 10 |
+
print("RAG pipeline loading")
|
| 11 |
+
app.state.pipe = Pipeline()
|
| 12 |
+
print("RAG loaded..")
|
| 13 |
+
yield
|
| 14 |
+
print("RAG stopped")
|
| 15 |
+
app = FastAPI(title="RAG API",version="1.0.0",lifespan=lifespan)
|
| 16 |
+
app.add_middleware(CORSMiddleware,allow_origins=["*"],allow_credentials=True,allow_methods=["*"],allow_headers=["*"])
|
| 17 |
+
app.include_router(router)
|
| 18 |
+
|
| 19 |
+
@app.get("/")
|
| 20 |
+
def root():
|
| 21 |
+
return {"message":"RAG API running successfully"}
|
backend/models/__pycache__/schemas.cpython-313.pyc
ADDED
|
Binary file (1.07 kB). View file
|
|
|
backend/models/schemas.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
from pydantic import BaseModel
|
| 2 |
-
|
| 3 |
#Validation for the user request
|
| 4 |
class QueryRequest(BaseModel):
|
| 5 |
query: str
|
|
@@ -17,5 +17,5 @@ class QueryResponse(BaseModel):
|
|
| 17 |
grade : str
|
| 18 |
retrieval_failed : bool
|
| 19 |
attempts : list
|
| 20 |
-
sources : dict
|
| 21 |
|
|
|
|
| 1 |
from pydantic import BaseModel
|
| 2 |
+
from typing import Any
|
| 3 |
#Validation for the user request
|
| 4 |
class QueryRequest(BaseModel):
|
| 5 |
query: str
|
|
|
|
| 17 |
grade : str
|
| 18 |
retrieval_failed : bool
|
| 19 |
attempts : list
|
| 20 |
+
sources : list[dict[str, Any]]
|
| 21 |
|
backend/routes/__pycache__/query.cpython-313.pyc
ADDED
|
Binary file (876 Bytes). View file
|
|
|
rag_pipeline/eval_ragas/__pycache__/metrics.cpython-313.pyc
CHANGED
|
Binary files a/rag_pipeline/eval_ragas/__pycache__/metrics.cpython-313.pyc and b/rag_pipeline/eval_ragas/__pycache__/metrics.cpython-313.pyc differ
|
|
|
rag_pipeline/generation/__pycache__/generate.cpython-313.pyc
CHANGED
|
Binary files a/rag_pipeline/generation/__pycache__/generate.cpython-313.pyc and b/rag_pipeline/generation/__pycache__/generate.cpython-313.pyc differ
|
|
|
rag_pipeline/reranking/__pycache__/rerank.cpython-313.pyc
CHANGED
|
Binary files a/rag_pipeline/reranking/__pycache__/rerank.cpython-313.pyc and b/rag_pipeline/reranking/__pycache__/rerank.cpython-313.pyc differ
|
|
|
rag_pipeline/retrieval/__pycache__/bm25.cpython-313.pyc
CHANGED
|
Binary files a/rag_pipeline/retrieval/__pycache__/bm25.cpython-313.pyc and b/rag_pipeline/retrieval/__pycache__/bm25.cpython-313.pyc differ
|
|
|
rag_pipeline/retrieval/__pycache__/hybrid.cpython-313.pyc
CHANGED
|
Binary files a/rag_pipeline/retrieval/__pycache__/hybrid.cpython-313.pyc and b/rag_pipeline/retrieval/__pycache__/hybrid.cpython-313.pyc differ
|
|
|
rag_pipeline/retrieval/__pycache__/semantic.cpython-313.pyc
CHANGED
|
Binary files a/rag_pipeline/retrieval/__pycache__/semantic.cpython-313.pyc and b/rag_pipeline/retrieval/__pycache__/semantic.cpython-313.pyc differ
|
|
|