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.
export const instruction = `You are not an assistant, I need you to reply with only
'yes' or 'no' as an answer to the question below. Do not explain yourself
or ask questions. Answer with only yes or no.`;
export const prompt = createChatPrompt(instruction)
.addUserMessage(input)
.addSystemMessage(`yes or no:`);
export async function YesOrNoBot<I extends string>(
input: I
): Promise<{ response: string }> {
const llm = useLlm("openai.chat.v1", {
model: "gpt-4o-mini",
});
const parser = createParser("stringExtract", { enum: ["yes", "no"]});
return createLlmExecutor({ llm, prompt, parser }).execute({
body,
});
}