Skip to content

Examples ​

The examples/ directory in the repository contains self-contained TypePrompt projects demonstrating specific features, from basic text generation to advanced tool calling and namespaced schemas.

Example projects ​

DirectoryDescriptionKey features
01-basicsGetting started with basic text generationSimple prompt template with text output and few-shot examples
02-complex-typesComplex input and output types<meta>, structured object output, recursive discriminated unions (PageNode), TOON-formatted input (format="toon"), YAML-formatted input (format="yaml")
03-toolsTyped tool definitions and multi-step execution<tool>, <tools> registration, few-shot examples with intermediate tool calls
04-variantsMultiple prompt variations sharing schemas<variant>, per-variant system prompts and few-shot examples, runtime selection via Input.variant
05-conditional-logicModular text composition and conditional logic<snippet>, conditional snippets (if/then/else), switch snippets, <insert snippet="...">
06-shared-typesReusable types in the default namespace<namespace name="Main">, shared types referenced via shared.TypeName
07-namespacesMulti-namespace project organizationNamed namespaces (Finance, Legal), isolated shared types, domain-specific tools and templates

End-to-end applications ​

DirectoryDescriptionStack
e2e-kotlinRunnable CLI translation tool with structured JSON output calling OpenAIKotlin, Gradle, OpenAI Java SDK
e2e-pythonRunnable city day-planner with weather tool and structured JSON output calling ClaudePython, Anthropic Python SDK
e2e-rustRunnable SRE incident commander with service metrics tool and structured JSON output calling Google GeminiRust, Cargo, Google Gemini API

Made with 🩷 in New York and outer space