@@ -48,7 +48,7 @@ const config = {
|
|||||||
password: '123',
|
password: '123',
|
||||||
host: '127.0.0.1',
|
host: '127.0.0.1',
|
||||||
port: 5432,
|
port: 5432,
|
||||||
dbname: 'vector_store', // Optional, defaults to 'postgres'
|
dbname: 'vector_store', // Optional; TypeScript OSS defaults to `vector_store` when omitted
|
||||||
diskann: false, // Optional, requires pgvectorscale extension
|
diskann: false, // Optional, requires pgvectorscale extension
|
||||||
hnsw: false, // Optional, for HNSW indexing
|
hnsw: false, // Optional, for HNSW indexing
|
||||||
},
|
},
|
||||||
@@ -85,6 +85,8 @@ Here are the parameters available for configuring pgvector:
|
|||||||
| `connection_string` | PostgreSQL connection string (overrides individual connection parameters) | `None` |
|
| `connection_string` | PostgreSQL connection string (overrides individual connection parameters) | `None` |
|
||||||
| `connection_pool` | psycopg2 connection pool object (overrides connection string and individual parameters) | `None` |
|
| `connection_pool` | psycopg2 connection pool object (overrides connection string and individual parameters) | `None` |
|
||||||
|
|
||||||
|
**Note (TypeScript OSS):** If you omit `dbname`, the TypeScript client uses the database name `vector_store`. Python defaults to `postgres` for `dbname`, as in the table above.
|
||||||
|
|
||||||
**Note**: The connection parameters have the following priority:
|
**Note**: The connection parameters have the following priority:
|
||||||
1. `connection_pool` (highest priority)
|
1. `connection_pool` (highest priority)
|
||||||
2. `connection_string`
|
2. `connection_string`
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Client, Pool } from "pg";
|
import { Client } from "pg";
|
||||||
import { VectorStore } from "./base";
|
import { VectorStore } from "./base";
|
||||||
import { SearchFilters, VectorStoreConfig, VectorStoreResult } from "../types";
|
import { SearchFilters, VectorStoreConfig, VectorStoreResult } from "../types";
|
||||||
|
|
||||||
@@ -35,6 +35,7 @@ export class PGVector implements VectorStore {
|
|||||||
host: config.host,
|
host: config.host,
|
||||||
port: config.port,
|
port: config.port,
|
||||||
});
|
});
|
||||||
|
this.initialize().catch(console.error);
|
||||||
}
|
}
|
||||||
|
|
||||||
async initialize(): Promise<void> {
|
async initialize(): Promise<void> {
|
||||||
|
|||||||
@@ -118,6 +118,11 @@ jest.mock("../src/vector_stores/azure_ai_search", () => ({
|
|||||||
.fn()
|
.fn()
|
||||||
.mockImplementation((config) => ({ type: "azure-ai-search", config })),
|
.mockImplementation((config) => ({ type: "azure-ai-search", config })),
|
||||||
}));
|
}));
|
||||||
|
jest.mock("../src/vector_stores/pgvector", () => ({
|
||||||
|
PGVector: jest
|
||||||
|
.fn()
|
||||||
|
.mockImplementation((config) => ({ type: "pgvector", config })),
|
||||||
|
}));
|
||||||
jest.mock("../src/storage/SupabaseHistoryManager", () => ({
|
jest.mock("../src/storage/SupabaseHistoryManager", () => ({
|
||||||
SupabaseHistoryManager: jest
|
SupabaseHistoryManager: jest
|
||||||
.fn()
|
.fn()
|
||||||
@@ -236,6 +241,7 @@ describe("VectorStoreFactory", () => {
|
|||||||
["langchain"],
|
["langchain"],
|
||||||
["vectorize"],
|
["vectorize"],
|
||||||
["azure-ai-search"],
|
["azure-ai-search"],
|
||||||
|
["pgvector"],
|
||||||
])("creates vector store for provider '%s'", (provider) => {
|
])("creates vector store for provider '%s'", (provider) => {
|
||||||
expect(() =>
|
expect(() =>
|
||||||
VectorStoreFactory.create(provider, dummyVSConfig),
|
VectorStoreFactory.create(provider, dummyVSConfig),
|
||||||
|
|||||||
Reference in New Issue
Block a user