-
Notifications
You must be signed in to change notification settings - Fork 111
Open
Description
Description
PrismStreamEvent::toLaravelStreamEvent() crashes when a Prism ErrorEvent is emitted during streaming, because it accesses $event->type which doesn't exist as a property on Prism\Prism\Streaming\Events\ErrorEvent.
Error
ErrorException: Undefined property: Prism\Prism\Streaming\Events\ErrorEvent::$type
in vendor/laravel/ai/src/Gateway/Prism/PrismStreamEvent.php:50
Root Cause
In PrismStreamEvent.php line 50:
PrismStreamEventType::Error => new Error($event->id, $event->type, $event->message, $event->recoverable, $event->timestamp, $event->metadata),The Prism ErrorEvent class defines the property as errorType, not type:
// Prism\Prism\Streaming\Events\ErrorEvent
public function __construct(
string $id,
int $timestamp,
public string $errorType, // <-- property is "errorType"
public string $message,
public bool $recoverable,
public ?array $metadata = null,
) { ... }The type() method exists but returns StreamEventType::Error (an enum), not the string expected by Laravel\Ai\Streaming\Events\Error.
Fix
- PrismStreamEventType::Error => new Error($event->id, $event->type, $event->message, $event->recoverable, $event->timestamp, $event->metadata),
+ PrismStreamEventType::Error => new Error($event->id, $event->errorType, $event->message, $event->recoverable, $event->timestamp, $event->metadata),Versions
laravel/ai: v0.4.1prism-php/prism: v1.18.1- PHP: 8.4
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels