xsAI v0.1 is now available! Read Announcement
xsAI0.2.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'
})
Edit on GitHub

Last updated on

On this page