vhr1007
commited on
Commit
·
d343a87
1
Parent(s):
7d54a46
bug
Browse files
app.py
CHANGED
|
@@ -77,7 +77,8 @@ class SearchDocumentsRequest(BaseModel):
|
|
| 77 |
limit: int = 3
|
| 78 |
|
| 79 |
class GenerateRAGRequest(BaseModel):
|
| 80 |
-
|
|
|
|
| 81 |
|
| 82 |
|
| 83 |
@app.get("/")
|
|
@@ -135,8 +136,8 @@ async def generate_rag_response_api(
|
|
| 135 |
logging.info("Starting document search")
|
| 136 |
|
| 137 |
# Encode the query using the custom embedding function
|
| 138 |
-
query_embedding = embed_text(body.
|
| 139 |
-
print(body.
|
| 140 |
collection_name = "embed" # Use the collection name where the embeddings are stored
|
| 141 |
# Perform search using the precomputed embeddings
|
| 142 |
hits, error = searcher.search_documents(collection_name, query_embedding, user_id)
|
|
@@ -148,7 +149,7 @@ async def generate_rag_response_api(
|
|
| 148 |
logging.info("Generating RAG response")
|
| 149 |
|
| 150 |
# Generate the RAG response using the retrieved documents
|
| 151 |
-
response, error = generate_rag_response(hits, body.
|
| 152 |
|
| 153 |
if error:
|
| 154 |
logging.error(f"Generate RAG response error: {error}")
|
|
|
|
| 77 |
limit: int = 3
|
| 78 |
|
| 79 |
class GenerateRAGRequest(BaseModel):
|
| 80 |
+
search_query: str
|
| 81 |
+
|
| 82 |
|
| 83 |
|
| 84 |
@app.get("/")
|
|
|
|
| 136 |
logging.info("Starting document search")
|
| 137 |
|
| 138 |
# Encode the query using the custom embedding function
|
| 139 |
+
query_embedding = embed_text(body.search_query)
|
| 140 |
+
print(body.search_query)
|
| 141 |
collection_name = "embed" # Use the collection name where the embeddings are stored
|
| 142 |
# Perform search using the precomputed embeddings
|
| 143 |
hits, error = searcher.search_documents(collection_name, query_embedding, user_id)
|
|
|
|
| 149 |
logging.info("Generating RAG response")
|
| 150 |
|
| 151 |
# Generate the RAG response using the retrieved documents
|
| 152 |
+
response, error = generate_rag_response(hits, body.search_query)
|
| 153 |
|
| 154 |
if error:
|
| 155 |
logging.error(f"Generate RAG response error: {error}")
|