Skip to content

Commit 1afc25f

Browse files
authored
feat: Add score to VectorDocument (#152)
* Add `score` to `VectorDocument` * -
1 parent f9d9e4a commit 1afc25f

File tree

3 files changed

+3
-0
lines changed

3 files changed

+3
-0
lines changed

src/Bridge/MongoDB/Store.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ public function query(Vector $vector, array $options = [], ?float $minScore = nu
134134
id: $this->toUuid($result['_id']),
135135
vector: new Vector($result[$this->vectorFieldName]),
136136
metadata: new Metadata($result['metadata'] ?? []),
137+
score: $result['score'],
137138
);
138139
}
139140

src/Bridge/Pinecone/Store.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ public function query(Vector $vector, array $options = [], ?float $minScore = nu
5959
id: Uuid::fromString($match['id']),
6060
vector: new Vector($match['values']),
6161
metadata: new Metadata($match['metadata']),
62+
score: $match['score'],
6263
);
6364
}
6465

src/Document/VectorDocument.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public function __construct(
1212
public Uuid $id,
1313
public VectorInterface $vector,
1414
public Metadata $metadata = new Metadata(),
15+
public ?float $score = null,
1516
) {
1617
}
1718
}

0 commit comments

Comments
 (0)