@mastra/lance 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,18 +15,18 @@ The LanceVectorStore uses a factory pattern for creation. You should use the sta
15
15
  You can create a `LanceVectorStore` instance using the static create method:
16
16
 
17
17
  ```ts
18
- import { LanceVectorStore } from "@mastra/lance";
18
+ import { LanceVectorStore } from '@mastra/lance'
19
19
 
20
20
  // Connect to a local database
21
- const vectorStore = await LanceVectorStore.create("/path/to/db");
21
+ const vectorStore = await LanceVectorStore.create('/path/to/db')
22
22
 
23
23
  // Connect to a LanceDB cloud database
24
- const cloudStore = await LanceVectorStore.create("db://host:port");
24
+ const cloudStore = await LanceVectorStore.create('db://host:port')
25
25
 
26
26
  // Connect to a cloud database with options
27
- const s3Store = await LanceVectorStore.create("s3://bucket/db", {
28
- storageOptions: { timeout: "60s" },
29
- });
27
+ const s3Store = await LanceVectorStore.create('s3://bucket/db', {
28
+ storageOptions: { timeout: '60s' },
29
+ })
30
30
  ```
31
31
 
32
32
  ## Methods
@@ -92,7 +92,7 @@ const s3Store = await LanceVectorStore.create("s3://bucket/db", {
92
92
  Returns an array of table names as strings.
93
93
 
94
94
  ```typescript
95
- const tables = await vectorStore.listTables();
95
+ const tables = await vectorStore.listTables()
96
96
  // ['my_vectors', 'embeddings', 'documents']
97
97
  ```
98
98
 
@@ -122,16 +122,16 @@ Returns information about the index:
122
122
 
123
123
  ```typescript
124
124
  interface IndexStats {
125
- dimension: number;
126
- count: number;
127
- metric: "cosine" | "euclidean" | "dotproduct";
128
- type: "ivfflat" | "hnsw";
125
+ dimension: number
126
+ count: number
127
+ metric: 'cosine' | 'euclidean' | 'dotproduct'
128
+ type: 'ivfflat' | 'hnsw'
129
129
  config: {
130
- m?: number;
131
- efConstruction?: number;
132
- numPartitions?: number;
133
- numSubVectors?: number;
134
- };
130
+ m?: number
131
+ efConstruction?: number
132
+ numPartitions?: number
133
+ numSubVectors?: number
134
+ }
135
135
  }
136
136
  ```
137
137
 
@@ -177,11 +177,11 @@ Query results are returned in this format:
177
177
 
178
178
  ```typescript
179
179
  interface QueryResult {
180
- id: string;
181
- score: number;
182
- metadata: Record<string, any>;
183
- vector?: number[]; // Only included if includeVector is true
184
- document?: string; // Document text if available
180
+ id: string
181
+ score: number
182
+ metadata: Record<string, any>
183
+ vector?: number[] // Only included if includeVector is true
184
+ document?: string // Document text if available
185
185
  }
186
186
  ```
187
187
 
@@ -192,12 +192,12 @@ The store throws typed errors that can be caught:
192
192
  ```typescript
193
193
  try {
194
194
  await store.query({
195
- tableName: "my_vectors",
195
+ tableName: 'my_vectors',
196
196
  queryVector: queryVector,
197
- });
197
+ })
198
198
  } catch (error) {
199
199
  if (error instanceof Error) {
200
- console.log(error.message);
200
+ console.log(error.message)
201
201
  }
202
202
  }
203
203
  ```
package/dist/index.cjs CHANGED
@@ -2375,6 +2375,15 @@ var LanceVectorStore = class _LanceVectorStore extends vector.MastraVector {
2375
2375
  includeAllColumns = false
2376
2376
  }) {
2377
2377
  const resolvedTableName = tableName ?? indexName;
2378
+ if (!queryVector) {
2379
+ throw new error.MastraError({
2380
+ id: storage.createVectorErrorId("LANCE", "QUERY", "MISSING_VECTOR"),
2381
+ text: "queryVector is required for Lance queries. Metadata-only queries are not supported by this vector store.",
2382
+ domain: error.ErrorDomain.STORAGE,
2383
+ category: error.ErrorCategory.USER,
2384
+ details: { indexName: resolvedTableName }
2385
+ });
2386
+ }
2378
2387
  try {
2379
2388
  if (!this.lanceClient) {
2380
2389
  throw new Error("LanceDB client not initialized. Use LanceVectorStore.create() to create an instance");
@@ -2382,9 +2391,6 @@ var LanceVectorStore = class _LanceVectorStore extends vector.MastraVector {
2382
2391
  if (!resolvedTableName) {
2383
2392
  throw new Error("tableName or indexName is required");
2384
2393
  }
2385
- if (!queryVector) {
2386
- throw new Error("queryVector is required");
2387
- }
2388
2394
  } catch (error$1) {
2389
2395
  throw new error.MastraError(
2390
2396
  {