Spaces:
Sleeping
Sleeping
Download apps/php-sdk/src/Models/QueryFormat.php from s-eto-hub/firecrawl-api: direct link, hf CLI and curl.
- Browser
- Download file 1.19 kB
-
https://huggingface.co/spaces/s-eto-hub/firecrawl-api/resolve/main/apps/php-sdk/src/Models/QueryFormat.php
- Command line
-
hf download hf://spaces/s-eto-hub/firecrawl-api/apps/php-sdk/src/Models/QueryFormat.php
-
curl -L -o QueryFormat.php https://huggingface.co/spaces/s-eto-hub/firecrawl-api/resolve/main/apps/php-sdk/src/Models/QueryFormat.php
1.19 kB
| declare(strict_types=1); | |
| namespace Firecrawl\Models; | |
| /** @deprecated Use QuestionFormat or HighlightsFormat instead. */ | |
| final class QueryFormat | |
| { | |
| public const MODE_FREEFORM = 'freeform'; | |
| public const MODE_DIRECT_QUOTE = 'directQuote'; | |
| private function __construct( | |
| private readonly string $prompt, | |
| private readonly ?string $mode = null, | |
| ) {} | |
| public static function with( | |
| string $prompt, | |
| ?string $mode = null, | |
| ): self { | |
| if ($mode !== null && !in_array($mode, [self::MODE_FREEFORM, self::MODE_DIRECT_QUOTE], true)) { | |
| throw new \InvalidArgumentException("query mode must be 'freeform' or 'directQuote'"); | |
| } | |
| return new self($prompt, $mode); | |
| } | |
| /** @return array<string, mixed> */ | |
| public function toArray(): array | |
| { | |
| return array_filter([ | |
| 'type' => 'query', | |
| 'prompt' => $this->prompt, | |
| 'mode' => $this->mode, | |
| ], fn (mixed $v): bool => $v !== null); | |
| } | |
| public function getPrompt(): string | |
| { | |
| return $this->prompt; | |
| } | |
| public function getMode(): ?string | |
| { | |
| return $this->mode; | |
| } | |
| } | |