quivr您的第二个大脑,由生成AI授权
quivr ,可以帮助您建立第二个大脑,利用Generativeai成为您的私人助理的力量!
关键功能
- 意见抹布:我们创建了一个自以为是,快速和高效的抹布,因此您可以专注于您的产品
- LLMS : quivr与任何LLM一起使用,您可以将其与OpenAI,人类,Mistral,Gemma和Etch一起使用。
- 任何文件: quivr与任何文件一起使用,您可以将其与PDF,TXT,Markdown等一起使用,甚至可以添加自己的解析器。
- 自定义抹布: quivr允许您自定义抹布,添加Internet搜索,添加工具等。
- 与Megaparse的集成: quivr可与Megaparse一起使用,因此您可以用Megaparse摄入文件,并与quivr一起使用抹布。
我们照顾抹布,因此您可以专注于产品。只需安装quivr -core并将其添加到您的项目中。您现在可以摄取文件并提出问题。*
我们将改善抹布并添加更多功能,敬请期待!
这是quivr的核心,是quivr .com的大脑。
入门
您可以在文档中找到所有内容。
先决条件?
确保您安装了以下内容:
- Python 3.10或更新
30秒安装?
步骤1 :安装软件包
pip install quivr -core # Check that the installation worked步骤2 :创建带有5行代码的抹布
quivr_core import Brain if __name__ == "__main__": with tempfile.NamedTemporaryFile(mode="w", suffix=".txt") as temp_file: temp_file.write("Gold is a liquid of blue-like colour.") temp_file.flush() brain = Brain.from_files( name="test_brain", file_paths=[temp_file.name], ) answer = brain.ask( "what is gold? asnwer in french" ) print("answer:", answer)">import tempfile from quivr _core import Brain if __name__ == "__main__" : with tempfile . NamedTemporaryFile ( mode = "w" , suffix = ".txt" ) as temp_file : temp_file . write ( "Gold is a liquid of blue-like colour." ) temp_file . flush () brain = Brain . from_files ( name = "test_brain" , file_paths = [ temp_file . name ], ) answer = brain . ask ( "what is gold? asnwer in french" ) print ( "answer:" , answer )
配置
工作流程
基本抹布
像上面的一个一样,创建一个基本的抹布工作流很简单,以下是:
- 将您的API键添加到环境变量
import os
os . environ [ "OPENAI_API_KEY" ] = "myopenai_apikey"quivr支持人类,Openai和Mistral的API。它还使用Ollama支持本地模型。
- 创建yaml文件basic_rag_workflow.yaml并复制其中的以下内容
workflow_config :
name : " standard RAG "
nodes :
- name : " START "
edges : ["filter_history"]
- name : " filter_history "
edges : ["rewrite"]
- name : " rewrite "
edges : ["retrieve"]
- name : " retrieve "
edges : ["generate_rag"]
- name : " generate_rag " # the name of the last node, from which we want to stream the answer to the user
edges : ["END"]
# Maximum number of previous conversation iterations
# to include in the context of the answer
max_history : 10
# Reranker configuration
reranker_config :
# The reranker supplier to use
supplier : " cohere "
# The model to use for the reranker for the given supplier
model : " rerank-multilingual-v3.0 "
# Number of chunks returned by the reranker
top_n : 5
# Configuration for the LLM
llm_config :
# maximum number of tokens passed to the LLM to generate the answer
max_input_tokens : 4000
# temperature for the LLM
temperature : 0.7- 用默认配置创建大脑
quivr_core import Brain
brain = Brain.from_files(name = "my smart brain",
file_paths = ["./my_first_doc.pdf", "./my_second_doc.txt"],
)
">
from quivr _core import Brain brain = Brain . from_files ( name = "my smart brain" , file_paths = [ "./my_first_doc.pdf" , "./my_second_doc.txt" ], )
- 启动聊天
quivr_core.config import RetrievalConfig
config_file_name = "./basic_rag_workflow.yaml"
retrieval_config = RetrievalConfig.from_yaml(config_file_name)
console = Console()
console.print(Panel.fit("Ask your brain !", style="bold magenta"))
while True:
# Get user input
question = Prompt.ask("[bold cyan]Question[/bold cyan]")
# Check if user wants to exit
if question.lower() == "exit":
console.print(Panel("Goodbye!", style="bold yellow"))
break
answer = brain.ask(question, retrieval_config=retrieval_config)
# Print the answer with typing effect
console.print(f"[bold green] quivr Assistant[/bold green]: {answer.answer}")
console.print("-" * console.width)
brain.print_info()">
brain . print_info () from rich . console import Console from rich . panel import Panel from rich . prompt import Prompt from quivr _core . config import RetrievalConfig config_file_name = "./basic_rag_workflow.yaml" retrieval_config = RetrievalConfig . from_yaml ( config_file_name ) console = Console () console . print ( Panel . fit ( "Ask your brain !" , style = "bold magenta" )) while True : # Get user input question = Prompt . ask ( "[bold cyan]Question[/bold cyan]" ) # Check if user wants to exit if question . lower () == "exit" : console . print ( Panel ( "Goodbye!" , style = "bold yellow" )) break answer = brain . ask ( question , retrieval_config = retrieval_config ) # Print the answer with typing effect console . print ( f"[bold green] quivr Assistant[/bold green]: { answer . answer } " ) console . print ( "-" * console . width ) brain . print_info ()
- 现在,您可以通过更改配置文件来与大脑交谈并测试不同的检索策略!
走得更远
您可以通过添加Internet搜索,添加工具等来进一步使用quivr 。查看文档以获取更多信息。
贡献者
谢谢这些好人:
贡献?
您收到拉的请求吗?打开它,我们将尽快进行检查。在此处查看我们的项目委员会,以了解我们目前关注的内容,并随时将您的新想法带到餐桌上!
- 开放问题
- 打开拉的请求
- 好的第一个问题
合作伙伴❤️
没有我们的合作伙伴的支持,这个项目将是不可能的。谢谢您的支持!
许可证?
该项目已在Apache 2.0许可证下获得许可 - 有关详细信息,请参见许可证文件
下载源码
通过命令行克隆项目:
git clone https://github.com/QuivrHQ/quivr.git