@zilliz/claude-context-core 0.0.1
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.
- package/LICENSE +21 -0
- package/README.md +275 -0
- package/dist/context.d.ts +234 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +879 -0
- package/dist/context.js.map +1 -0
- package/dist/embedding/base-embedding.d.ts +45 -0
- package/dist/embedding/base-embedding.d.ts.map +1 -0
- package/dist/embedding/base-embedding.js +36 -0
- package/dist/embedding/base-embedding.js.map +1 -0
- package/dist/embedding/gemini-embedding.d.ts +51 -0
- package/dist/embedding/gemini-embedding.d.ts.map +1 -0
- package/dist/embedding/gemini-embedding.js +143 -0
- package/dist/embedding/gemini-embedding.js.map +1 -0
- package/dist/embedding/index.d.ts +6 -0
- package/dist/embedding/index.d.ts.map +1 -0
- package/dist/embedding/index.js +24 -0
- package/dist/embedding/index.js.map +1 -0
- package/dist/embedding/ollama-embedding.d.ts +64 -0
- package/dist/embedding/ollama-embedding.d.ts.map +1 -0
- package/dist/embedding/ollama-embedding.js +205 -0
- package/dist/embedding/ollama-embedding.js.map +1 -0
- package/dist/embedding/openai-embedding.d.ts +36 -0
- package/dist/embedding/openai-embedding.d.ts.map +1 -0
- package/dist/embedding/openai-embedding.js +103 -0
- package/dist/embedding/openai-embedding.js.map +1 -0
- package/dist/embedding/voyageai-embedding.d.ts +43 -0
- package/dist/embedding/voyageai-embedding.d.ts.map +1 -0
- package/dist/embedding/voyageai-embedding.js +223 -0
- package/dist/embedding/voyageai-embedding.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/splitter/ast-splitter.d.ts +22 -0
- package/dist/splitter/ast-splitter.d.ts.map +1 -0
- package/dist/splitter/ast-splitter.js +227 -0
- package/dist/splitter/ast-splitter.js.map +1 -0
- package/dist/splitter/index.d.ts +41 -0
- package/dist/splitter/index.d.ts.map +1 -0
- package/dist/splitter/index.js +27 -0
- package/dist/splitter/index.js.map +1 -0
- package/dist/splitter/langchain-splitter.d.ts +13 -0
- package/dist/splitter/langchain-splitter.d.ts.map +1 -0
- package/dist/splitter/langchain-splitter.js +118 -0
- package/dist/splitter/langchain-splitter.js.map +1 -0
- package/dist/sync/merkle.d.ts +26 -0
- package/dist/sync/merkle.d.ts.map +1 -0
- package/dist/sync/merkle.js +112 -0
- package/dist/sync/merkle.js.map +1 -0
- package/dist/sync/synchronizer.d.ts +30 -0
- package/dist/sync/synchronizer.d.ts.map +1 -0
- package/dist/sync/synchronizer.js +339 -0
- package/dist/sync/synchronizer.js.map +1 -0
- package/dist/types.d.ts +14 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/env-manager.d.ts +19 -0
- package/dist/utils/env-manager.d.ts.map +1 -0
- package/dist/utils/env-manager.js +125 -0
- package/dist/utils/env-manager.js.map +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +7 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/vectordb/index.d.ts +5 -0
- package/dist/vectordb/index.d.ts.map +1 -0
- package/dist/vectordb/index.js +14 -0
- package/dist/vectordb/index.js.map +1 -0
- package/dist/vectordb/milvus-restful-vectordb.d.ts +51 -0
- package/dist/vectordb/milvus-restful-vectordb.d.ts.map +1 -0
- package/dist/vectordb/milvus-restful-vectordb.js +406 -0
- package/dist/vectordb/milvus-restful-vectordb.js.map +1 -0
- package/dist/vectordb/milvus-vectordb.d.ts +34 -0
- package/dist/vectordb/milvus-vectordb.d.ts.map +1 -0
- package/dist/vectordb/milvus-vectordb.js +248 -0
- package/dist/vectordb/milvus-vectordb.js.map +1 -0
- package/dist/vectordb/types.d.ts +75 -0
- package/dist/vectordb/types.d.ts.map +1 -0
- package/dist/vectordb/types.js +9 -0
- package/dist/vectordb/types.js.map +1 -0
- package/dist/vectordb/zilliz-utils.d.ts +135 -0
- package/dist/vectordb/zilliz-utils.d.ts.map +1 -0
- package/dist/vectordb/zilliz-utils.js +192 -0
- package/dist/vectordb/zilliz-utils.js.map +1 -0
- package/package.json +56 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { VectorDocument, SearchOptions, VectorSearchResult, VectorDatabase } from './types';
|
|
2
|
+
export interface MilvusConfig {
|
|
3
|
+
address?: string;
|
|
4
|
+
token?: string;
|
|
5
|
+
username?: string;
|
|
6
|
+
password?: string;
|
|
7
|
+
ssl?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare class MilvusVectorDatabase implements VectorDatabase {
|
|
10
|
+
protected config: MilvusConfig;
|
|
11
|
+
private client;
|
|
12
|
+
protected initializationPromise: Promise<void>;
|
|
13
|
+
constructor(config: MilvusConfig);
|
|
14
|
+
private initialize;
|
|
15
|
+
private initializeClient;
|
|
16
|
+
/**
|
|
17
|
+
* Resolve address from config or token
|
|
18
|
+
* Common logic for both gRPC and REST implementations
|
|
19
|
+
*/
|
|
20
|
+
protected resolveAddress(): Promise<string>;
|
|
21
|
+
/**
|
|
22
|
+
* Ensure initialization is complete before method execution
|
|
23
|
+
*/
|
|
24
|
+
protected ensureInitialized(): Promise<void>;
|
|
25
|
+
createCollection(collectionName: string, dimension: number, description?: string): Promise<void>;
|
|
26
|
+
dropCollection(collectionName: string): Promise<void>;
|
|
27
|
+
hasCollection(collectionName: string): Promise<boolean>;
|
|
28
|
+
listCollections(): Promise<string[]>;
|
|
29
|
+
insert(collectionName: string, documents: VectorDocument[]): Promise<void>;
|
|
30
|
+
search(collectionName: string, queryVector: number[], options?: SearchOptions): Promise<VectorSearchResult[]>;
|
|
31
|
+
delete(collectionName: string, ids: string[]): Promise<void>;
|
|
32
|
+
query(collectionName: string, filter: string, outputFields: string[], limit?: number): Promise<Record<string, any>[]>;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=milvus-vectordb.d.ts.map
|
|
@@ -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,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC;IA+B7G,MAAM,CAAC,cAAc,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAS5D,KAAK,CAAC,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC;CA8B9H"}
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MilvusVectorDatabase = void 0;
|
|
4
|
+
const milvus2_sdk_node_1 = require("@zilliz/milvus2-sdk-node");
|
|
5
|
+
const types_1 = require("./types");
|
|
6
|
+
const zilliz_utils_1 = require("./zilliz-utils");
|
|
7
|
+
/**
|
|
8
|
+
* Wrapper function to handle collection creation with limit detection for gRPC client
|
|
9
|
+
* This is the single point where collection limit errors are detected and handled
|
|
10
|
+
*/
|
|
11
|
+
async function createCollectionWithLimitCheck(client, createCollectionParams) {
|
|
12
|
+
try {
|
|
13
|
+
await client.createCollection(createCollectionParams);
|
|
14
|
+
}
|
|
15
|
+
catch (error) {
|
|
16
|
+
// Check if the error message contains the collection limit exceeded pattern
|
|
17
|
+
const errorMessage = error.message || error.toString() || '';
|
|
18
|
+
if (/exceeded the limit number of collections/i.test(errorMessage)) {
|
|
19
|
+
// Throw the exact message string, not an Error object
|
|
20
|
+
throw types_1.COLLECTION_LIMIT_MESSAGE;
|
|
21
|
+
}
|
|
22
|
+
// Re-throw other errors as-is
|
|
23
|
+
throw error;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
class MilvusVectorDatabase {
|
|
27
|
+
constructor(config) {
|
|
28
|
+
this.client = null;
|
|
29
|
+
this.config = config;
|
|
30
|
+
// Start initialization asynchronously without waiting
|
|
31
|
+
this.initializationPromise = this.initialize();
|
|
32
|
+
}
|
|
33
|
+
async initialize() {
|
|
34
|
+
const resolvedAddress = await this.resolveAddress();
|
|
35
|
+
await this.initializeClient(resolvedAddress);
|
|
36
|
+
}
|
|
37
|
+
async initializeClient(address) {
|
|
38
|
+
const milvusConfig = this.config;
|
|
39
|
+
console.log('🔌 Connecting to vector database at: ', address);
|
|
40
|
+
this.client = new milvus2_sdk_node_1.MilvusClient({
|
|
41
|
+
address: address,
|
|
42
|
+
username: milvusConfig.username,
|
|
43
|
+
password: milvusConfig.password,
|
|
44
|
+
token: milvusConfig.token,
|
|
45
|
+
ssl: milvusConfig.ssl || false,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Resolve address from config or token
|
|
50
|
+
* Common logic for both gRPC and REST implementations
|
|
51
|
+
*/
|
|
52
|
+
async resolveAddress() {
|
|
53
|
+
let finalConfig = { ...this.config };
|
|
54
|
+
// If address is not provided, get it using token
|
|
55
|
+
if (!finalConfig.address && finalConfig.token) {
|
|
56
|
+
finalConfig.address = await zilliz_utils_1.ClusterManager.getAddressFromToken(finalConfig.token);
|
|
57
|
+
}
|
|
58
|
+
if (!finalConfig.address) {
|
|
59
|
+
throw new Error('Address is required and could not be resolved from token');
|
|
60
|
+
}
|
|
61
|
+
return finalConfig.address;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Ensure initialization is complete before method execution
|
|
65
|
+
*/
|
|
66
|
+
async ensureInitialized() {
|
|
67
|
+
await this.initializationPromise;
|
|
68
|
+
if (!this.client) {
|
|
69
|
+
throw new Error('Client not initialized');
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
async createCollection(collectionName, dimension, description) {
|
|
73
|
+
await this.ensureInitialized();
|
|
74
|
+
console.log('Beginning collection creation:', collectionName);
|
|
75
|
+
console.log('Collection dimension:', dimension);
|
|
76
|
+
const schema = [
|
|
77
|
+
{
|
|
78
|
+
name: 'id',
|
|
79
|
+
description: 'Document ID',
|
|
80
|
+
data_type: milvus2_sdk_node_1.DataType.VarChar,
|
|
81
|
+
max_length: 512,
|
|
82
|
+
is_primary_key: true,
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
name: 'vector',
|
|
86
|
+
description: 'Embedding vector',
|
|
87
|
+
data_type: milvus2_sdk_node_1.DataType.FloatVector,
|
|
88
|
+
dim: dimension,
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
name: 'content',
|
|
92
|
+
description: 'Document content',
|
|
93
|
+
data_type: milvus2_sdk_node_1.DataType.VarChar,
|
|
94
|
+
max_length: 65535,
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
name: 'relativePath',
|
|
98
|
+
description: 'Relative path to the codebase',
|
|
99
|
+
data_type: milvus2_sdk_node_1.DataType.VarChar,
|
|
100
|
+
max_length: 1024,
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
name: 'startLine',
|
|
104
|
+
description: 'Start line number of the chunk',
|
|
105
|
+
data_type: milvus2_sdk_node_1.DataType.Int64,
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
name: 'endLine',
|
|
109
|
+
description: 'End line number of the chunk',
|
|
110
|
+
data_type: milvus2_sdk_node_1.DataType.Int64,
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
name: 'fileExtension',
|
|
114
|
+
description: 'File extension',
|
|
115
|
+
data_type: milvus2_sdk_node_1.DataType.VarChar,
|
|
116
|
+
max_length: 32,
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
name: 'metadata',
|
|
120
|
+
description: 'Additional document metadata as JSON string',
|
|
121
|
+
data_type: milvus2_sdk_node_1.DataType.VarChar,
|
|
122
|
+
max_length: 65535,
|
|
123
|
+
},
|
|
124
|
+
];
|
|
125
|
+
const createCollectionParams = {
|
|
126
|
+
collection_name: collectionName,
|
|
127
|
+
description: description || `Code context collection: ${collectionName}`,
|
|
128
|
+
fields: schema,
|
|
129
|
+
};
|
|
130
|
+
await createCollectionWithLimitCheck(this.client, createCollectionParams);
|
|
131
|
+
// Create index
|
|
132
|
+
const indexParams = {
|
|
133
|
+
collection_name: collectionName,
|
|
134
|
+
field_name: 'vector',
|
|
135
|
+
index_type: 'AUTOINDEX',
|
|
136
|
+
metric_type: milvus2_sdk_node_1.MetricType.COSINE,
|
|
137
|
+
};
|
|
138
|
+
await this.client.createIndex(indexParams);
|
|
139
|
+
// Load collection to memory
|
|
140
|
+
await this.client.loadCollection({
|
|
141
|
+
collection_name: collectionName,
|
|
142
|
+
});
|
|
143
|
+
// Verify collection is created correctly
|
|
144
|
+
await this.client.describeCollection({
|
|
145
|
+
collection_name: collectionName,
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
async dropCollection(collectionName) {
|
|
149
|
+
await this.ensureInitialized();
|
|
150
|
+
await this.client.dropCollection({
|
|
151
|
+
collection_name: collectionName,
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
async hasCollection(collectionName) {
|
|
155
|
+
await this.ensureInitialized();
|
|
156
|
+
const result = await this.client.hasCollection({
|
|
157
|
+
collection_name: collectionName,
|
|
158
|
+
});
|
|
159
|
+
return Boolean(result.value);
|
|
160
|
+
}
|
|
161
|
+
async listCollections() {
|
|
162
|
+
await this.ensureInitialized();
|
|
163
|
+
const result = await this.client.showCollections();
|
|
164
|
+
// Handle the response format - cast to any to avoid type errors
|
|
165
|
+
const collections = result.collection_names || result.collections || [];
|
|
166
|
+
return Array.isArray(collections) ? collections : [];
|
|
167
|
+
}
|
|
168
|
+
async insert(collectionName, documents) {
|
|
169
|
+
await this.ensureInitialized();
|
|
170
|
+
console.log('Inserting documents into collection:', collectionName);
|
|
171
|
+
const data = documents.map(doc => ({
|
|
172
|
+
id: doc.id,
|
|
173
|
+
vector: doc.vector,
|
|
174
|
+
content: doc.content,
|
|
175
|
+
relativePath: doc.relativePath,
|
|
176
|
+
startLine: doc.startLine,
|
|
177
|
+
endLine: doc.endLine,
|
|
178
|
+
fileExtension: doc.fileExtension,
|
|
179
|
+
metadata: JSON.stringify(doc.metadata),
|
|
180
|
+
}));
|
|
181
|
+
await this.client.insert({
|
|
182
|
+
collection_name: collectionName,
|
|
183
|
+
data: data,
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
async search(collectionName, queryVector, options) {
|
|
187
|
+
await this.ensureInitialized();
|
|
188
|
+
const searchParams = {
|
|
189
|
+
collection_name: collectionName,
|
|
190
|
+
data: [queryVector],
|
|
191
|
+
limit: options?.topK || 10,
|
|
192
|
+
output_fields: ['id', 'content', 'relativePath', 'startLine', 'endLine', 'fileExtension', 'metadata'],
|
|
193
|
+
};
|
|
194
|
+
const searchResult = await this.client.search(searchParams);
|
|
195
|
+
if (!searchResult.results || searchResult.results.length === 0) {
|
|
196
|
+
return [];
|
|
197
|
+
}
|
|
198
|
+
return searchResult.results.map((result) => ({
|
|
199
|
+
document: {
|
|
200
|
+
id: result.id,
|
|
201
|
+
vector: queryVector,
|
|
202
|
+
content: result.content,
|
|
203
|
+
relativePath: result.relativePath,
|
|
204
|
+
startLine: result.startLine,
|
|
205
|
+
endLine: result.endLine,
|
|
206
|
+
fileExtension: result.fileExtension,
|
|
207
|
+
metadata: JSON.parse(result.metadata || '{}'),
|
|
208
|
+
},
|
|
209
|
+
score: result.score,
|
|
210
|
+
}));
|
|
211
|
+
}
|
|
212
|
+
async delete(collectionName, ids) {
|
|
213
|
+
await this.ensureInitialized();
|
|
214
|
+
await this.client.delete({
|
|
215
|
+
collection_name: collectionName,
|
|
216
|
+
filter: `id in [${ids.map(id => `"${id}"`).join(', ')}]`,
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
async query(collectionName, filter, outputFields, limit) {
|
|
220
|
+
await this.ensureInitialized();
|
|
221
|
+
try {
|
|
222
|
+
const queryParams = {
|
|
223
|
+
collection_name: collectionName,
|
|
224
|
+
filter: filter,
|
|
225
|
+
output_fields: outputFields,
|
|
226
|
+
};
|
|
227
|
+
// Add limit if provided, or default for empty filter expressions
|
|
228
|
+
if (limit !== undefined) {
|
|
229
|
+
queryParams.limit = limit;
|
|
230
|
+
}
|
|
231
|
+
else if (filter === '' || filter.trim() === '') {
|
|
232
|
+
// Milvus requires limit when using empty expressions
|
|
233
|
+
queryParams.limit = 16384; // Default limit for empty filters
|
|
234
|
+
}
|
|
235
|
+
const result = await this.client.query(queryParams);
|
|
236
|
+
if (result.status.error_code !== 'Success') {
|
|
237
|
+
throw new Error(`Failed to query Milvus: ${result.status.reason}`);
|
|
238
|
+
}
|
|
239
|
+
return result.data || [];
|
|
240
|
+
}
|
|
241
|
+
catch (error) {
|
|
242
|
+
console.error(`❌ Failed to query collection '${collectionName}':`, error);
|
|
243
|
+
throw error;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
exports.MilvusVectorDatabase = MilvusVectorDatabase;
|
|
248
|
+
//# sourceMappingURL=milvus-vectordb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"milvus-vectordb.js","sourceRoot":"","sources":["../../src/vectordb/milvus-vectordb.ts"],"names":[],"mappings":";;;AAAA,+DAA8E;AAC9E,mCAMiB;AACjB,iDAAgD;AAUhD;;;GAGG;AACH,KAAK,UAAU,8BAA8B,CACzC,MAAoB,EACpB,sBAA2B;IAE3B,IAAI,CAAC;QACD,MAAM,MAAM,CAAC,gBAAgB,CAAC,sBAAsB,CAAC,CAAC;IAC1D,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QAClB,4EAA4E;QAC5E,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC;QAC7D,IAAI,2CAA2C,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC;YACjE,sDAAsD;YACtD,MAAM,gCAAwB,CAAC;QACnC,CAAC;QACD,8BAA8B;QAC9B,MAAM,KAAK,CAAC;IAChB,C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
|
2
|
+
id: string;
|
|
3
|
+
vector: number[];
|
|
4
|
+
content: string;
|
|
5
|
+
relativePath: string;
|
|
6
|
+
startLine: number;
|
|
7
|
+
endLine: number;
|
|
8
|
+
fileExtension: string;
|
|
9
|
+
metadata: Record<string, any>;
|
|
10
|
+
}
|
|
11
|
+
export interface SearchOptions {
|
|
12
|
+
topK?: number;
|
|
13
|
+
filter?: Record<string, any>;
|
|
14
|
+
threshold?: number;
|
|
15
|
+
}
|
|
16
|
+
export interface VectorSearchResult {
|
|
17
|
+
document: VectorDocument;
|
|
18
|
+
score: number;
|
|
19
|
+
}
|
|
20
|
+
export interface VectorDatabase {
|
|
21
|
+
/**
|
|
22
|
+
* Create collection
|
|
23
|
+
* @param collectionName Collection name
|
|
24
|
+
* @param dimension Vector dimension
|
|
25
|
+
* @param description Collection description
|
|
26
|
+
*/
|
|
27
|
+
createCollection(collectionName: string, dimension: number, description?: string): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Drop collection
|
|
30
|
+
* @param collectionName Collection name
|
|
31
|
+
*/
|
|
32
|
+
dropCollection(collectionName: string): Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* Check if collection exists
|
|
35
|
+
* @param collectionName Collection name
|
|
36
|
+
*/
|
|
37
|
+
hasCollection(collectionName: string): Promise<boolean>;
|
|
38
|
+
/**
|
|
39
|
+
* List all collections
|
|
40
|
+
*/
|
|
41
|
+
listCollections(): Promise<string[]>;
|
|
42
|
+
/**
|
|
43
|
+
* Insert vector documents
|
|
44
|
+
* @param collectionName Collection name
|
|
45
|
+
* @param documents Document array
|
|
46
|
+
*/
|
|
47
|
+
insert(collectionName: string, documents: VectorDocument[]): Promise<void>;
|
|
48
|
+
/**
|
|
49
|
+
* Search similar vectors
|
|
50
|
+
* @param collectionName Collection name
|
|
51
|
+
* @param queryVector Query vector
|
|
52
|
+
* @param options Search options
|
|
53
|
+
*/
|
|
54
|
+
search(collectionName: string, queryVector: number[], options?: SearchOptions): Promise<VectorSearchResult[]>;
|
|
55
|
+
/**
|
|
56
|
+
* Delete documents
|
|
57
|
+
* @param collectionName Collection name
|
|
58
|
+
* @param ids Document ID array
|
|
59
|
+
*/
|
|
60
|
+
delete(collectionName: string, ids: string[]): Promise<void>;
|
|
61
|
+
/**
|
|
62
|
+
* Query documents by filter
|
|
63
|
+
* @param collectionName Collection name
|
|
64
|
+
* @param filter Filter expression string
|
|
65
|
+
* @param outputFields Fields to return
|
|
66
|
+
* @param limit Maximum number of results to return (optional)
|
|
67
|
+
*/
|
|
68
|
+
query(collectionName: string, filter: string, outputFields: string[], limit?: number): Promise<Record<string, any>[]>;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Special error message for collection limit exceeded
|
|
72
|
+
* This allows us to distinguish it from other errors across all Milvus implementations
|
|
73
|
+
*/
|
|
74
|
+
export declare const COLLECTION_LIMIT_MESSAGE = "[Error]: Your Zilliz Cloud account has hit its collection limit. To continue creating collections, you'll need to expand your capacity. We recommend visiting https://zilliz.com/pricing to explore options for dedicated or serverless clusters.";
|
|
75
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/vectordb/types.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,cAAc;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACjC;AAED,MAAM,WAAW,aAAa;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC7B,S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1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.COLLECTION_LIMIT_MESSAGE = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Special error message for collection limit exceeded
|
|
6
|
+
* This allows us to distinguish it from other errors across all Milvus implementations
|
|
7
|
+
*/
|
|
8
|
+
exports.COLLECTION_LIMIT_MESSAGE = "[Error]: Your Zilliz Cloud account has hit its collection limit. To continue creating collections, you'll need to expand your capacity. We recommend visiting https://zilliz.com/pricing to explore options for dedicated or serverless clusters.";
|
|
9
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/vectordb/types.ts"],"names":[],"mappings":";;;AAiFA;;;GAGG;AACU,QAAA,wBAAwB,GAAG,mPAAmP,CAAC"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
export interface ZillizConfig {
|
|
2
|
+
baseUrl?: string;
|
|
3
|
+
token?: string;
|
|
4
|
+
}
|
|
5
|
+
export interface Project {
|
|
6
|
+
projectId: string;
|
|
7
|
+
projectName: string;
|
|
8
|
+
instanceCount: number;
|
|
9
|
+
createTime: string;
|
|
10
|
+
}
|
|
11
|
+
export interface Cluster {
|
|
12
|
+
clusterId: string;
|
|
13
|
+
clusterName: string;
|
|
14
|
+
description: string;
|
|
15
|
+
regionId: string;
|
|
16
|
+
plan: string;
|
|
17
|
+
cuType: string;
|
|
18
|
+
cuSize: number;
|
|
19
|
+
status: string;
|
|
20
|
+
connectAddress: string;
|
|
21
|
+
privateLinkAddress: string;
|
|
22
|
+
projectId: string;
|
|
23
|
+
createTime: string;
|
|
24
|
+
}
|
|
25
|
+
export interface CreateFreeClusterRequest {
|
|
26
|
+
clusterName: string;
|
|
27
|
+
projectId: string;
|
|
28
|
+
regionId: string;
|
|
29
|
+
}
|
|
30
|
+
export interface CreateFreeClusterResponse {
|
|
31
|
+
clusterId: string;
|
|
32
|
+
username: string;
|
|
33
|
+
password: string;
|
|
34
|
+
prompt: string;
|
|
35
|
+
}
|
|
36
|
+
export interface CreateFreeClusterWithDetailsResponse extends CreateFreeClusterResponse {
|
|
37
|
+
clusterDetails: DescribeClusterResponse;
|
|
38
|
+
}
|
|
39
|
+
export interface ListProjectsResponse {
|
|
40
|
+
code: number;
|
|
41
|
+
data: Project[];
|
|
42
|
+
}
|
|
43
|
+
export interface ListClustersResponse {
|
|
44
|
+
code: number;
|
|
45
|
+
data: {
|
|
46
|
+
count: number;
|
|
47
|
+
currentPage: number;
|
|
48
|
+
pageSize: number;
|
|
49
|
+
clusters: Cluster[];
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
export interface CreateFreeClusterApiResponse {
|
|
53
|
+
code: number;
|
|
54
|
+
data: CreateFreeClusterResponse;
|
|
55
|
+
}
|
|
56
|
+
export interface DescribeClusterResponse {
|
|
57
|
+
clusterId: string;
|
|
58
|
+
clusterName: string;
|
|
59
|
+
projectId: string;
|
|
60
|
+
description: string;
|
|
61
|
+
regionId: string;
|
|
62
|
+
cuType: string;
|
|
63
|
+
plan: string;
|
|
64
|
+
status: string;
|
|
65
|
+
connectAddress: string;
|
|
66
|
+
privateLinkAddress: string;
|
|
67
|
+
createTime: string;
|
|
68
|
+
cuSize: number;
|
|
69
|
+
storageSize: number;
|
|
70
|
+
snapshotNumber: number;
|
|
71
|
+
createProgress: number;
|
|
72
|
+
}
|
|
73
|
+
export interface DescribeClusterApiResponse {
|
|
74
|
+
code: number;
|
|
75
|
+
data: DescribeClusterResponse;
|
|
76
|
+
}
|
|
77
|
+
export interface ErrorResponse {
|
|
78
|
+
code: number;
|
|
79
|
+
message: string;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Zilliz Cloud cluster manager
|
|
83
|
+
* For managing Zilliz Cloud projects and clusters
|
|
84
|
+
* See https://docs.zilliz.com/reference/restful/list-clusters-v2 for more details
|
|
85
|
+
*/
|
|
86
|
+
export declare class ClusterManager {
|
|
87
|
+
private baseUrl;
|
|
88
|
+
private token;
|
|
89
|
+
constructor(config?: ZillizConfig);
|
|
90
|
+
/**
|
|
91
|
+
* Generic method for sending HTTP requests
|
|
92
|
+
*/
|
|
93
|
+
private makeRequest;
|
|
94
|
+
/**
|
|
95
|
+
* List all projects
|
|
96
|
+
* @returns List of projects
|
|
97
|
+
*/
|
|
98
|
+
listProjects(): Promise<Project[]>;
|
|
99
|
+
/**
|
|
100
|
+
* List all clusters
|
|
101
|
+
* @param projectId Optional project ID filter
|
|
102
|
+
* @param pageSize Page size, default 10
|
|
103
|
+
* @param currentPage Current page number, default 1
|
|
104
|
+
* @returns Cluster list with pagination info
|
|
105
|
+
*/
|
|
106
|
+
listClusters(projectId?: string, pageSize?: number, currentPage?: number): Promise<{
|
|
107
|
+
clusters: Cluster[];
|
|
108
|
+
count: number;
|
|
109
|
+
currentPage: number;
|
|
110
|
+
pageSize: number;
|
|
111
|
+
}>;
|
|
112
|
+
/**
|
|
113
|
+
* Describe cluster details
|
|
114
|
+
* @param clusterId Cluster ID to describe
|
|
115
|
+
* @returns Cluster details
|
|
116
|
+
*/
|
|
117
|
+
describeCluster(clusterId: string): Promise<DescribeClusterResponse>;
|
|
118
|
+
/**
|
|
119
|
+
* Create free cluster and wait for it to be ready
|
|
120
|
+
* @param request Request parameters for creating cluster
|
|
121
|
+
* @param timeoutMs Timeout in milliseconds, default 5 minutes
|
|
122
|
+
* @param pollIntervalMs Polling interval in milliseconds, default 5 seconds
|
|
123
|
+
* @returns Creation result including cluster ID, username, password and cluster details
|
|
124
|
+
*/
|
|
125
|
+
createFreeCluster(request: CreateFreeClusterRequest, timeoutMs?: number, // 5 minutes default
|
|
126
|
+
pollIntervalMs?: number): Promise<CreateFreeClusterWithDetailsResponse>;
|
|
127
|
+
/**
|
|
128
|
+
* Static utility method to get address from token using Zilliz Cloud API
|
|
129
|
+
* This method will find or create a cluster and return its connect address
|
|
130
|
+
* @param token Zilliz Cloud API token
|
|
131
|
+
* @returns Connect address for the cluster
|
|
132
|
+
*/
|
|
133
|
+
static getAddressFromToken(token?: string): Promise<string>;
|
|
134
|
+
}
|
|
135
|
+
//# sourceMappingURL=zilliz-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zilliz-utils.d.ts","sourceRoot":"","sources":["../../src/vectordb/zilliz-utils.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,YAAY;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,OAAO;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,OAAO;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,wBAAwB;IACrC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,yBAAyB;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,oCAAqC,SAAQ,yBAAyB;IACnF,cAAc,EAAE,uBAA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