在从向量数据库中查询时,有时候会查询到多条重复的文本记录,这个该怎么调整相似度,或者搜索时匹配到的文件数的配置呢?
代码:
qa = ConversationalRetrievalChain.from_llm(llm, rds.as_retriever(),
return_source_documents=True, verbose=True,
combine_docs_chain_kwargs = {"prompt": PromptTemplate(input_variables=["context", "question"], template=QA_PROMP_ALL_KNOWLEDGE)})
chat_history = []
query = "请讲解一下出师表"
result = qa({"question": query, "chat_history": chat_history})
chat_history.append((query, result["answer"]))
print('答案:', result["answer"])
print('视频:', row_map[result["source_documents"][0].metadata["row"]])
搜索到的文本列表: