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

[BUG] 知识库管理使用milvus上传文档报错 #3174

Closed
jiyang2024 opened this issue Mar 5, 2024 · 3 comments
Closed

[BUG] 知识库管理使用milvus上传文档报错 #3174

jiyang2024 opened this issue Mar 5, 2024 · 3 comments
Labels
bug Something isn't working stale

Comments

@jiyang2024
Copy link

问题描述
部署完成后,使用默认的向量库faiss进行上传文档成功,然后本地部署了milvus向量库,在知识库管理新建milvus向量库成功,往milvus向量库中添加doc文档报错。

1、部署完成后,使用faiss没有问题。
2、启用milvus向量库,修改了configs/kb_config.py的值DEFAULT_VS_TYPE = "milvus"和配置milvus信息:
image
milvus可以正常访问。
3、通过python startup.py -a重启后,往milvus添加文档,报错,错误信息如下:
image
image
image

初始化过faiss向量库,是否还是需要初始化一次milvus向量库?

@jiyang2024 jiyang2024 added the bug Something isn't working label Mar 5, 2024
Copy link

dosubot bot commented Mar 5, 2024

嘿,@jiyang2024! 又见面了,希望这次我们能一起解决新的挑战。🚀

您需要像初始化Faiss向量库一样初始化Milvus向量库。在milvus_kb_service.py中的代码显示,Milvus向量库的初始化由do_init方法处理,该方法被调用以加载Milvus配置并连接到Milvus服务器。这从MilvusKBService类中的_load_milvus方法中可以看出,该方法负责使用嵌入函数、集合名称、连接参数、索引参数和搜索参数(如在kbs_config中指定)设置Milvus实例。

do_init方法被明确地调用以执行此初始化过程。如果不调用do_init(或确保在应用程序生命周期的适当时间内调用它),Milvus实例(self.milvus)将不会被正确初始化,当试图添加文档或执行其他依赖于Milvus连接已建立并正确配置的操作时,会导致错误。

以下是初始化Milvus的相关代码部分:

def _load_milvus(self):
    self.milvus = Milvus(embedding_function=EmbeddingsFunAdapter(self.embed_model),
                         collection_name=self.kb_name,
                         connection_args=kbs_config.get("milvus"),
                         index_params=kbs_config.get("milvus_kwargs")["index_params"],
                         search_params=kbs_config.get("milvus_kwargs")["search_params"]
                         )

def do_init(self):
    self._load_milvus()

此初始化对于使用正确的参数设置Milvus实例并确保应用程序可以与Milvus服务器通信以执行添加文档等操作至关重要。

关于尝试向Milvus向量库添加文档时显示的确切错误消息,以及Langchain-Chatchat应用程序中使用的Milvus版本,我在存储库中没有找到答案,可能需要更多的信息才能解决这个问题。

Sources

About Dosu

This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

@hollowdjj
Copy link
Contributor

没有提供id

Copy link

github-actions bot commented Apr 5, 2024

这个问题已经被标记为 stale ,因为它已经超过 30 天没有任何活动。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale
Projects
None yet
Development

No branches or pull requests

3 participants