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

Error when Getting Started #49

Closed
sutyum opened this issue Jan 14, 2024 · 1 comment
Closed

Error when Getting Started #49

sutyum opened this issue Jan 14, 2024 · 1 comment

Comments

@sutyum
Copy link

sutyum commented Jan 14, 2024

Not sure what I am doing wrong.

!pip install git+https://github.com/bclavie/RAGatouille.git

from ragatouille import RAGPretrainedModel

RAG = RAGPretrainedModel.from_pretrained("colbert-ir/colbertv2.0")

I get the following error:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[7], line 1
----> 1 from ragatouille import RAGPretrainedModel
      3 RAG = RAGPretrainedModel.from_pretrained("colbert-ir/colbertv2.0")

File ~/.pyenv/versions/3.10.9/lib/python3.10/site-packages/ragatouille/__init__.py:2
      1 __version__ = "0.0.4a4"
----> 2 from .RAGPretrainedModel import RAGPretrainedModel
      3 from .RAGTrainer import RAGTrainer
      5 __all__ = ["RAGPretrainedModel", "RAGTrainer"]

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

File ~/.pyenv/versions/3.10.9/lib/python3.10/site-packages/ragatouille/data/__init__.py:1
----> 1 from .corpus_processor import CorpusProcessor
      2 from .preprocessors import llama_index_sentence_splitter
      3 from .training_data_processor import TrainingDataProcessor

File ~/.pyenv/versions/3.10.9/lib/python3.10/site-packages/ragatouille/data/corpus_processor.py:3
      1 from typing import Callable, Optional, Union
----> 3 from ragatouille.data.preprocessors import llama_index_sentence_splitter
      6 class CorpusProcessor:
      7     def __init__(
      8         self,
      9         document_splitter_fn: Optional[Callable] = llama_index_sentence_splitter,
     10         preprocessing_fn: Optional[Union[Callable, list[Callable]]] = None,
     11     ):

File ~/.pyenv/versions/3.10.9/lib/python3.10/site-packages/ragatouille/data/preprocessors.py:1
----> 1 from llama_index import Document
      2 from llama_index.text_splitter import SentenceSplitter
      5 def llama_index_sentence_splitter(documents: list[str], chunk_size=256):

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

File ~/.pyenv/versions/3.10.9/lib/python3.10/site-packages/llama_index/indices/__init__.py:44
     39 from llama_index.indices.struct_store.sql import (
     40     GPTSQLStructStoreIndex,
     41     SQLStructStoreIndex,
     42 )
     43 from llama_index.indices.tree.base import GPTTreeIndex, TreeIndex
---> 44 from llama_index.indices.vector_store import GPTVectorStoreIndex, VectorStoreIndex
     46 __all__ = [
     47     "load_graph_from_storage",
     48     "load_index_from_storage",
   (...)
     78     "GPTEmptyIndex",
     79 ]

File ~/.pyenv/versions/3.10.9/lib/python3.10/site-packages/llama_index/indices/vector_store/__init__.py:4
      1 """Vector-store based data structures."""
      3 from llama_index.indices.vector_store.base import GPTVectorStoreIndex, VectorStoreIndex
----> 4 from llama_index.indices.vector_store.retrievers import (
      5     VectorIndexAutoRetriever,
      6     VectorIndexRetriever,
      7 )
      9 __all__ = [
     10     "VectorStoreIndex",
     11     "VectorIndexRetriever",
   (...)
     14     "GPTVectorStoreIndex",
     15 ]

File ~/.pyenv/versions/3.10.9/lib/python3.10/site-packages/llama_index/indices/vector_store/retrievers/__init__.py:4
      1 from llama_index.indices.vector_store.retrievers.retriever import (  # noqa: I001
      2     VectorIndexRetriever,
      3 )
----> 4 from llama_index.indices.vector_store.retrievers.auto_retriever import (
      5     VectorIndexAutoRetriever,
      6 )
      8 __all__ = [
      9     "VectorIndexRetriever",
     10     "VectorIndexAutoRetriever",
     11 ]

File ~/.pyenv/versions/3.10.9/lib/python3.10/site-packages/llama_index/indices/vector_store/retrievers/auto_retriever/__init__.py:1
----> 1 from llama_index.indices.vector_store.retrievers.auto_retriever.auto_retriever import (
      2     VectorIndexAutoRetriever,
      3 )
      5 __all__ = [
      6     "VectorIndexAutoRetriever",
      7 ]

File ~/.pyenv/versions/3.10.9/lib/python3.10/site-packages/llama_index/indices/vector_store/retrievers/auto_retriever/auto_retriever.py:11
      9 from llama_index.indices.vector_store.base import VectorStoreIndex
     10 from llama_index.indices.vector_store.retrievers import VectorIndexRetriever
---> 11 from llama_index.indices.vector_store.retrievers.auto_retriever.output_parser import (
     12     VectorStoreQueryOutputParser,
     13 )
     14 from llama_index.indices.vector_store.retrievers.auto_retriever.prompts import (
     15     DEFAULT_VECTOR_STORE_QUERY_PROMPT_TMPL,
     16 )
     17 from llama_index.output_parsers.base import OutputParserException, StructuredOutput

File ~/.pyenv/versions/3.10.9/lib/python3.10/site-packages/llama_index/indices/vector_store/retrievers/auto_retriever/output_parser.py:3
      1 from typing import Any
----> 3 from llama_index.output_parsers.base import StructuredOutput
      4 from llama_index.output_parsers.utils import parse_json_markdown
      5 from llama_index.types import BaseOutputParser

File ~/.pyenv/versions/3.10.9/lib/python3.10/site-packages/llama_index/output_parsers/__init__.py:3
      1 """Output parsers."""
----> 3 from llama_index.output_parsers.guardrails import GuardrailsOutputParser
      4 from llama_index.output_parsers.langchain import LangchainOutputParser
      5 from llama_index.output_parsers.pydantic import PydanticOutputParser

File ~/.pyenv/versions/3.10.9/lib/python3.10/site-packages/llama_index/output_parsers/guardrails.py:9
      6 from deprecated import deprecated
      8 try:
----> 9     from guardrails import Guard
     10 except ImportError:
     11     Guard = None

File ~/.pyenv/versions/3.10.9/lib/python3.10/site-packages/guardrails/__init__.py:3
      1 # Set up __init__.py so that users can do from guardrails import Response, Schema, etc.
----> 3 from guardrails.guard import Guard
      4 from guardrails.llm_providers import PromptCallable
      5 from guardrails.prompt import Instructions, Prompt

File ~/.pyenv/versions/3.10.9/lib/python3.10/site-packages/guardrails/guard.py:7
      3 from typing import Callable, Dict, Optional, Tuple, Union
      5 from eliot import start_action, to_file
----> 7 from guardrails.llm_providers import PromptCallable, get_llm_ask
      8 from guardrails.prompt import Instructions, Prompt
      9 from guardrails.rail import Rail

File ~/.pyenv/versions/3.10.9/lib/python3.10/site-packages/guardrails/llm_providers.py:16
     12 except ImportError:
     13     MANIFEST = False
     15 OPENAI_RETRYABLE_ERRORS = [
---> 16     openai.error.APIConnectionError,
     17     openai.error.APIError,
     18     openai.error.TryAgain,
     19     openai.error.Timeout,
     20     openai.error.RateLimitError,
     21     openai.error.ServiceUnavailableError,
     22 ]
     23 RETRYABLE_ERRORS = OPENAI_RETRYABLE_ERRORS
     26 class PromptCallableException(Exception):

AttributeError: module 'openai' has no attribute 'error'

I also tried with the version on pypi, had the same error.


OS: MacOS 14.1.1
Python: 3.10.9
Environment: VirtualEnv

@sutyum
Copy link
Author

sutyum commented Jan 14, 2024

Setting up a new virtual environment solved the issue for me.

@sutyum sutyum closed this as completed Jan 14, 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

1 participant