abstract class Provider implements Stringable, Provider

Methods

__construct(Gateway $gateway, array $config, Dispatcher $events)

Create a provider instance.

string
name()

Get the name of the underlying AI provider.

string
driver()

Get the name of the underlying AI driver.

array
providerCredentials()

Get the credentials for the underlying AI provider.

array
additionalConfiguration()

Get the provider connection configuration other than the driver, key, and name.

withHeaders(array $headers)

Get a provider instance that sends the given HTTP headers with each request.

mixed
dispatchingFailure(Closure $call, Closure $failed)

Run the given gateway call, dispatching the event built from its exception before rethrowing.

static array
formatProviderAndModelList(Provider|Lab|array|string $providers, string|null $model = null)

Format the given provider / model list.

static array
providerAndModelPairs(Provider|Lab|array|string $providers, string|null $model = null)

Get provider and model pairs without discarding on-demand instances.

array
__serialize()

Get the serializable representation of the provider.

void
__unserialize(array $data)

Restore the provider from its serialized representation.

string
__toString()

Convert the provider to its string representation.

Details

at line 24
__construct(Gateway $gateway, array $config, Dispatcher $events)

Create a provider instance.

Parameters

Gateway $gateway
array $config
Dispatcher $events

at line 34
string name()

Get the name of the underlying AI provider.

Return Value

string

at line 42
string driver()

Get the name of the underlying AI driver.

Return Value

string

at line 50
array providerCredentials()

Get the credentials for the underlying AI provider.

Return Value

array

at line 60
array additionalConfiguration()

Get the provider connection configuration other than the driver, key, and name.

Return Value

array

at line 72
Provider withHeaders(array $headers)

internal  
 

Get a provider instance that sends the given HTTP headers with each request.

Parameters

array $headers

Return Value

Provider

at line 92
protected mixed dispatchingFailure(Closure $call, Closure $failed)

Run the given gateway call, dispatching the event built from its exception before rethrowing.

Parameters

Closure $call
Closure $failed

Return Value

mixed

at line 114
static array formatProviderAndModelList(Provider|Lab|array|string $providers, string|null $model = null)

Format the given provider / model list.

Parameters

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

Return Value

array

at line 132
static array providerAndModelPairs(Provider|Lab|array|string $providers, string|null $model = null)

internal  
 

Get provider and model pairs without discarding on-demand instances.

Parameters

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

Return Value

array

at line 164
array __serialize()

Get the serializable representation of the provider.

Return Value

array

at line 174
void __unserialize(array $data)

Restore the provider from its serialized representation.

Parameters

array $data

Return Value

void

at line 190
string __toString()

Convert the provider to its string representation.

Return Value

string