Tool use with the AI SDK
This example uses generateText(), tool(), and stepCountIs() with a mock model that emits a tool call first and a final answer second.
Requirements
Steps for running this example in the shell
- Install dependencies:
bash
npm install- Run the script:
bash
npm startOutput
The script prints a tool result and the final answer from the model loop.