bot = RAG_Bot(faiss_index,llm_api=get_completion_glm,paragraphs = paragraphs) user_query = "llama2相比较llama1有哪些提高?" response = bot.chat(user_query) print(response) 初步感觉,chromadb更接近一个数据库,它有完整的检索过程,可以得到原文和索引 defchat(self, user_query): # 1. 检索 searc...
而faiss更像是一个轻量的检索工具,搜索过程中只能够得到索引,构建prompt的过程中需要原文 def chat(self, user_query): # 1. 检索 query_embedding = model.encode([user_query]) Distance, Index = self.vector_db.search(query_embedding, self.n_results) # 2. 构建 Prompt par = paragraphs[int(Index[...