firecrawl-api / apps /php-sdk /src /Models /JsonFormat.php
s-eto-hub's picture
Commit de nettoyage des binaires
097eaf0
Raw History Blame Contribute Delete
987 Bytes
<?php
declare(strict_types=1);
namespace Firecrawl\Models;
final class JsonFormat
{
private function __construct(
private readonly ?string $prompt = null,
/** @var array<string, mixed>|null */
private readonly ?array $schema = null,
) {}
/**
* @param array<string, mixed>|null $schema
*/
public static function with(
?string $prompt = null,
?array $schema = null,
): self {
return new self($prompt, $schema);
}
/** @return array<string, mixed> */
public function toArray(): array
{
return array_filter([
'type' => 'json',
'prompt' => $this->prompt,
'schema' => $this->schema,
], fn (mixed $v): bool => $v !== null);
}
public function getPrompt(): ?string
{
return $this->prompt;
}
/** @return array<string, mixed>|null */
public function getSchema(): ?array
{
return $this->schema;
}
}