cannot import name ‘VectorStoreIndex‘ from ‘llama_index‘

文章讲述了作者在更新llama_index版本后遇到的问题,因为新版本改变了类路径,导致一些库找不到。解决方案是明确指定使用llama_index的0.9.48版本以避免冲突。
部署运行你感兴趣的模型镜像

今天更新一个版本,结果运行不起来,提示llama_index好多库找不到。
查了下原因,原来llama_index新版本把好多类的路径都变了,恶心。

解决方案:
指定llama_index版本。将版本依赖更改为

llama-index==0.9.48

您可能感兴趣的与本文相关的镜像

Llama Factory

Llama Factory

模型微调
LLama-Factory

LLaMA Factory 是一个简单易用且高效的大型语言模型(Large Language Model)训练与微调平台。通过 LLaMA Factory,可以在无需编写任何代码的前提下,在本地完成上百种预训练模型的微调

代码为import chromadb from llama_index.core import Document,SimpleDirectoryReader from llama_index.core.node_parser import SentenceSplitter from llama_index.core.ingestion import IngestionPipeline from llama_index.core.extractors import TitleExtractor from llama_index.llms.ollama import Ollama from llama_index.embeddings.ollama import OllamaEmbedding from llama_index.vector_stores.chroma import ChromaVectorStore from llama_index.vector_stores.chroma.base import VectorStoreQueryResult from llama_index.core.vector_stores.types import VectorStoreQuery #构造向量存储对象用于存储最后输出的Node对象 llm=Ollama(model="qwen3:0.6b") embedded_model=OllamaEmbedding(model_name="qwen3:0.6b",embed_batch_size=50) chroma = chromadb.PersistentClient(path="./chroma_db") collection = chroma.get_or_create_collection(name="pipeline") vector_store=ChromaVectorStore(chroma_collection=collection) docs=SimpleDirectoryReader(input_files=["..\\5.3\\test.txt"]).load_data() pipline=IngestionPipeline( transformations=[ SentenceSplitter(chunk_size=500,chunk_overlap=0), TitleExtractor(llm=llm,show_progess=False), embedded_model ], vector_store=vector_store ) nodes=pipline.run(documents=docs) query=VectorStoreQuery( query_str='文心一眼是什么?', similarity_top_k=3, mode="default" ) #用输入问题做语义检索 results=vector_store.query(query) print(results.nodes) 报错Traceback (most recent call last): File "D:\pycharm\pythonProject2\rag\第五章\5.4\5.4存储到向量库.py", line 6, in <module> from llama_index.llms.ollama import Ollama File "D:\pycharm\pythonProject2\venv\lib\site-packages\llama_index\llms\ollama\__init__.py", line 1, in <module> from llama_index.llms.ollama.base import Ollama File "D:\pycharm\pythonProject2\venv\lib\site-packages\llama_index\llms\ollama\base.py", line 42, in <module> from llama_index.core.program.utils import process_streaming_objects, FlexibleModel ImportError: cannot import name 'process_streaming_objects' from 'llama_index.core.program.utils' (D:\pycharm\pythonProject2\venv\lib\site-packages\llama_index\core\program\utils.py)
06-11
评论 2
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值