API Reference

Detailed API documentation for the @mzhub/promptc package.

# defineSchema

Defines the structure of prompts inputs and outputs using Zod schemas.

function defineSchema<I, O>(config: {
  description?: string;
  inputs: { [key: string]: ZodType<I> };
  outputs: { [key: string]: ZodType<O> };
}): Schema<I, O>

# createProvider

Initialize an LLM provider connection.

function createProvider(
  type: "cerebras" | "openai" | "anthropic",
  config: { apiKey: string; model?: string }
): Provider

Programs

Predict

Direct input-to-output mapping. Best for simple extraction or classification tasks where reasoning isn't required.

ChainOfThought

Adds a "reasoning" step before generating the output. Improves performance on complex tasks by allowing the model to "think" before answering.

Compilers

BootstrapFewShot

Self-improves only using the training set. It generates rationale for training examples and selects the best few-shot demonstrations to maximize the metric.

InstructionRewrite

Optimizes the system prompt instructions to better align with the intent of the task and the training data.