trait AnswersQuestions

Methods

string
classificationEndpoint()

Get the path of the endpoint that answers questions.

classify(ClassificationProvider $provider, string $model, string|array $state, array $questions, int $timeout = 30, array $providerOptions = [], array $attachments = [])

Answer the given questions about the state.

string
answeringModel(array $data, string $model)

Get the name of the model that answered the questions.

array
mapQuestion(Question $question)

Map a question to the decisions wire format.

Answer|null
mapAnswer(array $answer, Question|null $question = null)

Map an answer to an answer object, skipping unknown answer types.

array
withIntegerKeys(array $levels)

Cast the string level keys the provider returns to integers.

Details

at line 29
abstract protected string classificationEndpoint()

Get the path of the endpoint that answers questions.

Return Value

string

at line 39
ClassificationResponse classify(ClassificationProvider $provider, string $model, string|array $state, array $questions, int $timeout = 30, array $providerOptions = [], array $attachments = [])

Answer the given questions about the state.

Parameters

ClassificationProvider $provider
string $model
string|array $state
array $questions
int $timeout
array $providerOptions
array $attachments

Return Value

ClassificationResponse

at line 81
protected string answeringModel(array $data, string $model)

Get the name of the model that answered the questions.

Parameters

array $data
string $model

Return Value

string

at line 89
protected array mapQuestion(Question $question)

Map a question to the decisions wire format.

Parameters

Question $question

Return Value

array

at line 114
protected Answer|null mapAnswer(array $answer, Question|null $question = null)

Map an answer to an answer object, skipping unknown answer types.

Parameters

array $answer
Question|null $question

Return Value

Answer|null

at line 132
protected array withIntegerKeys(array $levels)

Cast the string level keys the provider returns to integers.

Parameters

array $levels

Return Value

array