-
-
Notifications
You must be signed in to change notification settings - Fork 635
Closed
Labels
Non-OpenAI ModelNot an OpenAI Model.Not an OpenAI Model.bugSomething isn't workingSomething isn't working
Description
Description
Error when trying to use Claude with streaming.
Undefined array key "choices"
vendor\openai-php\client\src\Responses\Chat\CreateStreamedResponse.php :44
| */ -- | -- | public static function from(array $attributes): self | { | $choices = array_map(fn (array $result): CreateStreamedResponseChoice => CreateStreamedResponseChoice::from( | $result | ), $attributes['choices']); | | return new self( | $attributes['id'] ?? null, | $attributes['object'], | $attributes['created'], | $attributes['model'], | $choices,
Steps To Reproduce
$client = OpenAI::factory()
->withApiKey($apiKey)
->withBaseUri('https://api.anthropic.com/v1')
->make();$stream = $client->chat()->createStreamed([
'model' => 'claude-3-7-sonnet-20250219',
'messages' =>['role' => 'user', 'content' => 'Hello!'],
]);foreach($stream as $response){
$this->stream(to: 'answer', content: $response->choices[0]->delta->content);
}
}
OpenAI PHP Client Version
^0.10.3
PHP Version
8.2
Notes
No response
Metadata
Metadata
Assignees
Labels
Non-OpenAI ModelNot an OpenAI Model.Not an OpenAI Model.bugSomething isn't workingSomething isn't working