Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: cannot import name 'LLM' from 'llama_index.core.llms' #45

Open
liuxinyu228 opened this issue Feb 22, 2024 · 4 comments
Open

Comments

@liuxinyu228
Copy link

我在进入ask模式时报错:ImportError: cannot import name 'LLM' from 'llama_index.core.llms' (/home/kali/miniconda3/envs/AIlearn/lib/python3.9/site-packages/llama_index/core/llms/init.py)

我的llama-index库版本为0.9.39

@liuxinyu228
Copy link
Author

完成报错信息:
Traceback (most recent call last):
File "/home/kali/WorkSpace/AIlearn/history_rag-master/cli.py", line 120, in
cli.run()
File "/home/kali/WorkSpace/AIlearn/history_rag-master/cli.py", line 53, in run
self.parse_input(command_text)
File "/home/kali/WorkSpace/AIlearn/history_rag-master/cli.py", line 74, in parse_input
self.question_answer()
File "/home/kali/WorkSpace/AIlearn/history_rag-master/cli.py", line 99, in question_answer
self._executor.build_query_engine()
File "/home/kali/WorkSpace/AIlearn/history_rag-master/executor.py", line 197, in build_query_engine
self.query_engine = self.index.as_query_engine(node_postprocessors=[
File "/home/kali/miniconda3/envs/AIlearn/lib/python3.9/site-packages/llama_index/indices/base.py", line 350, in as_query_engine
from llama_index.query_engine.retriever_query_engine import RetrieverQueryEngine
File "/home/kali/miniconda3/envs/AIlearn/lib/python3.9/site-packages/llama_index/query_engine/init.py", line 27, in
from llama_index.query_engine.router_query_engine import (
File "/home/kali/miniconda3/envs/AIlearn/lib/python3.9/site-packages/llama_index/query_engine/router_query_engine.py", line 24, in
from llama_index.selectors.utils import get_selector_from_context
File "/home/kali/miniconda3/envs/AIlearn/lib/python3.9/site-packages/llama_index/selectors/init.py", line 3, in
from llama_index.selectors.pydantic_selectors import (
File "/home/kali/miniconda3/envs/AIlearn/lib/python3.9/site-packages/llama_index/selectors/pydantic_selectors.py", line 10, in
from llama_index.program.openai_program import OpenAIPydanticProgram
File "/home/kali/miniconda3/envs/AIlearn/lib/python3.9/site-packages/llama_index/program/init.py", line 5, in
from llama_index.program.openai_program import OpenAIPydanticProgram
File "/home/kali/miniconda3/envs/AIlearn/lib/python3.9/site-packages/llama_index/program/openai_program.py", line 4, in
from llama_index.agent.openai.utils import resolve_tool_choice
File "/home/kali/miniconda3/envs/AIlearn/lib/python3.9/site-packages/llama_index/agent/init.py", line 2, in
from llama_index.agent.custom.pipeline_worker import QueryPipelineAgentWorker
File "/home/kali/miniconda3/envs/AIlearn/lib/python3.9/site-packages/llama_index/agent/custom/pipeline_worker.py", line 27, in
from llama_index.query_pipeline.components.agent import (
File "/home/kali/miniconda3/envs/AIlearn/lib/python3.9/site-packages/llama_index/query_pipeline/init.py", line 3, in
from llama_index.core.query_pipeline.components import (
File "/home/kali/miniconda3/envs/AIlearn/lib/python3.9/site-packages/llama_index/core/query_pipeline/components/init.py", line 13, in
from llama_index.core.query_pipeline.components.router import (
File "/home/kali/miniconda3/envs/AIlearn/lib/python3.9/site-packages/llama_index/core/query_pipeline/components/router.py", line 6, in
from llama_index.core.base.base_selector import BaseSelector
File "/home/kali/miniconda3/envs/AIlearn/lib/python3.9/site-packages/llama_index/core/base/base_selector.py", line 11, in
from llama_index.core.tools.types import ToolMetadata
File "/home/kali/miniconda3/envs/AIlearn/lib/python3.9/site-packages/llama_index/core/tools/init.py", line 6, in
from llama_index.core.tools.query_plan import QueryPlanTool
File "/home/kali/miniconda3/envs/AIlearn/lib/python3.9/site-packages/llama_index/core/tools/query_plan.py", line 6, in
from llama_index.core.response_synthesizers import (
File "/home/kali/miniconda3/envs/AIlearn/lib/python3.9/site-packages/llama_index/core/response_synthesizers/init.py", line 3, in
from llama_index.core.response_synthesizers.accumulate import Accumulate
File "/home/kali/miniconda3/envs/AIlearn/lib/python3.9/site-packages/llama_index/core/response_synthesizers/accumulate.py", line 6, in
from llama_index.core.indices.prompt_helper import PromptHelper
File "/home/kali/miniconda3/envs/AIlearn/lib/python3.9/site-packages/llama_index/core/indices/init.py", line 4, in
from llama_index.core.indices.composability.graph import ComposableGraph
File "/home/kali/miniconda3/envs/AIlearn/lib/python3.9/site-packages/llama_index/core/indices/composability/init.py", line 4, in
from llama_index.core.indices.composability.graph import ComposableGraph
File "/home/kali/miniconda3/envs/AIlearn/lib/python3.9/site-packages/llama_index/core/indices/composability/graph.py", line 7, in
from llama_index.core.indices.base import BaseIndex
File "/home/kali/miniconda3/envs/AIlearn/lib/python3.9/site-packages/llama_index/core/indices/base.py", line 8, in
from llama_index.core.base.base_retriever import BaseRetriever
File "/home/kali/miniconda3/envs/AIlearn/lib/python3.9/site-packages/llama_index/core/base/base_retriever.py", line 30, in
from llama_index.core.settings import Settings
File "/home/kali/miniconda3/envs/AIlearn/lib/python3.9/site-packages/llama_index/core/settings.py", line 12, in
from llama_index.core.llms import LLM
ImportError: cannot import name 'LLM' from 'llama_index.core.llms' (/home/kali/miniconda3/envs/AIlearn/lib/python3.9/site-packages/llama_index/core/llms/init.py)

@wxywb
Copy link
Owner

wxywb commented Feb 22, 2024

执行

pip3 list|grep llama

@liuxinyu228
Copy link
Author

└─$ pip3 list|grep llama
llama-index 0.9.39
llama-index-agent-openai 0.1.4
llama-index-cli 0.1.3
llama-index-core 0.10.11.post1
llama-index-embeddings-huggingface 0.1.3
llama-index-embeddings-openai 0.1.5
llama-index-indices-managed-llama-cloud 0.1.2
llama-index-legacy 0.9.48
llama-index-llms-openai 0.1.5
llama-index-multi-modal-llms-openai 0.1.3
llama-index-program-openai 0.1.3
llama-index-question-gen-openai 0.1.2
llama-index-readers-file 0.1.5
llama-index-readers-llama-parse 0.1.2
llama-index-vector-stores-chroma 0.1.3
llama-index-vector-stores-milvus 0.1.2
llama-parse 0.3.4
llamaindex-py-client 0.1.13

@wxywb
Copy link
Owner

wxywb commented Feb 22, 2024

把这些全部 pip uninstall , 然后只pip install llama-index==0.9.39

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants