Skip to content

Commit 00a21bd

Browse files
committed
[Store][PG] Allow to change the vector size
1 parent 8d4134c commit 00a21bd

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)