Skip to content

v0.134.0

Compare
Choose a tag to compare
@lgrammel lgrammel released this 28 Jan 10:37

Added

  • Added prompt function support to generateText, streamText, generateObject, and streamObject. You can create prompt functions for text, instruction, and chat prompts using createTextPrompt, createInstructionPrompt, and createChatPrompt. 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.