Skip to main content

LogSpanFunctionContent

Span content for custom application logic. Use this type when logging functions in your own codebase — data transformations, business rules, preprocessing steps, or any operation that isn’t an LLM call, tool invocation, or retrieval.

Import

import type { LogSpanFunctionContent } from '@adaline/api';
import { LogSpanFunctionContentTypeEnum } from '@adaline/api';

Type Definition

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

Properties

  • type - Discriminator field, always 'Function' for this content type
  • input - The function arguments as a JSON string (JSON.stringify() of the input parameters)
  • output - The function return value as a JSON string (JSON.stringify() of the result)
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

function classifyIntent(message: string): { intent: string; confidence: number } {
  // custom classification logic
  return { intent: 'billing_inquiry', confidence: 0.92 };
}

const input = { message: 'Where is my invoice?' };
const result = classifyIntent(input.message);

span.update({
  content: {
    type: 'Function',
    input: JSON.stringify(input),
    output: JSON.stringify(result),
  },
});

  • LogSpanContent — union type that includes LogSpanFunctionContent
  • LogSpanToolContent — for external tool/function-call executions triggered by an LLM
  • Span — class that accepts LogSpanContent via span.update()