class PendingImageGeneration

Traits

Properties

protected array<string, string>|SerializableClosure $headers from  ResolvesProviderOptions
protected array<string, mixed>|SerializableClosure $providerOptions from  ResolvesProviderOptions
array $attachments
string|null $size
string|null $quality
int|null $timeout

Methods

mixed
when(mixed $value = null, callable|null $callback = null, callable|null $default = null)

Apply the callback if the given "value" is (or resolves to) truthy.

mixed
unless(mixed $value = null, callable|null $callback = null, callable|null $default = null)

Apply the callback if the given "value" is (or resolves to) falsy.

withHeaders(array|Closure $headers)

Specify HTTP headers for the request. Closures may only capture serializable values.

withProviderOptions(array|Closure $options)

Specify provider-specific options for the request.

array
resolveProviderOptionsAndHeaders(Provider $provider)

Resolve the request body options and HTTP headers for the given provider.

array
queuedProviderOptions()

Get the serializable provider options recorded by queued fakes.

__construct(string $prompt)

Create a pending image generation.

attachments(array $attachments)

Provide the reference images that should be sent with the request.

size(string $size)

Specify the size / aspect ratio of the generated image.

square()

Indicate that the generated image should have a square aspect ratio.

portrait()

Indicate that the generated image should have a portrait aspect ratio.

landscape()

Indicate that the generated image should have a landscape aspect ratio.

quality(string $quality)

Specify the quality of the generated image.

timeout(int|null $timeout)

Specify the timeout for the image generation request.

generate(Provider|Lab|array|string|null $provider = null, string|null $model = null)

Generate the image.

queue(Provider|Lab|array|string|null $provider = null, string|null $model = null)

Queue the generation of an image.

void
ensureAttachmentsAreQueueable()

Ensure all of the attachments are queueable.

Details

in Conditionable at line 23
mixed when(mixed $value = null, callable|null $callback = null, callable|null $default = null)

Apply the callback if the given "value" is (or resolves to) truthy.

Parameters

mixed $value
callable|null $callback
callable|null $default

Return Value

mixed

in Conditionable at line 56
mixed unless(mixed $value = null, callable|null $callback = null, callable|null $default = null)

Apply the callback if the given "value" is (or resolves to) falsy.

Parameters

mixed $value
callable|null $callback
callable|null $default

Return Value

mixed

ResolvesProviderOptions withHeaders(array|Closure $headers)

Specify HTTP headers for the request. Closures may only capture serializable values.

Parameters

array|Closure $headers

Return Value

ResolvesProviderOptions

ResolvesProviderOptions withProviderOptions(array|Closure $options)

Specify provider-specific options for the request.

Parameters

array|Closure $options

Return Value

ResolvesProviderOptions

protected array resolveProviderOptionsAndHeaders(Provider $provider)

Resolve the request body options and HTTP headers for the given provider.

Unlike upstream, accept the contract so custom provider implementations need not extend the base class.

Parameters

Provider $provider

Return Value

array

protected array queuedProviderOptions()

Get the serializable provider options recorded by queued fakes.

Return Value

array

at line 42
__construct(string $prompt)

Create a pending image generation.

Parameters

string $prompt

at line 54
PendingImageGeneration attachments(array $attachments)

Provide the reference images that should be sent with the request.

Parameters

array $attachments

Return Value

PendingImageGeneration

at line 64
PendingImageGeneration size(string $size)

Specify the size / aspect ratio of the generated image.

Parameters

string $size

Return Value

PendingImageGeneration

at line 74
PendingImageGeneration square()

Indicate that the generated image should have a square aspect ratio.

Return Value

PendingImageGeneration

at line 84
PendingImageGeneration portrait()

Indicate that the generated image should have a portrait aspect ratio.

Return Value

PendingImageGeneration

at line 94
PendingImageGeneration landscape()

Indicate that the generated image should have a landscape aspect ratio.

Return Value

PendingImageGeneration

at line 106
PendingImageGeneration quality(string $quality)

Specify the quality of the generated image.

Parameters

string $quality

Return Value

PendingImageGeneration

at line 116
PendingImageGeneration timeout(int|null $timeout)

Specify the timeout for the image generation request.

Parameters

int|null $timeout

Return Value

PendingImageGeneration

at line 128
ImageResponse generate(Provider|Lab|array|string|null $provider = null, string|null $model = null)

Generate the image.

Parameters

Provider|Lab|array|string|null $provider
string|null $model

Return Value

ImageResponse

Exceptions

FailoverableException

at line 173
QueuedImageResponse queue(Provider|Lab|array|string|null $provider = null, string|null $model = null)

Queue the generation of an image.

Parameters

Provider|Lab|array|string|null $provider
string|null $model

Return Value

QueuedImageResponse

Exceptions

LogicException

at line 200
protected void ensureAttachmentsAreQueueable()

Ensure all of the attachments are queueable.

Return Value

void