Skip to content

Commit

Permalink
extend IndexStats
Browse files Browse the repository at this point in the history
  • Loading branch information
NikAiyer committed Feb 21, 2025
1 parent e0a1307 commit 6d50fb6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
7 changes: 0 additions & 7 deletions packages/core/src/vector/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,6 @@ export interface IndexStats {
dimension: number;
count: number;
metric?: 'cosine' | 'euclidean' | 'dotproduct';
type?: 'flat' | 'hnsw' | 'ivfflat';
config?: {
m?: number;
efConstruction?: number;
lists?: number;
probes?: number;
};
}

export abstract class MastraVector extends MastraBase {
Expand Down
12 changes: 11 additions & 1 deletion stores/pg/src/vector/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ import { PGFilterTranslator } from './filter';
import { buildFilterQuery } from './sql-builder';
import { type IndexConfig } from './types';

export interface PGIndexStats extends IndexStats {
type: 'flat' | 'hnsw' | 'ivfflat';
config: {
m?: number;
efConstruction?: number;
lists?: number;
probes?: number;
};
}

export class PgVector extends MastraVector {
private pool: pg.Pool;

Expand Down Expand Up @@ -251,7 +261,7 @@ export class PgVector extends MastraVector {
}
}

async describeIndex(indexName: string): Promise<IndexStats> {
async describeIndex(indexName: string): Promise<PGIndexStats> {
const client = await this.pool.connect();
try {
// Get vector dimension
Expand Down

0 comments on commit 6d50fb6

Please # to comment.