Constructor PgVectorEmbeddingStore
PgVectorEmbeddingStore(NpgsqlDataSource, bool, string)
Initializes a new instance of the PgVectorEmbeddingStore class using the specified Npgsql.NpgsqlDataSource.
public PgVectorEmbeddingStore(NpgsqlDataSource dataSource, bool ownsDataSource = false, string schema = "public")
Parameters
dataSourceNpgsqlDataSourceThe Npgsql.NpgsqlDataSource used to obtain pooled connections to the PostgreSQL service. The data source must target a database where the
vectorextension is available.ownsDataSourceboolIf
true, the store takes ownership of the data source and will dispose it when the store is disposed. Iffalse(default), the caller retains ownership and is responsible for disposing the data source.schemastringThe PostgreSQL schema that holds the collection tables. Defaults to
publicwhen null or empty. The schema is created on demand when a collection is created.
Exceptions
- ArgumentNullException
Thrown if
dataSourceis null.
PgVectorEmbeddingStore(string, string)
Initializes a new instance of the PgVectorEmbeddingStore class from a PostgreSQL connection string. The store builds and owns an internal pooled Npgsql.NpgsqlDataSource.
public PgVectorEmbeddingStore(string connectionString, string schema = "public")
Parameters
connectionStringstringA standard Npgsql connection string pointing at the target PostgreSQL database, for example
Host=localhost;Username=postgres;Password=secret;Database=vectors.schemastringThe PostgreSQL schema that holds the collection tables. Defaults to
publicwhen null or empty. The schema is created on demand when a collection is created.
Exceptions
- ArgumentException
Thrown when
connectionStringis null, empty, or whitespace.