Skip to main content

Inference Engine

@idiomark/inference is the core Idiomark product — it applies personality characterization to AI responses. Load a Idiomark file, point the engine at a provider, and every response comes back in-character.

Installation​

pnpm add @idiomark/inference

Quick Start​

import { InferenceEngine, createPrompt } from "@idiomark/inference";

// Load a Idiomark personality file
const myIdiomark = JSON.parse(fs.readFileSync("my-personality.idiomark.json"));

// Create the engine
const engine = new InferenceEngine({
idiomark: myIdiomark,
provider: "anthropic",
mode: "balanced",
});

// Get personality-enhanced responses
const response = await engine.respond("How do I center a div?");
console.log(response.content);
// "Sure thing! 🚀 Just use flexbox or grid..."

Response Modes​

Control how strongly the personality influences output:

ModeDescription
strictFollow personality exactly — every response is fully in-character
balancedPersonality + helpfulness (default) — natural blend
subtleLight personality touch — minimal stylistic influence
customUser-defined mix — fine-grained control

Prompt Utilities​

Build personality-aware prompts directly:

import { createPrompt, applyPersonality } from "@idiomark/inference";

// Create a system prompt from Idiomark data
const systemPrompt = createPrompt(idiomarkFile);

// Apply personality to any message
const enhanced = applyPersonality(message, idiomarkFile);

API Reference​

MethodDescription
respond(message)Get personality-enhanced response
setPersonality(idiomark)Update the active personality
setMode(mode)Change response mode
setContext(context)Set conversation history
clearContext()Clear conversation history

Exports​

// Engine
export { InferenceEngine } from "./inference";

// Types
export type {
InferenceOptions,
InferenceResponse,
ResponseMode,
} from "./types";

// Utilities
export { createPrompt, applyPersonality } from "./prompts";
  • SDK — Core SDK for Idiomark file operations
  • CLI — Manage Idiomark files from the command line
  • Examples — End-to-end usage examples