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

向量库返回的 Document 中 的 distance 字段应统一 #1568

Open
yyqqing opened this issue Oct 20, 2024 · 2 comments
Open

向量库返回的 Document 中 的 distance 字段应统一 #1568

yyqqing opened this issue Oct 20, 2024 · 2 comments

Comments

@yyqqing
Copy link

yyqqing commented Oct 20, 2024

Bug description
我们将向量库由 chromadb 转为 redis-stack,从 vectorStore.similaritySearch 返回的 Document 中,无法 从 Metadata 中获取 distance 值。

Environment
Please provide as many details as possible: Spring AI version, Java version, which vector store you use if any, etc
Springboot 3.3.2
SpringAI 1.0.0.SNAPSHOT
Java 17
RedisStack 6.2.6

Steps to reproduce

  1. 使用 chromadb 做向量库,vectorStore.similaritySearch 返回的Document 的 Metadata 中,distance 是表示距离的 键名
  2. 使用 redis 做向量库,vectorStore.similaritySearch 返回的Document 的 Metadata 中,vector_score 是表示距离的 键名
  3. 分别跟踪进入 org.springframework.ai.vectorstore.RedisVectorStore 和 org.springframework.ai.vectorstore.ChromaVectorStore 类中,发现 DISTANCE_FIELD_NAME 声明 对应的值 不一样

Expected behavior
希望 Metadata 中表示距离的 key 是统一的、确定的,避免切换向量库时代码不兼容

Minimal Complete Reproducible example
请见重现步骤部分

另外:我没有用过 Milvus,但猜测 #1256 可能与此有一点点关系

@tzolov
Copy link
Contributor

tzolov commented Oct 23, 2024

Hey @yyqqing , could you please update your description in English.

@hYuang
Copy link

hYuang commented Oct 24, 2024

Hey @yyqqing , could you please update your description in English.

when we use different vector db . use vectorStore.similaritySearch method to get the distance key is not same key . eg in in the RedisVectorStore key vector_score means DISTANCE_FIELD_NAME , while in ChromaVectorStore means DISTANCE_FIELD_NAME .it is a little odd.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants