faiss_index = create_index(datas_embedding) # 创建一个RAG机器人 bot = RAG_Bot(faiss_index,llm_api=get_completion_glm,paragraphs = paragraphs) user_query = "llama2相比较llama1有哪些提高?" response = bot.chat(user_query) print(response) 初步感觉,chromadb更接近一个数据库,它有完整的检索过程...
index = faiss.IndexFlatL2(datas_embedding.shape[1]) # 这里必须传入一个向量的维度,创建一个空的索引 index.add(datas_embedding) # 把向量数据加入索引 return index ###需要换成本地接口### class RAG_Bot: def __init__(self, vector_db, llm_api, paragraphs,n_results=2): self.vector_db = ...