Skip to content

[Store][PG] Score is inverted? #195

@lyrixx

Description

@lyrixx

Hello

I noticed something strange with the PG store.

When I query the store to get the similarity, I got 0 for a perfect match, and 1 for something really far.
Usually it's the opposite (1==match, 0==different).

And the minScore enforce my feeling. I don't understand why I would like to filter things that are too revalant: If I put 0.3 I will get document with a match of 0.3+ and so I'll discard all documents with a match from 0 to 0.3, so the best document.

/**
* @param array<string, mixed> $options
* @param float|null $minScore Minimum score to filter results (optional)
*
* @return VectorDocument[]
*/
public function query(Vector $vector, array $options = [], ?float $minScore = null): array

Am I wrong? If not, I could submit a PR to return 1 - <current score>

Metadata

Metadata

Assignees

No one assigned

    Labels

    StoreIssues & PRs about the AI Store component

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions