deleteAll
Deletes all vectors based on the provided filters.
deleteAll(filters?: Record<string, any>): Promise<number>;
Reference
import { myVectorStore } from "#elements";
export default async function () {
const count = await myVectorStore.deleteAll();
console.log(`${count} vectors deleted`);
}
Parameters
filters
: (Optional) Filters to apply. If no filters are provided, all vectors are deleted.
Returns
Promise of the number of vectors deleted.
Caveats
- Exercise caution when using this method. If no filters are set, all vectors will be deleted.
Examples
In the HTTP Element, delete all data in the VectorStore Element that matches the key-value pairs included in filters:
import * as Koa from "koa";
import { myVectorStore } from "#elements";
export default async function (
request: Koa.Request,
response: Koa.Response,
ctx: Koa.Context
) {
const count = await myVectorStore.deleteAll({
source: "https://example.com",
});
console.log(`${count} vectors deleted`);
return true;
}