Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Resources/Files.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function list(array $parameters = []): ListResponse
{
$payload = Payload::list('files', $parameters);

/** @var Response<array{object: string, data: array<int, array{id: string, object: string, created_at: int, bytes: ?int, filename: string, purpose: string, status: string, status_details: array<array-key, mixed>|string|null}>, first_id: ?string, last_id: ?string, has_more: ?bool}> $response */
/** @var Response<array{object: string, data: array<int, array{id: string, object: string, created_at: int, expires_at: int|null, bytes: ?int, filename: string, purpose: string, status: string, status_details: array<array-key, mixed>|string|null}>, first_id: ?string, last_id: ?string, has_more: ?bool}> $response */
$response = $this->transporter->requestObject($payload);

return ListResponse::from($response->data(), $response->meta());
Expand All @@ -40,7 +40,7 @@ public function retrieve(string $file): RetrieveResponse
{
$payload = Payload::retrieve('files', $file);

/** @var Response<array{id: string, object: string, created_at: int, bytes: ?int, filename: string, purpose: string, status: string, status_details: array<array-key, mixed>|string|null}> $response */
/** @var Response<array{id: string, object: string, created_at: int, expires_at: int|null, bytes: ?int, filename: string, purpose: string, status: string, status_details: array<array-key, mixed>|string|null}> $response */
$response = $this->transporter->requestObject($payload);

return RetrieveResponse::from($response->data(), $response->meta());
Expand Down Expand Up @@ -69,7 +69,7 @@ public function upload(array $parameters): CreateResponse
{
$payload = Payload::upload('files', $parameters);

/** @var Response<array{id: string, object: string, created_at: int, bytes: int, filename: string, purpose: string, status: string, status_details: array<array-key, mixed>|string|null}> $response */
/** @var Response<array{id: string, object: string, created_at: int, expires_at: int|null, bytes: int, filename: string, purpose: string, status: string, status_details: array<array-key, mixed>|string|null}> $response */
$response = $this->transporter->requestObject($payload);

return CreateResponse::from($response->data(), $response->meta());
Expand Down
8 changes: 4 additions & 4 deletions src/Resources/FineTunes.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function create(array $parameters): RetrieveResponse
{
$payload = Payload::create('fine-tunes', $parameters);

/** @var Response<array{id: string, object: string, model: string, created_at: int, events: array<int, array{object: string, created_at: int, level: string, message: string}>, fine_tuned_model: ?string, hyperparams: array{batch_size: ?int, learning_rate_multiplier: ?float, n_epochs: int, prompt_loss_weight: float}, organization_id: string, result_files: array<int, array{id: string, object: string, created_at: int, bytes: int, filename: string, purpose: string, status: string, status_details: array<array-key, mixed>|string|null}>, status: string, validation_files: array<int, array{id: string, object: string, created_at: int, bytes: int, filename: string, purpose: string, status: string, status_details: array<array-key, mixed>|string|null}>, training_files: array<int, array{id: string, object: string, created_at: int, bytes: int, filename: string, purpose: string, status: string, status_details: array<array-key, mixed>|string|null}>, updated_at: int}> $response */
/** @var Response<array{id: string, object: string, model: string, created_at: int, events: array<int, array{object: string, created_at: int, level: string, message: string}>, fine_tuned_model: ?string, hyperparams: array{batch_size: ?int, learning_rate_multiplier: ?float, n_epochs: int, prompt_loss_weight: float}, organization_id: string, result_files: array<int, array{id: string, object: string, created_at: int, expires_at: int|null, bytes: int, filename: string, purpose: string, status: string, status_details: array<array-key, mixed>|string|null}>, status: string, validation_files: array<int, array{id: string, object: string, created_at: int, expires_at: int|null, bytes: int, filename: string, purpose: string, status: string, status_details: array<array-key, mixed>|string|null}>, training_files: array<int, array{id: string, object: string, created_at: int, expires_at: int|null, bytes: int, filename: string, purpose: string, status: string, status_details: array<array-key, mixed>|string|null}>, updated_at: int}> $response */
$response = $this->transporter->requestObject($payload);

return RetrieveResponse::from($response->data(), $response->meta());
Expand All @@ -45,7 +45,7 @@ public function list(): ListResponse
{
$payload = Payload::list('fine-tunes');

/** @var Response<array{object: string, data: array<int, array{id: string, object: string, model: string, created_at: int, events: array<int, array{object: string, created_at: int, level: string, message: string}>, fine_tuned_model: ?string, hyperparams: array{batch_size: ?int, learning_rate_multiplier: ?float, n_epochs: int, prompt_loss_weight: float}, organization_id: string, result_files: array<int, array{id: string, object: string, created_at: int, bytes: int, filename: string, purpose: string, status: string, status_details: array<array-key, mixed>|string|null}>, status: string, validation_files: array<int, array{id: string, object: string, created_at: int, bytes: int, filename: string, purpose: string, status: string, status_details: array<array-key, mixed>|string|null}>, training_files: array<int, array{id: string, object: string, created_at: int, bytes: int, filename: string, purpose: string, status: string, status_details: array<array-key, mixed>|string|null}>, updated_at: int}>}> $response */
/** @var Response<array{object: string, data: array<int, array{id: string, object: string, model: string, created_at: int, events: array<int, array{object: string, created_at: int, level: string, message: string}>, fine_tuned_model: ?string, hyperparams: array{batch_size: ?int, learning_rate_multiplier: ?float, n_epochs: int, prompt_loss_weight: float}, organization_id: string, result_files: array<int, array{id: string, object: string, created_at: int, expires_at: int|null, bytes: int, filename: string, purpose: string, status: string, status_details: array<array-key, mixed>|string|null}>, status: string, validation_files: array<int, array{id: string, object: string, created_at: int, expires_at: int|null, bytes: int, filename: string, purpose: string, status: string, status_details: array<array-key, mixed>|string|null}>, training_files: array<int, array{id: string, object: string, created_at: int, expires_at: int|null, bytes: int, filename: string, purpose: string, status: string, status_details: array<array-key, mixed>|string|null}>, updated_at: int}>}> $response */
$response = $this->transporter->requestObject($payload);

return ListResponse::from($response->data(), $response->meta());
Expand All @@ -60,7 +60,7 @@ public function retrieve(string $fineTuneId): RetrieveResponse
{
$payload = Payload::retrieve('fine-tunes', $fineTuneId);

/** @var Response<array{id: string, object: string, model: string, created_at: int, events: array<int, array{object: string, created_at: int, level: string, message: string}>, fine_tuned_model: ?string, hyperparams: array{batch_size: ?int, learning_rate_multiplier: ?float, n_epochs: int, prompt_loss_weight: float}, organization_id: string, result_files: array<int, array{id: string, object: string, created_at: int, bytes: int, filename: string, purpose: string, status: string, status_details: array<array-key, mixed>|string|null}>, status: string, validation_files: array<int, array{id: string, object: string, created_at: int, bytes: int, filename: string, purpose: string, status: string, status_details: array<array-key, mixed>|string|null}>, training_files: array<int, array{id: string, object: string, created_at: int, bytes: int, filename: string, purpose: string, status: string, status_details: array<array-key, mixed>|string|null}>, updated_at: int}> $response */
/** @var Response<array{id: string, object: string, model: string, created_at: int, events: array<int, array{object: string, created_at: int, level: string, message: string}>, fine_tuned_model: ?string, hyperparams: array{batch_size: ?int, learning_rate_multiplier: ?float, n_epochs: int, prompt_loss_weight: float}, organization_id: string, result_files: array<int, array{id: string, object: string, created_at: int, expires_at: int|null, bytes: int, filename: string, purpose: string, status: string, status_details: array<array-key, mixed>|string|null}>, status: string, validation_files: array<int, array{id: string, object: string, created_at: int, expires_at: int|null, bytes: int, filename: string, purpose: string, status: string, status_details: array<array-key, mixed>|string|null}>, training_files: array<int, array{id: string, object: string, created_at: int, expires_at: int|null, bytes: int, filename: string, purpose: string, status: string, status_details: array<array-key, mixed>|string|null}>, updated_at: int}> $response */
$response = $this->transporter->requestObject($payload);

return RetrieveResponse::from($response->data(), $response->meta());
Expand All @@ -75,7 +75,7 @@ public function cancel(string $fineTuneId): RetrieveResponse
{
$payload = Payload::cancel('fine-tunes', $fineTuneId);

/** @var Response<array{id: string, object: string, model: string, created_at: int, events: array<int, array{object: string, created_at: int, level: string, message: string}>, fine_tuned_model: ?string, hyperparams: array{batch_size: ?int, learning_rate_multiplier: ?float, n_epochs: int, prompt_loss_weight: float}, organization_id: string, result_files: array<int, array{id: string, object: string, created_at: int, bytes: int, filename: string, purpose: string, status: string, status_details: array<array-key, mixed>|string|null}>, status: string, validation_files: array<int, array{id: string, object: string, created_at: int, bytes: int, filename: string, purpose: string, status: string, status_details: array<array-key, mixed>|string|null}>, training_files: array<int, array{id: string, object: string, created_at: int, bytes: int, filename: string, purpose: string, status: string, status_details: array<array-key, mixed>|string|null}>, updated_at: int}> $response */
/** @var Response<array{id: string, object: string, model: string, created_at: int, events: array<int, array{object: string, created_at: int, level: string, message: string}>, fine_tuned_model: ?string, hyperparams: array{batch_size: ?int, learning_rate_multiplier: ?float, n_epochs: int, prompt_loss_weight: float}, organization_id: string, result_files: array<int, array{id: string, object: string, created_at: int, expires_at: int|null, bytes: int, filename: string, purpose: string, status: string, status_details: array<array-key, mixed>|string|null}>, status: string, validation_files: array<int, array{id: string, object: string, created_at: int, expires_at: int|null, bytes: int, filename: string, purpose: string, status: string, status_details: array<array-key, mixed>|string|null}>, training_files: array<int, array{id: string, object: string, created_at: int, expires_at: int|null, bytes: int, filename: string, purpose: string, status: string, status_details: array<array-key, mixed>|string|null}>, updated_at: int}> $response */
$response = $this->transporter->requestObject($payload);

return RetrieveResponse::from($response->data(), $response->meta());
Expand Down
9 changes: 6 additions & 3 deletions src/Responses/Files/CreateResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
use OpenAI\Testing\Responses\Concerns\Fakeable;

/**
* @implements ResponseContract<array{id: string, object: string, created_at: int, bytes: int, filename: string, purpose: string, status: string, status_details: array<array-key, mixed>|string|null}>
* @implements ResponseContract<array{id: string, object: string, created_at: int, expires_at: int|null, bytes: int, filename: string, purpose: string, status: string, status_details: array<array-key, mixed>|string|null}>
*/
final class CreateResponse implements ResponseContract, ResponseHasMetaInformationContract
{
/**
* @use ArrayAccessible<array{id: string, object: string, created_at: int, bytes: int, filename: string, purpose: string, status: string, status_details: array<array-key, mixed>|string|null}>
* @use ArrayAccessible<array{id: string, object: string, created_at: int, expires_at: int|null, bytes: int, filename: string, purpose: string, status: string, status_details: array<array-key, mixed>|string|null}>
*/
use ArrayAccessible;

Expand All @@ -32,6 +32,7 @@ private function __construct(
public readonly string $object,
public readonly int $bytes,
public readonly int $createdAt,
public readonly ?int $expiresAt,
public readonly string $filename,
public readonly string $purpose,
public readonly string $status,
Expand All @@ -42,7 +43,7 @@ private function __construct(
/**
* Acts as static factory, and returns a new Response instance.
*
* @param array{id: string, object: string, created_at: int, bytes: int, filename: string, purpose: string, status: string, status_details: array<array-key, mixed>|string|null} $attributes
* @param array{id: string, object: string, created_at: int, expires_at: int|null, bytes: int, filename: string, purpose: string, status: string, status_details: array<array-key, mixed>|string|null} $attributes
*/
public static function from(array $attributes, MetaInformation $meta): self
{
Expand All @@ -51,6 +52,7 @@ public static function from(array $attributes, MetaInformation $meta): self
$attributes['object'],
$attributes['bytes'],
$attributes['created_at'],
$attributes['expires_at'] ?? null,
$attributes['filename'],
$attributes['purpose'],
$attributes['status'],
Expand All @@ -69,6 +71,7 @@ public function toArray(): array
'object' => $this->object,
'bytes' => $this->bytes,
'created_at' => $this->createdAt,
'expires_at' => $this->expiresAt,
'filename' => $this->filename,
'purpose' => $this->purpose,
'status' => $this->status,
Expand Down
2 changes: 1 addition & 1 deletion src/Responses/Files/ListResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ private function __construct(
/**
* Acts as static factory, and returns a new Response instance.
*
* @param array{object: string, data: array<int, array{id: string, object: string, created_at: int, bytes: ?int, filename: string, purpose: string, status: string, status_details: array<array-key, mixed>|string|null}>, first_id: ?string, last_id: ?string, has_more: ?bool} $attributes
* @param array{object: string, data: array<int, array{id: string, object: string, created_at: int, expires_at: int|null, bytes: ?int, filename: string, purpose: string, status: string, status_details: array<array-key, mixed>|string|null}>, first_id: ?string, last_id: ?string, has_more: ?bool} $attributes
*/
public static function from(array $attributes, MetaInformation $meta): self
{
Expand Down
9 changes: 6 additions & 3 deletions src/Responses/Files/RetrieveResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
use OpenAI\Testing\Responses\Concerns\Fakeable;

/**
* @implements ResponseContract<array{id: string, object: string, created_at: int, bytes: ?int, filename: string, purpose: string, status: string, status_details: array<array-key, mixed>|string|null}>
* @implements ResponseContract<array{id: string, object: string, created_at: int, expires_at: int|null, bytes: ?int, filename: string, purpose: string, status: string, status_details: array<array-key, mixed>|string|null}>
*/
final class RetrieveResponse implements ResponseContract, ResponseHasMetaInformationContract
{
/**
* @use ArrayAccessible<array{id: string, object: string, created_at: int, bytes: ?int, filename: string, purpose: string, status: string, status_details: array<array-key, mixed>|string|null}>
* @use ArrayAccessible<array{id: string, object: string, created_at: int, expires_at: int|null, bytes: ?int, filename: string, purpose: string, status: string, status_details: array<array-key, mixed>|string|null}>
*/
use ArrayAccessible;

Expand All @@ -32,6 +32,7 @@ private function __construct(
public readonly string $object,
public readonly ?int $bytes,
public readonly int $createdAt,
public readonly ?int $expiresAt,
public readonly string $filename,
public readonly string $purpose,
public readonly string $status,
Expand All @@ -42,7 +43,7 @@ private function __construct(
/**
* Acts as static factory, and returns a new Response instance.
*
* @param array{id: string, object: string, created_at: int, bytes: ?int, filename: string, purpose: string, status: string, status_details: array<array-key, mixed>|string|null} $attributes
* @param array{id: string, object: string, created_at: int, expires_at: int|null, bytes: ?int, filename: string, purpose: string, status: string, status_details: array<array-key, mixed>|string|null} $attributes
*/
public static function from(array $attributes, MetaInformation $meta): self
{
Expand All @@ -51,6 +52,7 @@ public static function from(array $attributes, MetaInformation $meta): self
$attributes['object'],
$attributes['bytes'],
$attributes['created_at'],
$attributes['expires_at'] ?? null,
$attributes['filename'],
$attributes['purpose'],
$attributes['status'],
Expand All @@ -69,6 +71,7 @@ public function toArray(): array
'object' => $this->object,
'bytes' => $this->bytes,
'created_at' => $this->createdAt,
'expires_at' => $this->expiresAt,
'filename' => $this->filename,
'purpose' => $this->purpose,
'status' => $this->status,
Expand Down
Loading