How do I use multi-step generations? #371
-
|
Hello friends, The documentation mentions foreach ($response->steps as $step) {
echo "Step text: {$step->text}";
echo "Step tokens: {$step->usage->completionTokens}";
}I’d like to explore this feature, but I’ve only ever received empty steps, even when using reasoning models such as Am I missing something? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
|
It’s actually possible to retrieve all the tools that were called like this (as shown in the Tools & Function Calling documentation: foreach ($response->steps as $step) {
if ($step->toolCalls) {
foreach ($step->toolCalls as $toolCall) {
echo "Tool: " . $toolCall->name . "\n";
echo "Arguments: " . json_encode($toolCall->arguments()) . "\n";
}
}
}What I was actually hoping to retrieve were the reasoning steps—like what we can see on ChatGPT—but it seems that this is not possible through the API. |
Beta Was this translation helpful? Give feedback.
-
|
Just to note that we do support the thinking block for Anthropic extended thinking - if you aren't tied to a specific provider/model: https://prismphp.com/providers/anthropic.html#extended-thinking |
Beta Was this translation helpful? Give feedback.

It’s actually possible to retrieve all the tools that were called like this (as shown in the Tools & Function Calling documentation:
What I was actually hoping to retrieve were the reasoning steps—like what we can see on ChatGPT—but it seems that this is not possible through the API.