You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat (ai): add experimental prepareStep callback to generateText (#5985) (#5991)
## Background
For many agentic use cases, it is helpful to be able to control the
different settings at each step.
## Summary
Add `experimental_prepareStep` option to `generateText` that allows
modifying `model`, `toolChoice`, and `experimental_activeTools` for each
step.
## Future Work
Add to `streamText`. Add more inputs and outputs to
`experimental_prepareStep`.
## Related Issues
#4954#3944#5478
exports[`options.maxSteps > 2 steps: initial, tool-result with prepareStep > result.response.messages should contain response messages from all steps 1`] =`
483
+
[
484
+
{
485
+
"content": [
486
+
{
487
+
"args": {
488
+
"value": "value",
489
+
},
490
+
"toolCallId": "call-1",
491
+
"toolName": "tool1",
492
+
"type": "tool-call",
493
+
},
494
+
],
495
+
"id": "msg-0",
496
+
"role": "assistant",
497
+
},
498
+
{
499
+
"content": [
500
+
{
501
+
"result": "result1",
502
+
"toolCallId": "call-1",
503
+
"toolName": "tool1",
504
+
"type": "tool-result",
505
+
},
506
+
],
507
+
"id": "msg-1",
508
+
"role": "tool",
509
+
},
510
+
{
511
+
"content": [
512
+
{
513
+
"text": "Hello, world!",
514
+
"type": "text",
515
+
},
516
+
],
517
+
"id": "msg-2",
518
+
"role": "assistant",
519
+
},
520
+
]
521
+
`;
522
+
523
+
exports[`options.maxSteps > 2 steps: initial, tool-result with prepareStep > result.steps should contain all steps 1`] =`
0 commit comments