Skip to main content

fetch

Fetches vectors based on the provided IDs.

fetch(ids: string[]): Promise<FetchResponse[]>

Reference

import { myVectorStore } from "#elements";
export default async function () {
const vectors = await myVectorStore.fetch(["1", "2", "3"]);
console.log(JSON.stringify(vectors, null, 2));
}

Parameters

  • ids: An array of IDs of the vectors to fetch.

Returns

Promise of an array of FetchResponse objects, each containing the ID, vector, and metadata of a vector.

  • id: The ID of the vector.
  • vector: The vector.
  • metadata: (Optional) The metadata of the vector.

Caveats

  • If a vector with a given ID does not exist, it will not be included in the response.