项目预览
项目数据
项目介绍
Star 增长趋势
本站每日记录该项目 GitHub 星标变化,观测越久曲线越完整
数据来源:GitHub API 逐日快照 · 收录于 2026-09-02 · 当前星标 ★ 39667
使用教程
ℹ 本教程由 AI 依据该项目 README 整理,个别步骤可能需要按你的环境微调。
环境要求
- Python 3.10 或更高版本
- 可用的 pip 包管理工具
- 如需调用云端大模型,需自备对应 LLM 的访问凭据(README 未给出具体配置方式)
安装与启动步骤
-
1检查 Python 版本
README 要求 Python 3.10 或更新。先确认本机版本,低于 3.10 请先升级 Python。
python --version -
2安装 quivr-core
用 pip 安装核心包 quivr-core,安装完成后即可在自己的 Python 项目中导入使用。
pip install quivr-core -
3运行最小示例
把 README 的 5 行示例保存为 .py 文件并运行:创建一个临时 txt 文档、构建 Brain 并提问英文问题。
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) -
4编写 RAG 配置文件
新建 basic_rag_workflow.yaml,按 README 示例填写 reranker 与 llm 两组配置,之后可只改文件切换检索策略。
# 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 -
5加载配置并对话
用 RetrievalConfig.from_yaml 读取上面的配置文件,构建 Brain 后进入循环问答,输入 exit 退出。
from quivr_core import Brain brain = Brain.from_files(name = "my smart brain", file_paths = ["./my_first_doc.pdf", "./my_second_doc.txt"], ) 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()
关键配置
| 配置项 | 必填 | 说明 | 示例 |
|---|---|---|---|
reranker_config.supplier | 否 | 指定使用的 reranker 供应商 | cohere |
reranker_config.model | 否 | 指定该供应商下使用的 reranker 模型 | rerank-multilingual-v3.0 |
reranker_config.top_n | 否 | reranker 返回的文本块数量 | 5 |
llm_config.max_input_tokens | 否 | 传给 LLM 生成答案的最大 token 数 | 4000 |
llm_config.temperature | 否 | LLM 采样温度,越高回答越发散 | 0.7 |
如何确认成功
运行最小示例后终端打印出以 answer: 开头的回答内容;运行对话脚本时会显示 Brain 信息并出现 Question 提示符。
常见问题
Q:需要什么 Python 版本?
A:README 明确要求 Python 3.10 或更新版本,低于该版本请先升级环境再安装。
Q:支持哪些大模型?
A:README 称 Quivr 可与任何 LLM 配合,例如 OpenAI、Anthropic、Mistral、Gemma 等。
Q:能处理哪些文件类型?
A:支持任意文件,如 PDF、TXT、Markdown 等,还可以自行添加解析器;示例中用了 .pdf 和 .txt。
Q:怎么更换检索策略?
A:只需修改 YAML 配置文件(如 reranker_config、llm_config)后重新运行,无需改动代码。
Q:更多文档在哪里?
A:README 指向官方文档 https://core.quivr.com/,安装与配置细节以该文档为准。
注意事项
- README 未说明 API Key 等模型凭据的配置方式,接入云端 LLM 前请查阅官方文档 core.quivr.com。
- 安装的包名是 quivr-core,代码中导入的模块名是 quivr_core,注意两者拼写差异。
- 不传 retrieval_config 时 Brain 会使用默认配置,即 README 所说的“有主见”的默认 RAG。
- README 中的安装章节有一处内容被截断(pip in ...),本教程只采用了完整的 pip install quivr-core 命令。
核心亮点
- 支持 GPT-4、Groq、Llama 等多种 LLM,灵活切换
- 兼容 PGVector、Faiss 等主流向量库,数据存储自由
- 提供现成 API 和前端组件,集成门槛低
不足之处
- 配置项较多,初学者需花时间理解
- 文档/社区待观察
适用场景
- 企业内部知识库问答系统
- 电商客服智能助手
- 文档检索与摘要生成工具
替代项目
LangChain、LlamaIndex、Haystack
上一篇:llm-applications
下一篇:jonex
同类项目推荐
StruInfo
开源
把文档变成可追溯、可编辑的知识图谱,数据自己掌控
Self-hosted, traceable document-to-knowledge workspace with deterministic workflows,···
consult-web
开源
在 Emacs 里直接搜全网,不切窗口效率翻倍
Powerful Web and Omni Search inside Emacs
llm-arxiv-daily
开源
每天自动收 arXiv 大模型论文,不用手动刷
Automatically update arXiv papers about LLM Reasoning, LLM Evaluation, LLM & MLLM an···
google-ai-mode-scraper
开源
批量抓取 Google AI 回答不封号,数据稳稳到手
Scrape Google AI Mode responses without blocks on a large scale.
synaplan-nextcloud
开源
在 Nextcloud 里用自建 AI 做文档问答、翻译和摘要
Synaplan AI integration into nextcloud for RAG powered discussions, translations and···
omnibox
开源
碎片信息一键收拢,查过收藏过的不再丢
Anywhere, anything to memory, memory to anything.
rank_llm
开源
用大模型给搜索结果重排序,让最相关的文档排到最前面
RankLLM is a Python toolkit for reproducible information retrieval research using re···
ontocast
开源
用本体约束智能体,把文本自动抽成规范RDF三元组
Agentic Ontology Assisted Framework for Semantic Triple Extraction
alpha_agentic_search
开源
给 RAG 加上分层记忆,多轮问答不再失忆
Alpha Agentic Search — 分层记忆 RAG 检索问答系统
