Modular
Write functions powered by LLM's with easy to use building blocks.
A package that provides simplified base components to make building and maintaining LLM-powered applications easier.
const PROMPT = `You are a senior TypeScript developer.
Write a concise implementation for the task: "{{spec}}".
Respond with only the code (no questions or explanation), inside a single ts code block`;
export async function writeCodeFromSpec(spec: string) {
const llm = useLlm("openai.gpt-4o-mini"); // change this if you want
const prompt = createChatPrompt<{ spec: string }>(PROMPT);
const parser = createParser("markdownCodeBlock");
const executor = createLlmExecutor({ llm, prompt, parser });
return executor.execute({ spec });
}
const code = await writeCodeFromSpec("add two numbers together");
console.log(code.code); // => function add(a: number, b: number) { ... }