Files
InvoiceShelf/app/Platform/Ai/Data/AiChatResponse.php
T
Darko Gjorgjijoski 5ef7804e60 refactor: adopt modular domain architecture (#747)
* refactor: stabilize model identities for domain migration

* refactor: extract module platform context

* refactor: assign models to domain contexts

* refactor: extract ai platform context

* refactor: extract storage platform context

* refactor: extract mail platform context

* refactor: extract pdf platform context

* refactor: extract operations platform context

* refactor: move installation into operations platform

* refactor: extract money domain context

* refactor: extract taxation domain context

* refactor: extract catalog domain context

* refactor: extract metadata domain context

* refactor: extract reporting domain context

* refactor: extract purchases domain context

* refactor: extract receivables domain context

* refactor: extract accounts domain context

* refactor: complete reporting statement boundary

* refactor: extract contacts domain context

* refactor: extract sales domain context

* refactor: remove legacy application layers

* fix: migrate legacy bouncer role identities
2026-08-05 17:40:03 +02:00

35 lines
1.4 KiB
PHP

<?php
namespace App\Platform\Ai\Data;
/**
* Provider-agnostic chat completion response.
*
* Shape is deliberately modelled after OpenAI's response so drivers translating
* from other shapes only have to do it once, and the AiAssistantService loop
* stays vendor-neutral.
*/
class AiChatResponse
{
/**
* @param string|null $message The assistant's text reply. Null when the response is a tool-call-only turn.
* @param array<int, array{id: string, name: string, arguments: array<string, mixed>}> $toolCalls
* Tool calls the model wants the host to execute. Empty array if none.
* @param string $finishReason Why generation stopped: 'stop', 'tool_calls', 'length', 'error', etc.
* @param array{tokens_in?: int, tokens_out?: int} $usage Token usage for cost tracking (optional).
* @param string|null $model Echoed model ID that produced this response (optional).
*/
public function __construct(
public readonly ?string $message,
public readonly array $toolCalls = [],
public readonly string $finishReason = 'stop',
public readonly array $usage = [],
public readonly ?string $model = null,
) {}
public function hasToolCalls(): bool
{
return $this->toolCalls !== [];
}
}