xsAI v0.3 "future base" is now available! Read Announcement
xsAI0.4.0-beta.1

Embeddings

Get a vector representation of a given input.

install sizeminified sizeminzipped size
npm i @xsai/embed

Examples

embed

import {  } from '@xsai/embed'
import {  } from 'node:process'

const {  } = await ({
  : .!,
  : 'https://api.openai.com/v1/',
  : 'sunny day at the beach',
  : 'text-embedding-3-large',
})

embedMany

import {  } from '@xsai/embed'
import {  } from 'node:process'

const {  } = await ({
  : .!,
  : 'https://api.openai.com/v1/',
  : [
    'sunny day at the beach',
    'rainy afternoon in the city',
    'snowy night in the mountains',
  ],
  : 'text-embedding-3-large'
})