Update main.py
Browse files
main.py
CHANGED
@@ -189,7 +189,7 @@ def stream_llm_request(api_key: str, llm_request: dict, endpoint_url: str):
|
|
189 |
async def chat(request: ChatRequest, background_tasks: BackgroundTasks, api_key: str = Depends(get_api_key)):
|
190 |
try:
|
191 |
document_list = load_embeddings(request.index_id)
|
192 |
-
search_results = embeddings.search(request.query,
|
193 |
context = "\n".join([document_list[idx[0]] for idx in search_results])
|
194 |
|
195 |
rag_prompt = f"Based on the following context, please answer the user's question:\n\nContext:\n{context}\n\nUser's question: {request.query}\n\nAnswer:"
|
|
|
189 |
async def chat(request: ChatRequest, background_tasks: BackgroundTasks, api_key: str = Depends(get_api_key)):
|
190 |
try:
|
191 |
document_list = load_embeddings(request.index_id)
|
192 |
+
search_results = embeddings.search(request.query, 8)
|
193 |
context = "\n".join([document_list[idx[0]] for idx in search_results])
|
194 |
|
195 |
rag_prompt = f"Based on the following context, please answer the user's question:\n\nContext:\n{context}\n\nUser's question: {request.query}\n\nAnswer:"
|