v0.134.0
Added
-
Added prompt function support to
generateText
,streamText
,generateObject
, andstreamObject
. You can create prompt functions for text, instruction, and chat prompts usingcreateTextPrompt
,createInstructionPrompt
, andcreateChatPrompt
. Prompt functions allow you to load prompts from external sources and improve the prompt logging. Example:const storyPrompt = createInstructionPrompt( async ({ protagonist }: { protagonist: string }) => ({ system: "You are an award-winning author.", instruction: `Write a short story about ${protagonist} learning to love.`, }) ); const text = await generateText({ model: openai .ChatTextGenerator({ model: "gpt-3.5-turbo" }) .withInstructionPrompt(), prompt: storyPrompt({ protagonist: "a robot", }), });
Changed
- Refactored build to use
tsup
.