Scrydon
IntegrationsCapabilities

Embedding

Implement vector embedding generation for retrieval-augmented agents and managed-table embedding columns.

Embedding capabilities power retrieval, semantic search, and any pipeline that needs dense vectors. Models must declare their output dimension.

Define the capability

import { defineCapabilityEmbedding } from "@scrydon/sdk-authoring/integrations/define";

const embeddingCapability = defineCapabilityEmbedding({
  models: [
    {
      id: "text-embedding-v1",
      name: "Text Embedding V1",
      dimension: 1536,
      benchmarks: [{ name: "MTEB Average", score: 62.3, source: "MTEB Leaderboard" }],
    },
    {
      id: "text-embedding-v2",
      name: "Text Embedding V2",
      dimension: 3072,
      benchmarks: [
        { name: "MTEB Average",   score: 64.6, source: "MTEB Leaderboard" },
        { name: "MIRACL Average", score: 54.9, source: "MTEB Leaderboard" },
      ],
    },
  ],
  defaultModel: "text-embedding-v1",
  async embed(request) {
    const response = await fetch("https://api.example.com/v1/embeddings", {
      method: "POST",
      headers: {
        Authorization: `Bearer ${request.apiKey}`,
        "Content-Type": "application/json",
      },
      body: JSON.stringify({ model: request.model, input: request.input }),
    });
    const data = await response.json();
    return {
      embeddings: data.data.map((d: any) => d.embedding),
      model: request.model ?? "text-embedding-v1",
      usage: {
        promptTokens: data.usage.prompt_tokens,
        totalTokens: data.usage.total_tokens,
      },
    };
  },
});

Model metadata

FieldTypeRequiredDescription
idstringyesUnique model identifier (e.g. "text-embedding-v2")
namestringyesDisplay name in the UI
dimensionnumberyesOutput vector dimension (e.g. 1536, 3072)
benchmarksBenchmarkScore[]noMTEB / MIRACL — higher is better

dimension is required because the platform pre-allocates pgvector columns and rejects writes that don't match. Set it once per model — never change after publish.

On this page

On this page