需要 llama-index 模块导入方面的帮助
我在 Python 代码中遇到了 Llama.index 的一些导入问题。我正在尝试使用多个模块,包括
LLMPredictor
、PromptHelper
、SimpleDirectoryReader
等,但我收到了专门针对 GPTVectorStoreIndex
的错误:
File "d:\l\zira_0.0.2\main.py", line 5, in <module>
from llama_index import (
ImportError: cannot import name 'GPTVectorStoreIndex' from 'llama_index' (unknown location)
from llama_index import (
GPTVectorStoreIndex,
LLMPredictor,
PromptHelper,
ServiceContext,
SimpleDirectoryReader,
StorageContext,
load_index_from_storage,
)
from llama_index.llm_predictor.mock import MockLLMPredictor
from llama_index.nodes.parser import SimpleNodeParser
from llama_index.response.formatting import SimpleOutputFormatter
我检查了文档,看起来
GPTVectorStoreIndex
应该是 Llama.index 的一部分,但我无法导入它。我正在使用 pip
来管理我的依赖项,所以我不确定为什么它不可用。
以下是我迄今为止尝试过的一些事情:
双重检查导入路径:我已验证拼写和路径是否正确(
from llama_index import GPTVectorStoreIndex
)。
重新启动开发环境:我已重新启动 IDE 以确保加载更新的库。
这些都没有解决问题。
您对如何修复此导入错误以及如何将
GPTVectorStoreIndex
与 Llama.index 一起使用有什么建议吗?
任何帮助将不胜感激!