Skip to content

Conversation

@camilleislasse
Copy link

Q A
Bug fix? yes
New feature? no
Docs? no
Issues n/a
License MIT

Description

The DistanceCalculator was calculating distances but not returning them in the VectorDocument results. This meant queries to CacheStore and InMemoryStore returned
documents without score information, making it impossible to determine result relevance.

Changes

This fix creates new VectorDocument instances with the calculated distance as the score property, matching the pattern used by other stores (Redis, MariaDb, Postgres).

The DistanceCalculator was calculating distances but not returning them in the VectorDocument results. This meant queries returned documents without score information, making it impossible to determine result relevance. This fix creates new VectorDocument instances with the calculated distance as the score property, matching the pattern used by other stores (Redis, MariaDb, Postgres).
@carsonbot carsonbot added Bug Something isn't working Store Issues & PRs about the AI Store component Status: Needs Review labels Nov 11, 2025

return array_map(
static fn (array $embedding): VectorDocument => $embedding['document'],
static fn (array $embedding): VectorDocument => new VectorDocument(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we implement a withScore method to VectorDocument instead?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working Status: Needs Review Store Issues & PRs about the AI Store component

3 participants