Eg - Summarize a content, Draft an Email, Explain this Concept

LLM can genrate text in response to a prompt( user question and instruction)

AI SDK Provides two functions to genrate text and stream it from LLM

Genrare Text - Returns a Object

It is function that calls LLM to write text and gives us the whole result at once ( not word by word)

Arguments - model, prompt , instructions

Code Examples -

Example one - Basic example

https://github.com/jknithin36/ai-sdk-prac/blob/main/app/api/generate-text/01-generate-text/route.ts

Example two - passing in dynamic prompts and Instructions

https://github.com/jknithin36/ai-sdk-prac/blob/main/app/api/generate-text/02-generate-text/route.ts

The genrated result object contains output and metadata -