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] [GraphRAG] SchemaNotReadyException: (code=1, message=Collection 'test1_CHUNK_HISTORY' not exist, or you can pass in schema to create one #2316

Open
4 of 15 tasks
xuxl2024 opened this issue Jan 21, 2025 · 2 comments
Labels
bug Something isn't working Waiting for reply

Comments

@xuxl2024
Copy link

xuxl2024 commented Jan 21, 2025

Search before asking

  • I had searched in the issues and found no similar issues.

Operating system information

Windows

Python version information

=3.11

DB-GPT version

main

Related scenes

  • Chat Data
  • Chat Excel
  • Chat DB
  • Chat Knowledge
  • Model Management
  • Dashboard
  • Plugins

Installation Information

Device information

GPU
GPU Count:1
gpu memory:24G

Models information

LLM_MODEL: qwen2.5-7b-instruct
EMBEDDING_MODEL:m3e-base

What happened

在构建知识图谱类型的知识库时,上传文件后,进行文件同步时报错
document embedding failed<SchemaNotReadyException: (code=1, message=Collection 'test1_CHUNK_HISTORY' not exist, or you can pass in schema to create one.)>

What you expected to happen

报错信息来自于milvus_store.py文件中的similar_search_with_scores方法(我使用的向量数据库时milvus),它是由graph_extrator.py的aload_chunk_context方法会调用的,我认为这里的代码逻辑是有缺陷的,在milvus中的collection还没创建的时候,就先调用了similar_search_with_scores方法,而该方法的实现逻辑里并没有判断collection是否存在,所以导致报错提示collection不存在。
修复建议,在similar_search_with_scores方法中增加判断collection是否存在的代码。
原代码如下:

try:
    from pymilvus import Collection, DataType
except ImportError:
    raise ValueError(
        "Could not import pymilvus python package. "
        "Please install it with `pip install pymilvus`."
    )

self.col = Collection(self.collection_name)

修复后的代码如下:

try:
    from pymilvus import Collection, DataType, utility
except ImportError:
    raise ValueError(
        "Could not import pymilvus python package. "
        "Please install it with `pip install pymilvus`."
    )

if not utility.has_collection(self.collection_name):
    return []
self.col = Collection(self.collection_name)

How to reproduce

1.构建一个知识图谱类型的知识库;
2.上传一个文件;
3.选择上传的文件,点击"同步"

Additional context

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!
@xuxl2024 xuxl2024 added bug Something isn't working Waiting for reply labels Jan 21, 2025
@Aries-ckt
Copy link
Collaborator

which dbgpt version?

@xuxl2024
Copy link
Author

which dbgpt version?

the latest version

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

No branches or pull requests

2 participants