<?php
// Perform single-label classification on the input text.
function classify(string $data) : SinglePrediction {
return StructuredOutput::using('openai')->with(
messages: [[
"role" => "user",
"content" => "Classify the following text: $data",
]],
responseModel: SinglePrediction::class,
)->get();
}
?>