Once your script can understand a user's command and identify a target file, the next step is to perform an action. This lesson shows you how to use the Vercel AI SDK's generateText function to process a file's content and produce a relevant, AI-generated response.
You'll learn how to read the content from the file path you've already identified, combine it with the inferred command into a new, more detailed prompt, and then pass it back to your local AI model to generate a final text output, such as a summary or a review.
Workflow demonstrated in this lesson:
- Import the 
generateTextfunction from theaiSDK. - Read the file content from the 
filePathreturned bygenerateObject. - Construct a new, structured prompt that includes the original command (e.g., "summarize") and the full content of the file.
 - Pass this new prompt to the 
generateTextfunction. - Log the resulting AI-generated text to the console.
 - Run the script with commands like "Summarize our TypeScript config" or "Review my package file" to see the full, context-aware output.
 
This lesson completes the core cycle of your AI script: understanding a command, reading the relevant context, and generating a useful, text-based result, all on your local machine.
