Skip to content

Commit

Permalink
feat: Add score to VectorDocument (#152)
Browse files Browse the repository at this point in the history
* Add `score` to `VectorDocument`

* -
  • Loading branch information
OskarStark authored Dec 6, 2024
1 parent f9d9e4a commit 1afc25f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Bridge/MongoDB/Store.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ public function query(Vector $vector, array $options = [], ?float $minScore = nu
id: $this->toUuid($result['_id']),
vector: new Vector($result[$this->vectorFieldName]),
metadata: new Metadata($result['metadata'] ?? []),
score: $result['score'],
);
}

Expand Down
1 change: 1 addition & 0 deletions src/Bridge/Pinecone/Store.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public function query(Vector $vector, array $options = [], ?float $minScore = nu
id: Uuid::fromString($match['id']),
vector: new Vector($match['values']),
metadata: new Metadata($match['metadata']),
score: $match['score'],
);
}

Expand Down
1 change: 1 addition & 0 deletions src/Document/VectorDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public function __construct(
public Uuid $id,
public VectorInterface $vector,
public Metadata $metadata = new Metadata(),
public ?float $score = null,
) {
}
}

0 comments on commit 1afc25f

Please sign in to comment.