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' #154

Closed
alokkrsahu opened this issue Feb 22, 2024 · 1 comment
Closed

Comments

@alokkrsahu
Copy link

alokkrsahu commented Feb 22, 2024

Versions:

RAGatouille==0.0.7.post3

llama-index==0.9.48
llama-index-agent-openai==0.1.5
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.6
llama-index-indices-managed-llama-cloud==0.1.3
llama-index-legacy==0.9.48
llama-index-llms-ollama==0.1.2
llama-index-llms-openai==0.1.6
llama-index-multi-modal-llms-openai==0.1.4
llama-index-packs-ragatouille-retriever==0.1.2
llama-index-program-openai==0.1.4
llama-index-question-gen-openai==0.1.3
llama-index-readers-file==0.1.5
llama-index-readers-llama-parse==0.1.3
llama-index-vector-stores-chroma==0.1.2

Tracedown below

  3 from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig

----> 4 from ragatouille import RAGPretrainedModel
6 READER_MODEL_NAME = "llama-2-7b-chat-hf"
8 bnb_config = BitsAndBytesConfig(
9 load_in_4bit=True,
10 bnb_4bit_use_double_quant=True,
11 bnb_4bit_quant_type="nf4",
12 bnb_4bit_compute_dtype=torch.bfloat16,
13 )

File ~/.local/lib/python3.9/site-packages/ragatouille/init.py:2, in
1 version = "0.0.7post3"
----> 2 from .RAGPretrainedModel import RAGPretrainedModel
3 from .RAGTrainer import RAGTrainer
5 all = ["RAGPretrainedModel", "RAGTrainer"]

File ~/.local/lib/python3.9/site-packages/ragatouille/RAGPretrainedModel.py:8, in
5 from langchain.retrievers.document_compressors.base import BaseDocumentCompressor
6 from langchain_core.retrievers import BaseRetriever
----> 8 from ragatouille.data.corpus_processor import CorpusProcessor
9 from ragatouille.data.preprocessors import llama_index_sentence_splitter
10 from ragatouille.integrations import (
11 RAGatouilleLangChainCompressor,
12 RAGatouilleLangChainRetriever,
13 )

File ~/.local/lib/python3.9/site-packages/ragatouille/data/init.py:1, in
----> 1 from .corpus_processor import CorpusProcessor
2 from .preprocessors import llama_index_sentence_splitter
3 from .training_data_processor import TrainingDataProcessor

File ~/.local/lib/python3.9/site-packages/ragatouille/data/corpus_processor.py:4, in
1 from typing import Callable, List, Optional, Union
2 from uuid import uuid4
----> 4 from ragatouille.data.preprocessors import llama_index_sentence_splitter
7 class CorpusProcessor:
8 def init(
9 self,
10 document_splitter_fn: Optional[Callable] = llama_index_sentence_splitter,
11 preprocessing_fn: Optional[Union[Callable, list[Callable]]] = None,
12 ):

File ~/.local/lib/python3.9/site-packages/ragatouille/data/preprocessors.py:1, in
----> 1 from llama_index import Document
2 from llama_index.text_splitter import SentenceSplitter
5 def llama_index_sentence_splitter(
6 documents: list[str], document_ids: list[str], chunk_size=256
7 ):

File ~/.local/lib/python3.9/site-packages/llama_index/init.py:24, in
20 from llama_index.embeddings import OpenAIEmbedding
22 # indices
23 # loading
---> 24 from llama_index.indices import (
25 ComposableGraph,
26 DocumentSummaryIndex,
27 GPTDocumentSummaryIndex,
28 GPTKeywordTableIndex,
29 GPTKnowledgeGraphIndex,
30 GPTListIndex,
31 GPTRAKEKeywordTableIndex,
32 GPTSimpleKeywordTableIndex,
33 GPTTreeIndex,
34 GPTVectorStoreIndex,
35 KeywordTableIndex,
36 KnowledgeGraphIndex,
37 ListIndex,
38 RAKEKeywordTableIndex,
39 SimpleKeywordTableIndex,
40 SummaryIndex,
41 TreeIndex,
42 VectorStoreIndex,
43 load_graph_from_storage,
44 load_index_from_storage,
45 load_indices_from_storage,
46 )
48 # structured
49 from llama_index.indices.common.struct_store.base import SQLDocumentContextBuilder

File ~/.local/lib/python3.9/site-packages/llama_index/indices/init.py:4, in
1 """LlamaIndex data structures."""
3 # indices
----> 4 from llama_index.indices.composability.graph import ComposableGraph
5 from llama_index.indices.document_summary import (
6 DocumentSummaryIndex,
7 GPTDocumentSummaryIndex,
8 )
9 from llama_index.indices.document_summary.base import DocumentSummaryIndex

File ~/.local/lib/python3.9/site-packages/llama_index/indices/composability/init.py:4, in
1 """This module contains all classes used for composing graphs over indices."""
----> 4 from llama_index.indices.composability.graph import ComposableGraph
6 all = ["ComposableGraph"]

File ~/.local/lib/python3.9/site-packages/llama_index/indices/composability/graph.py:7, in
5 from llama_index.core.base_query_engine import BaseQueryEngine
6 from llama_index.data_structs.data_structs import IndexStruct
----> 7 from llama_index.indices.base import BaseIndex
8 from llama_index.schema import IndexNode, NodeRelationship, ObjectType, RelatedNodeInfo
9 from llama_index.service_context import ServiceContext

File ~/.local/lib/python3.9/site-packages/llama_index/indices/base.py:6, in
3 from abc import ABC, abstractmethod
4 from typing import Any, Dict, Generic, List, Optional, Sequence, Type, TypeVar, cast
----> 6 from llama_index.chat_engine.types import BaseChatEngine, ChatMode
7 from llama_index.core.base_query_engine import BaseQueryEngine
8 from llama_index.core.base_retriever import BaseRetriever

File ~/.local/lib/python3.9/site-packages/llama_index/chat_engine/init.py:1, in
----> 1 from llama_index.chat_engine.condense_plus_context import CondensePlusContextChatEngine
2 from llama_index.chat_engine.condense_question import CondenseQuestionChatEngine
3 from llama_index.chat_engine.context import ContextChatEngine

File ~/.local/lib/python3.9/site-packages/llama_index/chat_engine/condense_plus_context.py:7, in
4 from typing import Any, List, Optional, Tuple
6 from llama_index.callbacks import CallbackManager, trace_method
----> 7 from llama_index.chat_engine.types import (
8 AgentChatResponse,
9 BaseChatEngine,
10 StreamingAgentChatResponse,
11 ToolOutput,
12 )
13 from llama_index.core.llms.types import ChatMessage, MessageRole
14 from llama_index.indices.base_retriever import BaseRetriever

File ~/.local/lib/python3.9/site-packages/llama_index/chat_engine/types.py:17, in
11 from llama_index.core.llms.types import (
12 ChatMessage,
13 ChatResponseAsyncGen,
14 ChatResponseGen,
15 )
16 from llama_index.core.response.schema import Response, StreamingResponse
---> 17 from llama_index.memory import BaseMemory
18 from llama_index.schema import NodeWithScore
19 from llama_index.tools import ToolOutput

File ~/.local/lib/python3.9/site-packages/llama_index/memory/init.py:1, in
----> 1 from llama_index.memory.chat_memory_buffer import ChatMemoryBuffer
2 from llama_index.memory.types import BaseMemory
4 all = ["BaseMemory", "ChatMemoryBuffer"]

File ~/.local/lib/python3.9/site-packages/llama_index/memory/chat_memory_buffer.py:9, in
7 from llama_index.llms.types import ChatMessage, MessageRole
8 from llama_index.memory.types import DEFAULT_CHAT_STORE_KEY, BaseMemory
----> 9 from llama_index.storage.chat_store import BaseChatStore, SimpleChatStore
10 from llama_index.utils import get_tokenizer
12 DEFAULT_TOKEN_LIMIT_RATIO = 0.75

File ~/.local/lib/python3.9/site-packages/llama_index/storage/init.py:3, in
1 """Storage classes."""
----> 3 from llama_index.storage.storage_context import StorageContext
5 all = [
6 "StorageContext",
7 ]

File ~/.local/lib/python3.9/site-packages/llama_index/storage/storage_context.py:26, in
24 from llama_index.storage.index_store.types import BaseIndexStore
25 from llama_index.utils import concat_dirs
---> 26 from llama_index.vector_stores.simple import DEFAULT_PERSIST_FNAME as VECTOR_STORE_FNAME
27 from llama_index.vector_stores.simple import (
28 DEFAULT_VECTOR_STORE,
29 NAMESPACE_SEP,
30 SimpleVectorStore,
31 )
32 from llama_index.vector_stores.types import BasePydanticVectorStore, VectorStore

File ~/.local/lib/python3.9/site-packages/llama_index/vector_stores/init.py:14, in
12 from llama_index.vector_stores.cassandra import CassandraVectorStore
13 from llama_index.vector_stores.chatgpt_plugin import ChatGPTRetrievalPluginClient
---> 14 from llama_index.vector_stores.chroma import ChromaVectorStore
15 from llama_index.vector_stores.dashvector import DashVectorStore
16 from llama_index.vector_stores.deeplake import DeepLakeVectorStore

File ~/.local/lib/python3.9/site-packages/llama_index/vector_stores/chroma/init.py:1, in
----> 1 from llama_index.vector_stores.chroma.base import ChromaVectorStore
3 all = ["ChromaVectorStore"]

File ~/.local/lib/python3.9/site-packages/llama_index/vector_stores/chroma/base.py:11, in
9 from llama_index.core.schema import BaseNode, MetadataMode, TextNode
10 from llama_index.core.utils import truncate_text
---> 11 from llama_index.core.vector_stores.types import (
12 BasePydanticVectorStore,
13 MetadataFilters,
14 VectorStoreQuery,
15 VectorStoreQueryResult,
16 )
17 from llama_index.core.vector_stores.utils import (
18 legacy_metadata_dict_to_node,
19 metadata_dict_to_node,
20 node_to_metadata_dict,
21 )
23 logger = logging.getLogger(name)

File ~/.local/lib/python3.9/site-packages/llama_index/core/vector_stores/init.py:4, in
1 """Vector stores."""
----> 4 from llama_index.core.vector_stores.simple import SimpleVectorStore
5 from llama_index.core.vector_stores.types import (
6 ExactMatchFilter,
7 FilterCondition,
(...)
12 VectorStoreQueryResult,
13 )
15 all = [
16 "VectorStoreQuery",
17 "VectorStoreQueryResult",
(...)
23 "SimpleVectorStore",
24 ]

File ~/.local/lib/python3.9/site-packages/llama_index/core/vector_stores/simple.py:11, in
9 import fsspec
10 from dataclasses_json import DataClassJsonMixin
---> 11 from llama_index.core.indices.query.embedding_utils import (
12 get_top_k_embeddings,
13 get_top_k_embeddings_learner,
14 get_top_k_mmr_embeddings,
15 )
16 from llama_index.core.schema import BaseNode
17 from llama_index.core.utils import concat_dirs

File ~/.local/lib/python3.9/site-packages/llama_index/core/indices/init.py:4, in
1 """LlamaIndex data structures."""
3 # indices
----> 4 from llama_index.core.indices.composability.graph import ComposableGraph
5 from llama_index.core.indices.document_summary import (
6 DocumentSummaryIndex,
7 GPTDocumentSummaryIndex,
8 )
9 from llama_index.core.indices.document_summary.base import DocumentSummaryIndex

File ~/.local/lib/python3.9/site-packages/llama_index/core/indices/composability/init.py:4, in
1 """This module contains all classes used for composing graphs over indices."""
----> 4 from llama_index.core.indices.composability.graph import ComposableGraph
6 all = ["ComposableGraph"]

File ~/.local/lib/python3.9/site-packages/llama_index/core/indices/composability/graph.py:7, in
5 from llama_index.core.base.base_query_engine import BaseQueryEngine
6 from llama_index.core.data_structs.data_structs import IndexStruct
----> 7 from llama_index.core.indices.base import BaseIndex
8 from llama_index.core.schema import (
9 IndexNode,
10 NodeRelationship,
11 ObjectType,
12 RelatedNodeInfo,
13 )
14 from llama_index.core.service_context import ServiceContext

File ~/.local/lib/python3.9/site-packages/llama_index/core/indices/base.py:8, in
5 from typing import Any, Dict, Generic, List, Optional, Sequence, Type, TypeVar
7 from llama_index.core.base.base_query_engine import BaseQueryEngine
----> 8 from llama_index.core.base.base_retriever import BaseRetriever
9 from llama_index.core.callbacks.base import CallbackManager
10 from llama_index.core.chat_engine.types import BaseChatEngine, ChatMode

File ~/.local/lib/python3.9/site-packages/llama_index/core/base/base_retriever.py:30, in
21 from llama_index.core.schema import (
22 BaseNode,
23 IndexNode,
(...)
27 TextNode,
28 )
29 from llama_index.core.service_context import ServiceContext
---> 30 from llama_index.core.settings import Settings
31 from llama_index.core.utils import print_text
34 class BaseRetriever(ChainableMixin, PromptMixin):

File ~/.local/lib/python3.9/site-packages/llama_index/core/settings.py:12, in
10 from llama_index.core.embeddings.utils import EmbedType, resolve_embed_model
11 from llama_index.core.indices.prompt_helper import PromptHelper
---> 12 from llama_index.core.llms import LLM
13 from llama_index.core.llms.utils import LLMType, resolve_llm
14 from llama_index.core.node_parser import NodeParser, SentenceSplitter

ImportError: cannot import name 'LLM' from 'llama_index.core.llms' (.local/lib/python3.9/site-packages/llama_index/core/llms/init.py)

@bclavie
Copy link
Collaborator

bclavie commented Feb 23, 2024

Should hopefully be fixed in #155 along the other llama-index issues? Please feel free to reopen if not, it seems to be a slightly different issue!

@bclavie bclavie closed this as completed Feb 23, 2024
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