agentscope-ai / agentscope-ai/agentscope-java

[Bug] MilvusStore returns inverted scores for the L2 metric

Open
#3,069 3 comments 0 reactions 0 assignees View on GitHub
area/ext/rag bug
Dominant language
Java
Stars
5.6k
Forks
1.3k
Avg merge
4d 12h
Merged PRs (30d)
77

Description

## Description

When `MilvusStore` is configured with `IndexParam.MetricType.L2`, Milvus returns Euclidean distances, where smaller values indicate greater similarity.

`MilvusStore` currently exposes the raw distance as `Document.score`, while AgentScope retrieval consumers and `scoreThreshold` use a higher-is-better score contract.

For example, distances `1.0` and `3.0` are exposed as scores `1.0` and `3.0`. This exposes a less similar result with a higher score, which can cause consumers that rank by higher-is-better scores to order it incorrectly and makes threshold filtering inconsistent.

## Expected behavior

`Document.score` should preserve AgentScope higher-is-better semantics, and `scoreThreshold` should filter results consistently.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.