Set no. of references to use for chat configurable in Chat API

This commit is contained in:
Debanjum Singh Solanky 2023-07-07 12:29:36 -07:00
parent d97682fdac
commit 2f31de5ed5

View file

@ -436,6 +436,7 @@ def chat_init(
async def chat( async def chat(
request: Request, request: Request,
q: Optional[str] = None, q: Optional[str] = None,
n: Optional[int] = 5,
client: Optional[str] = None, client: Optional[str] = None,
user_agent: Optional[str] = Header(None), user_agent: Optional[str] = Header(None),
referer: Optional[str] = Header(None), referer: Optional[str] = Header(None),
@ -495,7 +496,7 @@ async def chat(
result_list = [] result_list = []
for query in inferred_queries: for query in inferred_queries:
result_list.extend( result_list.extend(
await search(query, request=request, n=5, r=False, score_threshold=-5.0, dedupe=False) await search(query, request=request, n=n, r=False, score_threshold=-5.0, dedupe=False)
) )
compiled_references = [item.additional["compiled"] for item in result_list] compiled_references = [item.additional["compiled"] for item in result_list]