$ brew update
$ brew install python@3.11{/tabs-pane}
{tabs-pane label="通过安装包安装"}
{/tabs-pane}
使用git clone命令:
$ git clone https://github.com/jyan1011/privateGPT.gitrequirements.txt文件使用pip命令安装依赖
$ pip3 install -r requirements.txt输出以下内容,依赖安装成功
Successfully installed MarkupSafe-2.1.2 PyYAML-6.0 SQLAlchemy-2.0.13 aiohttp-3.8.4 aiosignal-1.3.1 ...(以下内容省略)LLM:默认为ggml-gpt4all-j-v1.3-groovy.bin 。如果您喜欢不同的GPT4All-J兼容模型,只需下载后在您的文件中引用即可。
example.env文件名为.env.env文件source_documents中支持的文件类型包括:
.csv:CSV表格文件.docx:Microsoft Word.doc:Microsoft Word.enex:印象笔记.eml:电子邮件.epub:电子书epub格式.html:HTML网页文件.md:markdown文档.msg:Outlook文件.odt:开放文本文档.pdf:便携式文档(PDF)pptx:PPT幻灯片文档.ppt:幻灯片文档.txt:文本文件 (UTF-8编码)运行以下命令以引入所有数据:
$ python ingest.py输出应如下所示:
Creating new vectorstore
Loading documents from source_documents
Loading new documents: 100%|██████████████████████| 1/1 [00:01<00:00, 1.73s/it]
Loaded 1 new documents from source_documents
Split into 90 chunks of text (max. 500 tokens each)
Creating embeddings. May take some minutes...
Using embedded DuckDB with persistence: data will be stored in: db
Ingestion complete! You can now run privateGPT.py to query your documents要开始问题,请运行如下命令:
$ python privateGPT.py并等待脚本需要您的输入。
> Enter a query:输入您的问题并按回车键后,需要等待 20-30 秒(具体取决于您的计算机性能),而LLM模型会根据您的提问开始准备答案。完成后,系统将会将打印回答并同时打印它回答所引用的文档中的4个来源。然后,您可以提出另一个问题而无需重新运行脚本,只需再次等待输入提示即可。
如果需要关闭脚本,则在输入问题时输入exit并回车即可。
该脚本还支持可选的命令行参数来修改其行为。您可以通过在终端中运行命令来查看这些参数的完整列表。
$ python privateGPT.py --help
—— 评论区 ——