Skip to content

Issue with DocArrayInMemoryStore #3

@cmbirk

Description

@cmbirk

I've created the virtual environment, activated it, and installed the requirements. Is this a python version error or in need of a different package version?

Python Version: 3.12.2
pip version: 24.0

When attempting to run this part of the notebook:

from langchain_community.vectorstores import DocArrayInMemorySearch

vectorstore = DocArrayInMemorySearch.from_documents(pages, embedding=embeddings)

I'm getting the following error:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[9], line 3
      1 from langchain_community.vectorstores import DocArrayInMemorySearch
----> 3 vectorstore = DocArrayInMemorySearch.from_documents(pages, embedding=embeddings)

File ~/Development/llm-local/.venv/lib/python3.12/site-packages/langchain_core/vectorstores.py:528, in VectorStore.from_documents(cls, documents, embedding, **kwargs)
    526 texts = [d.page_content for d in documents]
    527 metadatas = [d.metadata for d in documents]
--> 528 return cls.from_texts(texts, embedding, metadatas=metadatas, **kwargs)

File ~/Development/llm-local/.venv/lib/python3.12/site-packages/langchain_community/vectorstores/docarray/in_memory.py:68, in DocArrayInMemorySearch.from_texts(cls, texts, embedding, metadatas, **kwargs)
     46 @classmethod
     47 def from_texts(
     48     cls,
   (...)
     52     **kwargs: Any,
     53 ) -> DocArrayInMemorySearch:
     54     """Create an DocArrayInMemorySearch store and insert data.
     55 
     56     Args:
   (...)
     66         DocArrayInMemorySearch Vector Store
     67     """
---> 68     store = cls.from_params(embedding, **kwargs)
...
---> 46         return Generic.__class_getitem__.__func__(cls, item)  # type: ignore
     47         # this do nothing that checking that item is valid type var or str
     48     if not issubclass(item, BaseDoc):

AttributeError: 'builtin_function_or_method' object has no attribute '__func__'
Output is truncated. View as a scrollable element or open in a text editor. Adjust cell output settings...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions