Janar Ramalingam commited on
Commit
a0a3c87
·
1 Parent(s): 51a7f02

[first-draft] works

Browse files
Files changed (1) hide show
  1. api/routes/search.py +2 -1
api/routes/search.py CHANGED
@@ -13,7 +13,7 @@ from db import vector_store
13
 
14
  router = APIRouter()
15
  _db = vector_store.get_instance()
16
- _chain = load_qa_chain(OpenAI(temperature=0), chain_type="stuff")
17
 
18
  @router.post("/v1/docs")
19
  async def index_doc(file: UploadFile = File(...)):
@@ -26,6 +26,7 @@ async def index_doc(file: UploadFile = File(...)):
26
  async def search(query: str):
27
  print(query)
28
  docs = _db.similarity_search(query=query)
 
29
  answer = _chain.run(input_documents=docs, question=query)
30
  return JSONResponse(status_code=200, content={"answer": answer})
31
 
 
13
 
14
  router = APIRouter()
15
  _db = vector_store.get_instance()
16
+ _chain = load_qa_chain(OpenAI(temperature=0), chain_type="map_reduce")
17
 
18
  @router.post("/v1/docs")
19
  async def index_doc(file: UploadFile = File(...)):
 
26
  async def search(query: str):
27
  print(query)
28
  docs = _db.similarity_search(query=query)
29
+ print(docs)
30
  answer = _chain.run(input_documents=docs, question=query)
31
  return JSONResponse(status_code=200, content={"answer": answer})
32