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] [Knowledge] Query: CALL db.vertexVectorKnnSearch('entity','_embedding', XXX使用, {top_k:None}) YIELD node WHERE node.distance < None RETURN node.id AS id; #2505

Open
3 of 15 tasks
Hec-gitHub opened this issue Mar 21, 2025 · 1 comment
Labels
bug Something isn't working Waiting for reply

Comments

@Hec-gitHub
Copy link
Contributor

Search before asking

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

Operating system information

Linux

Python version information

3.10

DB-GPT version

latest release

Related scenes

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

Installation Information

Device information

CPU

Models information

Proxy LLM

What happened

创建完知识图谱后(Knowledge Graph),与知识图谱对话时,返回错误。
File "/dbgpt/rag/retriever/embedding.py", line 267, in _similarity_search_with_score
return await self._index_store.asimilar_search_with_scores(
File "/dbgpt/storage/knowledge_graph/knowledge_graph.py", line 224, in asimilar_search_with_scores
subgraph = self._graph_store_adapter.explore_trigraph(
File "/dbgpt/storage/knowledge_graph/community/tugraph_store_adapter.py", line 672, in explore_trigraph
self.graph_store.conn.run(query=similarity_retrieval_query)
File "/dbgpt/datasource/conn_tugraph.py", line 127, in run
raise Exception(f"Query execution failed: {e}\nQuery: {query}") from e
Exception: Query execution failed: {code: CypherException} {message: Unknown variable: None}
Query: CALL db.vertexVectorKnnSearch('entity','_embedding', XXX使用, {top_k:None}) YIELD node WHERE node.distance < None RETURN node.id AS id;

            similarity_retrieval_query = (
                "CALL db.vertexVectorKnnSearch("
                f"'{GraphElemType.ENTITY.value}','_embedding', {vector}, "
                f"{{top_k:{topk}}}) YIELD node "
                f"WHERE node.distance < {score_threshold} "
                "RETURN node.id AS id;"
            )

手动将topk,score_threshold值固定,查询结果如下:
File "/dbgpt/storage/knowledge_graph/knowledge_graph.py", line 224, in asimilar_search_with_scores
subgraph = self._graph_store_adapter.explore_trigraph(
File "/dbgpt/storage/knowledge_graph/community/tugraph_store_adapter.py", line 674, in explore_trigraph
self.graph_store.conn.run(query=similarity_retrieval_query)
File "/dbgpt/datasource/conn_tugraph.py", line 127, in run
raise Exception(f"Query execution failed: {e}\nQuery: {query}") from e
Exception: Query execution failed: {code: CypherException} {message: Unknown variable: well}
Query: CALL db.vertexVectorKnnSearch('entity','_embedding', well, {top_k:5}) YIELD node WHERE node.distance < 0.3 RETURN node.id AS id;

另外,登录TuGraph web端,可以正常查询上述知识库内容。

What you expected to happen

正常返回查询结果

How to reproduce

知识图谱对话时,返回错误。

Additional context

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!
@Hec-gitHub Hec-gitHub added bug Something isn't working Waiting for reply labels Mar 21, 2025
@Hec-gitHub
Copy link
Contributor Author

Hec-gitHub commented Mar 24, 2025

知识图谱创建成功了,使用view graph 也可以看到图谱与数据正常显示。
另外,在TuGraph 客户端也看到了数据正常被创建,使用“entity”类型也可以正常查询数据。
(properties:{
name:"API使用Key",
id:"API使用Key",
description:null,
_community_id:null,
_embedding:null)。 "_community_id" 与 “_embedding” 的值都未创建。
嵌入模型使用的是:m3e-large

但是,使用Chat Knowledge 对话时,就会报查询错误。
错误信息:
File "/DB-GPT/dbgpt/storage/knowledge_graph/community/tugraph_store_adapter.py", line 684, in explore_trigraph
self.graph_store.conn.run(query=similarity_retrieval_query)

no viable alternative at input 'CALL db.vertexVectorKnnSearch('entity','_embedding', API service'} Query: CALL db.vertexVectorKnnSearch('entity','_embedding', API service, {top_k:None}) YIELD node WHERE node.distance < None RETURN node.id AS id;

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

1 participant