File tree Expand file tree Collapse file tree 4 files changed +48
-0
lines changed Expand file tree Collapse file tree 4 files changed +48
-0
lines changed Original file line number Diff line number Diff line change 7070 * @property {string? } [displayName]
7171 */
7272
73+ /**
74+ * @typedef {Object } SuccessFailResponse
75+ * @property {any[] } success
76+ * @property {any[] } fail
77+ */
78+
7379export default { } ;
Original file line number Diff line number Diff line change 115115 * @property {number } data_count
116116 */
117117
118+ /**
119+ * @typedef {Object } VectorCollectionIndexOptions
120+ * @property {string } field_name
121+ * @property {string } field_schema_type
122+ */
123+
118124export default { } ;
Original file line number Diff line number Diff line change @@ -98,6 +98,8 @@ export const endpoints = {
9898 vectorKnowledgeUploadUrl : `${ host } /knowledge/vector/{collection}/upload` ,
9999 vectorCollectionCreateUrl : `${ host } /knowledge/vector/create-collection` ,
100100 vectorCollectionDeleteUrl : `${ host } /knowledge/vector/{collection}/delete-collection` ,
101+ vectorIndexesCreateUrl : `${ host } /knowledge/vector/{collection}/payload/indexes` ,
102+ vectorIndexesDeleteUrl : `${ host } /knowledge/vector/{collection}/payload/indexes` ,
101103
102104 graphKnowledgeSearchUrl : `${ host } /knowledge/graph/search` ,
103105
Original file line number Diff line number Diff line change @@ -240,4 +240,38 @@ export async function getVectorCollectionDetails(collection) {
240240
241241 const response = await axios . get ( url ) ;
242242 return response . data ;
243+ }
244+
245+ /**
246+ * @param {string } collection
247+ * @param {import('$knowledgeTypes').VectorCollectionIndexOptions[] } options
248+ * @returns {Promise<import('$commonTypes').SuccessFailResponse> }
249+ */
250+ export async function createVectorIndexes ( collection , options ) {
251+ const url = replaceUrl ( endpoints . vectorIndexesCreateUrl , {
252+ collection : collection
253+ } ) ;
254+
255+ const response = await axios . post ( url , {
256+ options : options || [ ]
257+ } ) ;
258+ return response . data ;
259+ }
260+
261+ /**
262+ * @param {string } collection
263+ * @param {import('$knowledgeTypes').VectorCollectionIndexOptions[] } options
264+ * @returns {Promise<import('$commonTypes').SuccessFailResponse> }
265+ */
266+ export async function deleteVectorIndexes ( collection , options ) {
267+ const url = replaceUrl ( endpoints . vectorIndexesDeleteUrl , {
268+ collection : collection
269+ } ) ;
270+
271+ const response = await axios . delete ( url , {
272+ data : {
273+ options : options || [ ]
274+ }
275+ } ) ;
276+ return response . data ;
243277}
You can’t perform that action at this time.
0 commit comments