mini\Inference\InferenceServiceInterface::evaluate() Method

public abstract

Signature

public abstract function evaluate(string $prompt, mini\Validator\Validator|JsonSerializable|array $schema): mixed

Parameters

Name Type Default Description
$prompt string required Documentation missing
$schema mini\Validator\Validator|JsonSerializable|array required Documentation missing

Returns

mixed

Documentation

Evaluate a prompt and return a structured response matching the schema

The schema parameter accepts:

  • Validator instance (recommended) - serializes to JSON Schema via JsonSerializable
  • Any JsonSerializable that produces valid JSON Schema
  • Raw array representing JSON Schema

The implementation should:

  1. Send the prompt to the LLM with the schema as output format constraint
  2. Parse the JSON response
  3. Optionally validate the response matches the schema
  4. Return the parsed result

Source

src/Inference/InferenceServiceInterface.php:82