Skip to content

Conversation

@renovate
Copy link
Contributor

@renovate renovate bot commented Dec 31, 2025

Note: This PR body was truncated due to platform limits.

This PR contains the following updates:

Package Change Age Confidence
prism-php/prism ^0.67.0^0.99.0 age confidence

Release Notes

prism-php/prism (prism-php/prism)

v0.99.10

Compare Source

What's Changed

Full Changelog: prism-php/prism@v0.99.9...v0.99.10

v0.99.9

Compare Source

What's Changed

Full Changelog: prism-php/prism@v0.99.8...v0.99.9

v0.99.8

Compare Source

What's Changed

Full Changelog: prism-php/prism@v0.99.7...v0.99.8

v0.99.7

Compare Source

What's Changed

New Contributors

Full Changelog: prism-php/prism@v0.99.6...v0.99.7

v0.99.6

Compare Source

What's Changed

  • Removed default token limit

Full Changelog: prism-php/prism@v0.99.5...v0.99.6

v0.99.5

Compare Source

What's Changed

Full Changelog: prism-php/prism@v0.99.4...v0.99.5

v0.99.4

Compare Source

What's Changed

New Contributors

Full Changelog: prism-php/prism@v0.99.3...v0.99.4

v0.99.3

Compare Source

What's Changed

New Contributors

Full Changelog: prism-php/prism@v0.99.2...v0.99.3

v0.99.2

Compare Source

What's Changed

New Contributors

Full Changelog: prism-php/prism@v0.99.1...v0.99.2

v0.99.1

Compare Source

What's Changed

New Contributors

Full Changelog: prism-php/prism@v0.99.0...v0.99.1

v0.99.0

Compare Source

What's Changed

Breaking Changes

  • On complete callback removed for new callback handlers see #​776

New Contributors

Full Changelog: prism-php/prism@v0.98.5...v0.99.0

v0.98.5

Compare Source

What's Changed

Full Changelog: prism-php/prism@v0.98.4...v0.98.5

v0.98.4

Compare Source

What's Changed

New Contributors

Full Changelog: prism-php/prism@v0.98.3...v0.98.4

v0.98.3

Compare Source

What's Changed

Full Changelog: prism-php/prism@v0.98.2...v0.98.3

v0.98.2

Compare Source

What's Changed

New Contributors

Full Changelog: prism-php/prism@v0.98.1...v0.98.2

v0.98.1

Compare Source

What's Changed

Full Changelog: prism-php/prism@v0.98.0...v0.98.1

v0.98.0

Compare Source

What's Changed

Full Changelog: prism-php/prism@v0.97.2...v0.98.0

v0.97.2

Compare Source

What's Changed

Full Changelog: prism-php/prism@v0.97.1...v0.97.2

v0.97.1

Compare Source

What's Changed

New Contributors

Full Changelog: prism-php/prism@v0.97.0...v0.97.1

v0.97.0

Compare Source

What's Changed

Breaking Changes

  • \Prism\Prism\Prism::text() is now \Prism\Prism\Facades\Prism::text() - see notes in #​699
    • You can use find . -path ./vendor -prune -o -type f -name "*.php" -exec perl -i -pe 's/Prism\\Prism\\Prism/Prism\\Prism\\Facades\\Prism/g' {} + as a quick fix.

New Contributors

Full Changelog: prism-php/prism@v0.96.1...v0.97.0

v0.96.1

Compare Source

What's Changed

Full Changelog: prism-php/prism@v0.96.0...v0.96.1

v0.96.0

Compare Source

What's Changed

Full Changelog: prism-php/prism@v0.95.0...v0.96.0

v0.95.0

Compare Source

What's Changed

Full Changelog: prism-php/prism@v0.94.0...v0.95.0

v0.94.0

Compare Source

What's Changed

New Contributors

Full Changelog: prism-php/prism@v0.93.0...v0.94.0

v0.93.0

Compare Source

What's Changed

  • feat(openai) Extend Schema's to allow for newly added values for the OpenAI API by @​mysticseagull in #​639
  • Use media value object for generated audio and image by @​aimeos in #​621
  • feat(OpenRouter): configure OpenRouter site headers and streamline header filtering by @​kargnas in #​669
  • fix(OpenRouter):fix the exception caused by calling the gpt-5 model when there are no parameter tools by @​hipig in #​666
  • [Bug] Image handling in Gemini ImageRequestMap by @​aimeos in #​667

Full Changelog: prism-php/prism@v0.92.0...v0.93.0

v0.92.0

Compare Source

What's Changed

⚠️ BREAKING CHANGES

1. Removed Chunk Class and ChunkType Enum

What changed:

  • The Prism\Prism\Text\Chunk class has been removed
  • The Prism\Prism\Enums\ChunkType enum has been removed
  • PendingRequest::asStream() now returns Generator<StreamEvent> instead of Generator<Chunk>

Before:

use Prism\Prism\Text\Chunk;
use Prism\Prism\Enums\ChunkType;

foreach ($prism->text()->asStream() as $chunk) {
    // $chunk is instance of Chunk
    echo $chunk->text;

    if ($chunk->chunkType === ChunkType::ToolCall) {
        // Handle tool calls
    }

    if ($chunk->finishReason) {
        // Stream complete
    }
}

After:

use Prism\Prism\Streaming\Events\{
    StreamStartEvent,
    TextDeltaEvent,
    TextCompleteEvent,
    ToolCallEvent,
    StreamEndEvent
};

foreach ($prism->text()->asStream() as $event) {
    // $event is instance of StreamEvent
    match ($event::class) {
        StreamStartEvent::class => /* stream started */,
        TextDeltaEvent::class => echo $event->delta,
        ToolCallEvent::class => /* handle tool call */,
        StreamEndEvent::class => /* stream complete */,
        default => /* other events */
    };
}
2. Exception Renamed

What changed:

  • PrismChunkDecodeException renamed to PrismStreamDecodeException

Migration:

// Before
use Prism\Prism\Exceptions\PrismChunkDecodeException;

try {
    // ...
} catch (PrismChunkDecodeException $e) {
    // ...
}

// After
use Prism\Prism\Exceptions\PrismStreamDecodeException;

try {
    // ...
} catch (PrismStreamDecodeException $e) {
    // ...
}
3. Stream Event Type Changes

The streaming output is now composed of 12 distinct event types, each with specific purposes:

Event Purpose
StreamStartEvent Emitted once at stream initialization
TextStartEvent Emitted before first text delta
TextDeltaEvent Contains incremental text chunks
TextCompleteEvent Text generation complete
ThinkingStartEvent Reasoning/thinking block started
ThinkingEvent Incremental thinking content
ThinkingCompleteEvent Thinking block complete
ToolCallEvent Tool invocation requested
ToolResultEvent Tool execution result
CitationEvent Source citation (Anthropic)
ErrorEvent Recoverable or fatal error
StreamEndEvent Stream complete with final metadata

Migration Guide

Basic Streaming

Before (Chunk-based):

$response = '';

foreach ($prism->text()->asStream() as $chunk) {
    $response .= $chunk->text;
}

echo $response;

After (Event-based):

use Prism\Prism\Streaming\Events\TextDeltaEvent;

$response = '';

foreach ($prism->text()->asStream() as $event) {
    if ($event instanceof TextDeltaEvent) {
        $response .= $event->delta;
    }
}

echo $response;
Handling Tool Calls

Before:

foreach ($prism->text()->asStream() as $chunk) {
    if ($chunk->chunkType === ChunkType::ToolCall) {
        foreach ($chunk->toolCalls as $toolCall) {
            // Handle tool call
        }
    }
}

After:

use Prism\Prism\Streaming\Events\ToolCallEvent;

foreach ($prism->text()->asStream() as $event) {
    if ($event instanceof ToolCallEvent) {
        // Handle tool call
        $toolCall = $event->toolCall;
    }
}
Detecting Stream Completion

Before:

foreach ($prism->text()->asStream() as $chunk) {
    if ($chunk->finishReason) {
        echo "Stream finished: {$chunk->finishReason->value}";
    }
}

After:

use Prism\Prism\Streaming\Events\StreamEndEvent;

foreach ($prism->text()->asStream() as $event) {
    if ($event instanceof StreamEndEvent) {
        echo "Stream finished: {$event->finishReason->value}";
        // Access usage metadata: $event->usage
    }
}
Handling Thinking/Reasoning

Before:

foreach ($prism->text()->asStream() as $chunk) {
    if ($chunk->chunkType === ChunkType::Thinking) {
        echo "Thinking: {$chunk->text}";
    }
}

After:

use Prism\Prism\Streaming\Events\ThinkingEvent;

foreach ($prism->text()->asStream() as $event) {
    if ($event instanceof ThinkingEvent) {
        echo "Thinking: {$event->delta}";
    }
}

New Features

1. Granular Stream Events

Each phase of streaming now emits specific events, enabling fine-grained control:

use Prism\Prism\Streaming\Events\{
    StreamStartEvent,
    TextStartEvent,
    TextDeltaEvent,
    TextCompleteEvent,
    StreamEndEvent
};

foreach ($prism->text()->asStream() as $event) {
    match ($event::class) {
        StreamStartEvent::class => log('Stream started', [
            'model' => $event->model,
            'provider' => $event->provider,
        ]),
        TextStartEvent::class => log('Text generation started'),
        TextDeltaEvent::class => echo $event->delta,
        TextCompleteEvent::class => log('Text generation complete'),
        StreamEndEvent::class => log('Stream ended', [
            'finish_reason' => $event->finishReason->value,
            'usage' => $event->usage,
        ]),
    };
}
2. Streaming Adapters

Three new adapters for different streaming protocols:

Server-Sent Events (SSE)
return $prism->text()
    ->withPrompt('Tell me a story')
    ->asEventStreamResponse(); // Returns StreamedResponse with SSE format
Data Protocol (Vercel AI SDK compatible)
return $prism->text()
    ->withPrompt('Tell me a story')
    ->asDataStreamResponse(); // Returns StreamedResponse with data protocol
Laravel Broadcasting
use Illuminate\Broadcasting\Channel;

return $prism->text()
    ->withPrompt('Tell me a story')
    ->asBroadcastResponse(new Channel('prism-stream'));
3. onComplete Callback

Register callbacks that execute when streaming completes:

$prism->text()
    ->withPrompt('Analyze this data')
    ->onComplete(function ($request, $messages) {
        // Save conversation to database
        Conversation::create([
            'messages' => $messages,
            'model' => $request->model,
        ]);
    })
    ->asStream();

The callback receives:

  • $request: The original PendingRequest instance
  • $messages: Collection of final Message objects
4. StreamCollector Utility

Automatically collects stream events into final messages:

use Prism\Prism\Streaming\StreamCollector;

$stream = $prism->text()->asStream();
$collector = new StreamCollector($stream, $request, $callback);

foreach ($collector->collect() as $event) {
    // Events are yielded while being collected
}

// After iteration, access collected messages
$messages = $collector->messages();
5. Testing Improvements

New fake methods for testing streaming:

use Prism\Prism\Testing\PrismFake;

PrismFake::fake([
    'mistral-large-latest' => PrismFake::streamResponse([
        'Text response content',
    ]),
]);

foreach ($prism->text()->asStream() as $event) {
    // Test against stream events
}

Internal Improvements

Unified StreamState Architecture

All 9 streaming providers now use a consistent StreamState object for managing streaming state:

Providers Refactored:

  • Anthropic (AnthropicStreamState extension)
  • OpenAI (base StreamState)
  • Gemini (base StreamState)
  • Groq (base StreamState)
  • Mistral (base StreamState)
  • Ollama (OllamaStreamState extension)
  • XAI (base StreamState)
  • DeepSeek (base StreamState)
  • OpenRouter (base StreamState)

Benefits:

  • Consistent state management across all providers
  • Fluent API for state mutations (withMessageId(), appendText(), etc.)
  • Provider extensibility via inheritance (e.g., OllamaStreamState for token accumulation)
  • Type-safe operations with strong typing throughout
  • Easier debugging with centralized state tracking

Example (before/after):

// Before: Scattered instance properties
protected string $messageId = '';
protected bool $streamStarted = false;
protected string $currentText = '';

$this->messageId = EventID::generate();
$this->streamStarted = true;
$this->currentText .= $delta;

// After: Unified state object with fluent API
protected StreamState $state;

$this->state
    ->withMessageId(EventID::generate())
    ->markStreamStarted()
    ->appendText($delta);

Full Changelog: prism-php/prism@v0.91.1...v0.92.0

v0.91.1: v0.92.1

Compare Source

What's Changed

New Contributors

Full Changelog: prism-php/prism@v0.91.0...v0.91.1

v0.91.0

Compare Source

What's Changed

New Contributors

Full Changelog: prism-php/prism@v0.90.0...v0.91.0

v0.90.0

Compare Source

What's Changed

Breaking Changes

  • Image edits for OpenAI are no longer passed via withProviderOptions and are now passed via Image value objects in the withPrompt's additionalContent parameter.
  • OpenAI mask option now utilizes the Image value object instead of a raw resource

New Contributors

Full Changelog: prism-php/prism@v0.89.0...v0.90.0

v0.89.0

Compare Source

What's Changed

New Contributors

Full Changelog: prism-php/prism@v0.88.1...v0.89.0

v0.88.1

Compare Source

What's Changed

New Contributors

Full Changelog: prism-php/prism@v0.88.0...v0.88.1

v0.88.0

Compare Source

What's Changed

New Contributors

Full Changelog: prism-php/prism@v0.87.1...v0.88.0

v0.87.1

Compare Source

What's Changed

Full Changelog: prism-php/prism@v0.87.0...v0.87.1

v0.87.0

Compare Source

What's Changed

Breaking Changes

  • Anthropic citations now saved on additionalContent under the 'citations' key and use the new MessagePartWithCitations and Citation value objects
  • Gemini search groundings are now saved on additional content under the 'citations' key and use the new MessagePartWithCitations and Citation value objects

New Contributors

Full Changelog: prism-php/prism@v0.86.0...v0.87.0

v0.86.0

Compare Source

What's Changed

New Contributors

Full Changelog: prism-php/prism@v0.85.0...v0.86.0

v0.85.0

Compare Source

What's Changed

Breaking Changes

  • Removes responseMessages from the response objects

Full Changelog: prism-php/prism@v0.84.0...v0.85.0

v0.84.0

Compare Source

What's Changed

Full Changelog: prism-php/prism@v0.83.2...v0.84.0

v0.83.2

Compare Source

What's Changed

Full Changelog: prism-php/prism@v0.83.1...v0.83.2

v0.83.1

Compare Source

What's Changed

New Contributors

Full Changelog: prism-php/prism@v0.83.0...v0.83.1

v0.83.0

Compare Source

What's Changed

New Contributors

Full Changelog: prism-php/prism@v0.82.0...v0.83.0

v0.82.0

Compare Source

What's Changed

New Contributors

Full Changelog: prism-php/prism@v0.81.0...v0.82.0

v0.81.0

Compare Source

What's Changed


Configuration

📅 Schedule: Branch creation - "before 07:00 on Thursday" in timezone Europe/Oslo, Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate
Copy link
Contributor Author

renovate bot commented Dec 31, 2025

⚠️ Artifact update problem

Renovate failed to update an artifact related to this branch. You probably do not want to merge this PR as-is.

♻ Renovate will retry this branch, including artifacts, only when one of the following happens:

  • any of the package files in this branch needs updating, or
  • the branch becomes conflicted, or
  • you click the rebase/retry checkbox if found above, or
  • you rename this PR's title to start with "rebase!" to trigger it manually

The artifact failure details are included below:

File name: composer.lock
Command failed: composer update prism-php/prism:0.99.10 --with-dependencies --ignore-platform-req=ext-* --ignore-platform-req=lib-* --no-ansi --no-interaction --no-scripts --no-autoloader --no-plugins --minimal-changes
Loading composer repositories with package information
Dependency laravel/framework is also a root requirement. Package has not been listed as an update argument, so keeping locked at old version. Use --with-all-dependencies (-W) to include root dependencies.
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - pestphp/pest is locked to version v3.8.2 and an update of this package was not requested.
    - brianium/paratest v7.8.3 requires php ~8.2.0 || ~8.3.0 || ~8.4.0 -> your php version (8.5.1) does not satisfy that requirement.
    - pestphp/pest v3.8.2 requires brianium/paratest ^7.8.3 -> satisfiable by brianium/paratest[v7.8.3].


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant