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] 重建知识库失败 #3284

Closed
zpzxgcr opened this issue Mar 12, 2024 · 1 comment
Closed

[BUG] 重建知识库失败 #3284

zpzxgcr opened this issue Mar 12, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@zpzxgcr
Copy link

zpzxgcr commented Mar 12, 2024

问题描述 / Problem Description
改成pg的时候报错了

复现问题的步骤 / Steps to Reproduce
python init_database.py --recreate-vs

预期的结果 / Expected Result
正常创建
实际结果 / Actual Result
recreating all vector stores
Traceback (most recent call last):
File "D:\code\python\Langchain-Chatchat\init_database.py", line 107, in
folder2db(kb_names=args.kb_name, mode="recreate_vs", embed_model=args.embed_model)
File "D:\code\python\Langchain-Chatchat\server\knowledge_base\migrate.py", line 119, in folder2db
kb = KBServiceFactory.get_service(kb_name, vs_type, embed_model)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\code\python\Langchain-Chatchat\server\knowledge_base\kb_service\base.py", line 304, in get_service
vector_store_type = getattr(SupportedVSType, vector_store_type.upper())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: type object 'SupportedVSType' has no attribute 'PGVECTOR'

环境信息 / Environment Information

  • langchain-ChatGLM 版本/commit 号:(例如:v2.0.1 或 commit 123456) / langchain-ChatGLM version/commit number: (e.g., v2.0.1 or commit 123456)
  • 是否使用 Docker 部署(是/否):否
  • 使用的模型(ChatGLM2-6B / Qwen-7B 等):ChatGLM-6B / Model used (ChatGLM2-6B / Qwen-7B, etc.): ChatGLM2-6B
  • 使用的 Embedding 模型(moka-ai/m3e-base 等):moka-ai/m3e-base / Embedding model used (moka-ai/m3e-base, etc.): moka-ai/m3e-base
  • 使用的向量库类型 (faiss / milvus / pg_vector 等): faiss / Vector library used (faiss, milvus, pg_vector, etc.): faiss
  • 操作系统及版本 / Operating system and version:
  • Python 版本 / Python version: 3.11.7
  • 其他相关环境信息 / Other relevant environment information:

附加信息 / Additional Information
添加与问题相关的任何其他信息 / Add any other information related to the issue.

@zpzxgcr zpzxgcr added the bug Something isn't working label Mar 12, 2024
Copy link

dosubot bot commented Mar 12, 2024

你好,@zpzxgcr!很高兴再次看到你在这里提出问题。希望你一切都好。

您好,zpzxgcr。根据您提供的错误信息,问题出在尝试访问SupportedVSType类的PGVECTOR属性,但是这个属性并不存在。这通常发生在代码期望类或模块中存在某个属性或方法,但实际上并未定义或正确导入。

在您尝试使用python init_database.py --recreate-vs命令重建向量存储时,这个问题可能发生在重建向量存储的过程中,涉及到数据库操作和可能的向量存储机制配置。SupportedVSType可能是用来定义应用程序支持的向量存储类型,例如内存向量、基于文件的向量,或者特定数据库的向量类型,如PostgreSQL的PGVECTOR

然而,您提供的init_database.py代码片段并未包含SupportedVSType的定义或导入语句,也没有直接引用PGVECTOR。这意味着错误可能发生在未显示的代码部分,可能在folder2db函数内部,或者在它依赖的配置或工具中,例如数据库模型定义或向量存储配置。

要解决这个错误,您需要:

  1. 确保SupportedVSType正确定义,并且如果打算支持PostgreSQL向量存储,应包含PGVECTOR属性。这可能需要检查代码库中的模型或枚举定义。
  2. 验证所有必要的依赖项和模块,用于处理预期的向量存储(例如,PostgreSQL扩展或向量操作库)在项目中正确安装和导入。
  3. 检查配置文件或环境变量(在提供的片段中未显示),确保它们正确设置,用于预期的数据库和向量存储类型。

没有访问完整代码库的权限,特别是定义SupportedVSType和处理向量存储操作的部分,无法提供精确的解决方案。您需要查看相关的代码部分来解决问题。

另外,我在Langchain-Chatchat的问题库中找到了一些类似的问题,可能对您有所帮助:

  1. [BUG] PGVECTOR的连接报错问题
  2. [BUG] 简洁阐述问题 / 运行python init_database.py --recreate-vs错误

希望这些信息对您有所帮助。如果您有任何其他问题或需要进一步的澄清,请随时告诉我。

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.

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

No branches or pull requests

1 participant