BotConnector
Sign in Workspace Open App

TypeScript embeddings

Beta

Target SDK design

typescript
import { BotConnectorClient } from "@botconnector/sdk";

const client = new BotConnectorClient();
const embedding = client.embedding("<publisher>/<embedding-model>");
const vectors = await embedding.embed(["First text", "Second text"]);
The source SDK is implemented and live-tested, but no npm package is published yet.

Working today via OpenAI-compatible API

typescript
import OpenAI from "openai";

const client = new OpenAI({ baseURL: "http://127.0.0.1:11435/v1", apiKey: "not-needed" });
const resp = await client.embeddings.create({
  model: "<publisher>/<embedding-model>",
  input: ["First text", "Second text"],
});
const vectors = resp.data.map((d) => d.embedding);

Prerequisite: an embedding model loaded — Embeddings, POST /v1/embeddings.