Skip to main content

LogSpanEmbeddingsContent

Span content for embedding generation calls. Use this type when logging operations that convert text into vector representations, such as calls to OpenAI’s text-embedding-3-large or similar models.

Import

import type { LogSpanEmbeddingsContent } from '@adaline/api';
import { LogSpanEmbeddingsContentTypeEnum } from '@adaline/api';

Type Definition

interface LogSpanEmbeddingsContent {
  type: 'Embeddings';
  input: string;                   // JSON string (must be valid JSON)
  output: string;                  // JSON string (must be valid JSON)
}

Properties

  • type - Discriminator field, always 'Embeddings' for this content type
  • input - The embedding request as a JSON string (JSON.stringify() of the request object)
  • output - The embedding response as a JSON string (JSON.stringify() of the response object)
Both input and output must be valid, parseable JSON strings (the result of JSON.stringify()). Passing a plain string that isn’t valid JSON will cause the span to be rejected.

Example

import OpenAI from 'openai';

const openai = new OpenAI();

const params = {
  model: 'text-embedding-3-large',
  input: ['What is quantum computing?', 'Explain neural networks.'],
  dimensions: 3072,
};

const response = await openai.embeddings.create(params);

span.update({
  content: {
    type: 'Embeddings',
    input: JSON.stringify(params),
    output: JSON.stringify(response),
  },
});

  • LogSpanContent — union type that includes LogSpanEmbeddingsContent
  • LogSpanRetrievalContent — often used alongside embeddings for RAG pipelines
  • Span — class that accepts LogSpanContent via span.update()