Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Langfuse Langfuse Postgres Seed Constants

From Leeroopedia
Knowledge Sources
Domains Seed Data, Configuration, Database Seeding
Last Updated 2026-02-14 00:00 GMT

Overview

Defines all constant seed data for PostgreSQL seeding, including dataset items, prompt templates, evaluator configurations, and control parameters.

Description

This TypeScript file contains all the static constant data used by the PostgreSQL seeder (seed-postgres.ts) and the ClickHouse data generators. It exports the following major constant groups:

Dataset Item Arrays:

  • SEED_DATASET_ITEMS_COUNTRIES -- 51 country-capital pairs (France/Paris, Germany/Berlin, etc.)
  • SEED_DATASET_ITEMS_IPA -- 100 English word to IPA transcription pairs (the/ðə, be/bi, etc.)
  • SEED_DATASET_ITEMS_MATH -- 3 basic math operations (2+2=4, 10-5=5, 3*4=12)
  • SEED_DATASET_ITEMS_COLORS -- 3 color-to-hex mappings (red/#FF0000, blue/#0000FF, green/#00FF00)
  • SEED_DATASET_ITEMS_SIMPLE -- 3 name echo items (John, Jane, Jim)
  • SEED_DATASET_ITEMS_GREETINGS -- 4 language-to-greeting pairs (English/Hello, Spanish/Hola, etc.)
  • SEED_DATASET_ITEMS_VERSION_TEST -- 1 item for testing dataset versioning

Dataset Configurations (SEED_DATASETS): Seven datasets configured with name, description, metadata, items, and a shouldRunExperiment flag. Two datasets (countries, IPA transcription) are configured for experiment runs. Datasets use folder-style naming (e.g., "folder/math/basic-operations") to test hierarchical organization.

Prompt Constants:

  • SEED_TEXT_PROMPTS -- 12 text prompts including a parent-child prompt pair with dependency syntax (@@@langfusePrompt:name=child-prompt|label=production@@@), experiment prompts, folder-organized prompts, and a prompt with 50 labels for testing label management at scale.
  • SEED_CHAT_ML_PROMPTS -- 2 ChatML prompts: one standard multi-turn conversation and one with a placeholder message (type: "placeholder", name: "message_history").
  • SEED_PROMPT_VERSIONS -- 4 versioned prompts including a comprehensive filter-condition chat prompt (for the get-filter-conditions-from-query system) and 3 versions of prompt-4-with-variable-and-config with increasing config complexity.

Evaluator Constants:

  • SEED_EVALUATOR_TEMPLATES -- 1 toxicity evaluation template using gpt-3.5-turbo with prompt, model params, vars, and output schema.
  • SEED_EVALUATOR_CONFIGS -- 1 toxicity evaluation job configuration with filter, variable mapping, target object, sampling rate, and delay.

Control Parameters:

  • EVAL_TRACE_COUNT -- 100 (number of evaluation traces per project)
  • FAILED_EVAL_TRACE_INTERVAL -- 10 (every 10th trace is marked as failed)

Usage

Use this file when:

  • Adding new dataset items or datasets to the seed data.
  • Modifying prompt templates for development testing.
  • Changing evaluator configurations for the seed environment.
  • Understanding the structure and content of Langfuse seed data.

Code Reference

Source Location

Signature

// Datasets
export const SEED_DATASETS: Array<{
  name: string;
  description: string;
  metadata: Record<string, string>;
  items: Array<{ input: Record<string, string>; output: string }>;
  shouldRunExperiment: boolean;
}>;

// Prompts
export const SEED_TEXT_PROMPTS: Array<{
  id: string;
  createdBy: string;
  prompt: string;
  name: string;
  version: number;
  labels: string[];
  tags?: string[];
}>;

export const SEED_CHAT_ML_PROMPTS: Array<{
  id: string;
  createdBy: string;
  prompt: Array<{ role: string; content?: string; type?: string; name?: string }>;
  name: string;
  version: number;
  labels: string[];
  tags: string[];
}>;

export const SEED_PROMPT_VERSIONS: Array<{...}>;

// Evaluators
export const SEED_EVALUATOR_TEMPLATES: Array<{
  id: string; name: string; version: number;
  prompt: string; model: string; vars: string[];
  provider: string; outputSchema: Record<string, string>;
  modelParams: Record<string, number>;
}>;

export const SEED_EVALUATOR_CONFIGS: Array<{
  id: string; evalTemplateId: string; jobType: string;
  status: string; scoreName: string; filter: Array<{...}>;
  variableMapping: Array<{...}>; targetObject: string;
  sampling: number; delay: number;
}>;

// Control parameters
export const EVAL_TRACE_COUNT: number;          // 100
export const FAILED_EVAL_TRACE_INTERVAL: number; // 10

Import

import {
  SEED_DATASETS,
  SEED_TEXT_PROMPTS,
  SEED_CHAT_ML_PROMPTS,
  SEED_PROMPT_VERSIONS,
  SEED_EVALUATOR_TEMPLATES,
  SEED_EVALUATOR_CONFIGS,
  EVAL_TRACE_COUNT,
  FAILED_EVAL_TRACE_INTERVAL,
} from "./utils/postgres-seed-constants";

I/O Contract

Inputs

Name Type Required Description
N/A N/A N/A This is a constants file with no runtime inputs. All data is statically defined.

Outputs

Name Type Description
SEED_DATASETS Array (7 datasets) Dataset configurations with items for countries, IPA, math, colors, names, greetings, and versioning
SEED_TEXT_PROMPTS Array (12 prompts) Text prompt definitions with names, labels, tags, and content
SEED_CHAT_ML_PROMPTS Array (2 prompts) ChatML prompt definitions with multi-turn message arrays
SEED_PROMPT_VERSIONS Array (4 versions) Versioned prompt configurations including a comprehensive filter-condition prompt
SEED_EVALUATOR_TEMPLATES Array (1 template) Toxicity evaluation template definition
SEED_EVALUATOR_CONFIGS Array (1 config) Toxicity evaluation job configuration
EVAL_TRACE_COUNT number (100) Number of evaluation traces to generate per project
FAILED_EVAL_TRACE_INTERVAL number (10) Interval for simulating failed evaluations

Usage Examples

import { SEED_DATASETS, EVAL_TRACE_COUNT } from "./utils/postgres-seed-constants";

// Iterate over datasets to create seed data
for (const dataset of SEED_DATASETS) {
  console.log(`Creating dataset: ${dataset.name} with ${dataset.items.length} items`);
  if (dataset.shouldRunExperiment) {
    console.log("  -> Will create experiment runs");
  }
}

// Use eval trace count for generating evaluation data
for (let i = 0; i < EVAL_TRACE_COUNT; i++) {
  // Generate evaluation trace...
}

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment