langchain weaviate.Client的类型检查不再与weaviate-client中的类名保持一致?

vyswwuz2  于 3个月前  发布在  其他
关注(0)|答案(1)|浏览(68)

检查其他资源

  • 我为这个问题添加了一个非常描述性的标题。
  • 我使用集成搜索在LangChain文档中进行了搜索。
  • 我使用GitHub搜索找到了一个类似的问题,但没有找到。
  • 我确信这是LangChain中的一个bug,而不是我的代码。
  • 通过更新到LangChain的最新稳定版本(或特定集成包)无法解决此bug。

示例代码

from langchain.vectorstores.weaviate import Weaviate

vectorstore = Weaviate(
    client=client,
    index_name="coll_summary",
    text_key="summary"
)

错误信息和堆栈跟踪(如果适用)

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[19], [line 1](vscode-notebook-cell:?execution_count=19&line=1)
----> [1](vscode-notebook-cell:?execution_count=19&line=1) vectorstore = Weaviate(
      [2](vscode-notebook-cell:?execution_count=19&line=2)     client=client,
      [3](vscode-notebook-cell:?execution_count=19&line=3)     index_name="coll_summary",
      [4](vscode-notebook-cell:?execution_count=19&line=4)     text_key="summary"
      [5](vscode-notebook-cell:?execution_count=19&line=5) )

File ~/weaviate.py:105, in Weaviate.__init__(self, client, index_name, text_key, embedding, attributes, relevance_score_fn, by_text)
    [100](https://file+.vscode-resource.vscode-cdn.net//weaviate.py:100)     raise ImportError(
    [101](https://file+.vscode-resource.vscode-cdn.net/weaviate.py:101)         "Could not import weaviate python package. "
    [102](https://file+.vscode-resource.vscode-cdn.net/weaviate.py:102)         "Please install it with `pip install weaviate-client`."
    [103](https://file+.vscode-resource.vscode-cdn.net/weaviate.py:103)     )
    [104](https://file+.vscode-resource.vscode-cdn.net/weaviate.py:104) if not isinstance(client, weaviate.Client):
--> [105](https://file+.vscode-resource.vscode-cdn.net/weaviate.py:105)     raise ValueError(
    [106](https://file+.vscode-resource.vscode-cdn.net/weaviate.py:106)         f"client should be an instance of weaviate.Client, got {type(client)}"
    [107](https://file+.vscode-resource.vscode-cdn.net/weaviate.py:107)     )
    [108](https://file+.vscode-resource.vscode-cdn.net/weaviate.py:108) self._client = client
    [109](https://file+.vscode-resource.vscode-cdn.net/weaviate.py:109) self._index_name = index_name

ValueError: client should be an instance of weaviate.Client, got <class 'weaviate.client.WeaviateClient'>

描述

似乎现在weaviate客户端的类是weaviate.client.WeaviateClient,而不是weaviate.Client。这意味着向量存储的示例化失败了。

系统信息

System Information
------------------
> OS:  Darwin
> OS Version:  Darwin Kernel Version 20.6.0: Thu Jul  6 22:12:47 PDT 2023; root:xnu-7195.141.49.702.12~1/RELEASE_X86_64
> Python Version:  3.11.3 (main, May 24 2024, 22:45:35) [Clang 13.0.0 (clang-1300.0.29.30)]

Package Information
-------------------
> langchain_core: 0.2.8
> langchain: 0.2.5
> langchain_community: 0.2.5
> langsmith: 0.1.79
> langchain_text_splitters: 0.2.1

Packages not installed (Not Necessarily a Problem)
--------------------------------------------------
The following packages were not found:

> langgraph
> langserve

weaviate客户端库: 4.6.1

prdp8dxp

prdp8dxp1#

这个错误在langchain_community==0.2.11版本中仍然存在,是否有任何更新?

相关问题