TypeSafeProvider
class TypeSafeProvider extends Provider implements ClassificationProvider
Traits
Properties
| protected ClassificationGateway | $classificationGateway | from HasClassificationGateway |
Methods
Get the provider connection configuration other than the driver, key, and name.
Get a provider instance that sends the given HTTP headers with each request.
Run the given gateway call, dispatching the event built from its exception before rethrowing.
Format the given provider / model list.
Get provider and model pairs without discarding on-demand instances.
Restore the provider from its serialized representation.
Answer the given questions about the state.
Determine if the provider can classify attachments alongside the state.
Get the provider's classification gateway.
Get the name of the default classification model.
Details
at line 22
__construct(array $config, Dispatcher $events)
Create a TypeSafe provider instance.
in
Provider at line 34
string
name()
Get the name of the underlying AI provider.
in
Provider at line 42
string
driver()
Get the name of the underlying AI driver.
in
Provider at line 50
array
providerCredentials()
Get the credentials for the underlying AI provider.
in
Provider at line 60
array
additionalConfiguration()
Get the provider connection configuration other than the driver, key, and name.
in
Provider at line 72
Provider
withHeaders(array $headers)
| internal |
Get a provider instance that sends the given HTTP headers with each request.
in
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.
in
Provider at line 114
static array
formatProviderAndModelList(Provider|Lab|array|string $providers, string|null $model = null)
Format the given provider / model list.
in
Provider 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.
in
Provider at line 164
array
__serialize()
Get the serializable representation of the provider.
in
Provider at line 174
void
__unserialize(array $data)
Restore the provider from its serialized representation.
in
Provider at line 190
string
__toString()
Convert the provider to its string representation.
in
Classifies at line 30
ClassificationResponse
classify(string|array $state, array $questions, string|null $model = null, int $timeout = 30, array $providerOptions = [], array $attachments = [])
Answer the given questions about the state.
at line 39
bool
supportsClassificationAttachments()
Determine if the provider can classify attachments alongside the state.
at line 47
ClassificationGateway
classificationGateway()
Get the provider's classification gateway.
in
HasClassificationGateway at line 27
HasClassificationGateway
useClassificationGateway(ClassificationGateway $gateway)
Set the provider's classification gateway.
Changing a shared provider's gateway affects subsequent operations.
at line 31
string
defaultClassificationModel()
Get the name of the default classification model.