Skip to content

Commit 6fee364

Browse files
committed
fix(rag): export MetadataScan types + align Pinecone config contract
IVectorStore.ts was carrying local changes (MetadataScanOptions, MetadataScanResult, scanByMetadata(), numeric+string $gt/$gte/$lt/$lte comparison operators) behind a git skip-worktree flag, so the exports never reached origin. PineconeVectorStore.ts imports MetadataScanOptions + MetadataScanResult from '../IVectorStore.js' (line 27-28); CI tsc failed with TS2305 "has no exported member" on both since the committed IVectorStore.ts didn't export them. VectorStoreConfiguration.ts carried a parallel local change that replaced the hand-defined PineconeVectorStoreConfig (with `environment` property) with a type-alias to the adapter's real config (with `indexHost` property). Without this change committed, the Extract<...> cast at VectorStoreManager.ts:179 fails with TS2345 because the two PineconeVectorStoreConfig shapes diverge. Both files were marked skip-worktree, hiding the changes from git push. This commit clears the skip-worktree state by re-staging + committing the intended content. CI now has the missing exports and type alignments. Changes: - IVectorStore.ts: add MetadataScanOptions / MetadataScanResult types, scanByMetadata() optional method, relax $gt/$gte/$lt/$lte to accept string (lexicographic comparison, useful for ISO timestamps). - VectorStoreConfiguration.ts: re-export PineconeVectorStoreConfig as type alias to the adapter's config; switch system default defaultProviderId from pinecone_main_prod to qdrant_main_prod + update the example data source to match. Local pnpm run build passes clean after the fix.
1 parent 0cbb397 commit 6fee364

2 files changed

Lines changed: 53 additions & 29 deletions

File tree

src/core/config/VectorStoreConfiguration.ts

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import type { VectorStoreProviderConfig } from '../vector-store/IVectorStore.js';
1515
import type { StorageAdapter, StorageResolutionOptions } from '@framers/sql-storage-adapter';
1616
import type { HnswlibVectorStoreConfig } from '../../rag/vector_stores/HnswlibVectorStore.js';
17+
import type { PineconeVectorStoreConfig as AdapterPineconeVectorStoreConfig } from '../../rag/vector_stores/PineconeVectorStore.js';
1718
import type { QdrantVectorStoreConfig } from '../../rag/vector_stores/QdrantVectorStore.js';
1819
import type { Neo4jVectorStoreConfig } from '../../rag/vector_stores/Neo4jVectorStore.js';
1920

@@ -103,23 +104,15 @@ export interface LocalFileVectorStoreConfig extends VectorStoreProviderConfig {
103104
/**
104105
* Specific configuration for a Pinecone vector store.
105106
*
106-
* @interface PineconeVectorStoreConfig
107-
* @extends VectorStoreProviderConfig
108-
* @property {'pinecone'} type - Identifier for the Pinecone provider type.
109-
* @property {string} apiKey - Pinecone API key. Ensure this is securely managed (e.g., via environment variables).
110-
* @property {string} environment - Pinecone environment (e.g., 'gcp-starter', 'us-east-1-aws').
111-
* @property {number} [defaultEmbeddingDimension] - Default embedding dimension for collections created
112-
* or managed by this provider instance if not specified per collection.
113-
* @property {'cosine' | 'euclidean' | 'dotproduct'} [similarityMetric='cosine'] - Default similarity metric for new Pinecone indexes
114-
* created through this configuration, if applicable.
107+
* This re-exports the runtime adapter config so the shared configuration contract
108+
* stays aligned with the real Pinecone implementation and docs:
109+
* - `apiKey`
110+
* - `indexHost`
111+
* - optional `namespace`
112+
* - optional `defaultDimension`
113+
* - optional `apiVersion`
115114
*/
116-
export interface PineconeVectorStoreConfig extends VectorStoreProviderConfig {
117-
type: 'pinecone';
118-
apiKey: string; // Should be sourced from environment variables
119-
environment: string;
120-
defaultEmbeddingDimension?: number;
121-
similarityMetric?: 'cosine' | 'euclidean' | 'dotproduct';
122-
}
115+
export type PineconeVectorStoreConfig = AdapterPineconeVectorStoreConfig;
123116

124117
/**
125118
* Specific configuration for a Weaviate vector store.
@@ -255,16 +248,16 @@ export interface RagDataLayerConfig {
255248
const systemRagDataLayerConfig: RagDataLayerConfig = {
256249
vectorStoreManager: {
257250
managerId: 'main-vsm',
258-
defaultProviderId: 'pinecone_main_prod',
251+
defaultProviderId: 'qdrant_main_prod',
259252
defaultEmbeddingDimension: 1536, // System-wide default if not specified lower
260253
providers: [
261254
{
262-
id: 'pinecone_main_prod', // Matches VectorStoreProviderConfig.id
263-
type: 'pinecone',
264-
apiKey: process.env.PINECONE_API_KEY!,
265-
environment: process.env.PINECONE_ENVIRONMENT!,
255+
id: 'qdrant_main_prod', // Matches VectorStoreProviderConfig.id
256+
type: 'qdrant',
257+
url: process.env.QDRANT_URL!,
258+
apiKey: process.env.QDRANT_API_KEY,
266259
defaultEmbeddingDimension: 1536, // Provider-level default
267-
} as PineconeVectorStoreConfig,
260+
} as QdrantVectorStoreConfig,
268261
{
269262
id: 'in_memory_dev_store',
270263
type: 'in_memory',
@@ -277,8 +270,8 @@ const systemRagDataLayerConfig: RagDataLayerConfig = {
277270
dataSourceId: 'global_company_wiki',
278271
displayName: 'Global Company Wiki',
279272
description: 'Shared knowledge base for all company agents and employees.',
280-
vectorStoreProviderId: 'pinecone_main_prod',
281-
actualNameInProvider: 'company-wiki-prod-v2', // e.g., Pinecone index name
273+
vectorStoreProviderId: 'qdrant_main_prod',
274+
actualNameInProvider: 'company-wiki-prod-v2', // e.g., Qdrant collection name
282275
embeddingDimension: 1536, // Specific to this data source's content
283276
isDefaultQuerySource: true,
284277
metadataSchema: { "department": "string", "lastReviewed": "date" }
@@ -287,7 +280,7 @@ const systemRagDataLayerConfig: RagDataLayerConfig = {
287280
dataSourceId: 'user_personal_notes_main',
288281
displayName: 'User Personal Notes (Encrypted)',
289282
description: 'Personal notes and memories for individual users. Data segregated by user ID in metadata filters.',
290-
vectorStoreProviderId: 'pinecone_main_prod',
283+
vectorStoreProviderId: 'qdrant_main_prod',
291284
actualNameInProvider: 'user-notes-prod-encrypted',
292285
embeddingDimension: 1536,
293286
// This collection would typically be queried with a strong `userId` metadata filter.

src/core/vector-store/IVectorStore.ts

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ export type MetadataValue = MetadataScalarValue | MetadataScalarValue[];
6060
export interface MetadataFieldCondition {
6161
$eq?: MetadataScalarValue; // Equal to
6262
$ne?: MetadataScalarValue; // Not equal to
63-
$gt?: number; // Greater than
64-
$gte?: number; // Greater than or equal to
65-
$lt?: number; // Less than
66-
$lte?: number; // Less than or equal to
63+
$gt?: number | string; // Greater than. Strings are compared lexicographically (e.g. ISO timestamps).
64+
$gte?: number | string; // Greater than or equal to. Strings are compared lexicographically.
65+
$lt?: number | string; // Less than. Strings are compared lexicographically (e.g. ISO timestamps).
66+
$lte?: number | string; // Less than or equal to. Strings are compared lexicographically.
6767
$in?: MetadataScalarValue[]; // Value is one of these (for scalar fields)
6868
$nin?: MetadataScalarValue[]; // Value is not one of these (for scalar fields)
6969
$exists?: boolean; // Field exists (true) or does not exist (false)
@@ -160,6 +160,28 @@ export interface QueryResult {
160160
stats?: Record<string, any>;
161161
}
162162

163+
/**
164+
* Options for enumerating documents by metadata without a query embedding.
165+
*/
166+
export interface MetadataScanOptions {
167+
filter?: MetadataFilter;
168+
limit?: number;
169+
includeEmbedding?: boolean;
170+
includeMetadata?: boolean;
171+
includeTextContent?: boolean;
172+
cursor?: string;
173+
customParams?: Record<string, any>;
174+
}
175+
176+
/**
177+
* Result of a metadata-only document scan.
178+
*/
179+
export interface MetadataScanResult {
180+
documents: RetrievedVectorDocument[];
181+
nextCursor?: string;
182+
stats?: Record<string, any>;
183+
}
184+
163185
/**
164186
* Options for a vector store upsert (insert or update) operation.
165187
*
@@ -291,6 +313,15 @@ export interface IVectorStore {
291313
options?: QueryOptions,
292314
): Promise<QueryResult>;
293315

316+
/**
317+
* Optional: Enumerates documents using metadata-only filtering without
318+
* requiring a query embedding.
319+
*/
320+
scanByMetadata?(
321+
collectionName: string,
322+
options?: MetadataScanOptions,
323+
): Promise<MetadataScanResult>;
324+
294325
/**
295326
* Optional: Hybrid retrieval combining dense vector similarity with lexical search.
296327
*

0 commit comments

Comments
 (0)