async function getEmbeddingsUSE()

in firestore-semantic-search/functions/src/common/use_embeddings.ts [29:37]


async function getEmbeddingsUSE(text: string | string[]): Promise<number[][]> {
  if (!model && (typeof text !== 'string' || text.length !== 0)) {
    model = await use.load();
  }

  const embeddings = await model.embed(text.length ? text : [text]);

  return embeddings.arraySync();
}