错误:“builtin_function_or_method”对象没有属性“__func__”

问题描述 投票:0回答:1

第一次使用LangChain,我按照指南操作,却收到此错误,有人知道可能出了什么问题吗?我正在使用松果和这个,我不确定这是否有区别。

对于我的 Pinecone API 环境,我使用“us-east-1” - 我不确定这是否是正确的格式?

如果有任何意见,我将不胜感激!

提前非常感谢:)

这是我的代码:

from langchain_community.vectorstores import DocArrayInMemorySearch

vectorstore1 = DocArrayInMemorySearch.from_texts(
    [
        "Mary's sister is Susana",
        "John and Tommy are brothers",
        "Patricia likes white cars",
        "Pedro's mother is a teacher",
        "Lucia drives an Audi",
        "Mary has two siblings",
    ],
    embedding=embeddings,
)

我收到此错误:

AttributeError                            Traceback (most recent call last)
Cell In[58], line 3
      1 from langchain_community.vectorstores import DocArrayInMemorySearch
----> 3 vectorstore1 = DocArrayInMemorySearch.from_texts(
      4     [
      5         "Mary's sister is Susana",
      6         "John and Tommy are brothers",
      7         "Patricia likes white cars",
      8         "Pedro's mother is a teacher",
      9         "Lucia drives an Audi",
     10         "Mary has two siblings",
     11     ],
     12     embedding=embeddings,
     13 )

File ~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\langchain_community\vectorstores\docarray\in_memory.py:68, in DocArrayInMemorySearch.from_texts(cls, texts, embedding, metadatas, **kwargs)
     46 u/classmethod
     47 def from_texts(
     48     cls,
   (...)
     52     **kwargs: Any,
     53 ) -> DocArrayInMemorySearch:
     54     """Create an DocArrayInMemorySearch store and insert data.
     55 
...

---> 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__'

不确定要尝试什么!

python vector artificial-intelligence langchain embedding
1个回答
0
投票

我猜你正在使用Python 3.12,降级到Python 3.11,它应该可以正常工作

© www.soinside.com 2019 - 2024. All rights reserved.