Skip to content

Commit 9479d4f

Browse files
committed
feature #157 [Store][PG] Allow to change the vector size (lyrixx)
This PR was merged into the main branch. Discussion ---------- [Store][PG] Allow to change the vector size | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | Docs? | | Issues | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead --> | License | Mistral gives me vector with 1024 dimm Commits ------- 00a21bd [Store][PG] Allow to change the vector size
2 parents c0266db + 00a21bd commit 9479d4f

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/store/src/Bridge/Postgres/Store.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,21 +122,18 @@ public function query(Vector $vector, array $options = [], ?float $minScore = nu
122122

123123
public function initialize(array $options = []): void
124124
{
125-
if ([] !== $options) {
126-
throw new InvalidArgumentException('No supported options');
127-
}
128-
129125
$this->connection->exec('CREATE EXTENSION IF NOT EXISTS vector');
130126

131127
$this->connection->exec(
132128
\sprintf(
133129
'CREATE TABLE IF NOT EXISTS %s (
134130
id UUID PRIMARY KEY,
135131
metadata JSONB,
136-
%s vector(1536) NOT NULL
132+
%s vector(%d) NOT NULL
137133
)',
138134
$this->tableName,
139135
$this->vectorFieldName,
136+
$options['vector_size'] ?? 1536,
140137
),
141138
);
142139
$this->connection->exec(

0 commit comments

Comments
 (0)