GPT 索引是一个项目,由一组使用 LLM 创建的数据结构组成,可以使用 LLM 遍历以回答查询。
皮皮:https://pypi.org/project/gpt-index/。
文档:https://gpt-index.readthedocs.io/en/latest/。
推特:https://twitter.com/gpt_index。
不和谐:https://discord.gg/dGcwcsnxhU。
注意:本自述文件的更新频率不如文档。请查看上面的文档以获取最新更新!
GPT Index 的核心包含一个索引数据结构工具包,旨在轻松地将 LLM 与你的外部数据连接起来。GPT 指数有助于提供以下优势:
每种数据结构都提供不同的用例和各种可自定义的参数。然后,可以以通用方式查询这些索引,以便完成通常使用 LLM 完成的任何任务:
对贡献感兴趣吗?有关更多详细信息,请参阅我们的贡献指南。
完整的文档可以在这里找到:https://gpt-index.readthedocs.io/en/latest/。
请查看最新的教程、操作指南、参考资料和其他资源!
pip install gpt-index
示例位于文件夹中。索引位于文件夹中(请参阅下面的索引列表)。
examples
indices
要构建简单的向量存储索引,请执行以下操作:
from gpt_index import GPTSimpleVectorIndex, SimpleDirectoryReader
documents = SimpleDirectoryReader('data').load_data()
index = GPTSimpleVectorIndex(documents)
要保存到磁盘并从磁盘加载:
# save to disk
index.save_to_disk('index.json')
# load from disk
index = GPTSimpleVectorIndex.load_from_disk('index.json')
要查询:
index.query("<question_text>?", child_branch_factor=1)
主要的第三方软件包要求是 、 和 。
tiktoken
openai
langchain
所有要求都应包含在文件中。要在本地运行包而不构建轮子,只需运行 .
setup.py
pip install -r requirements.txt