WordPress\AiClient\Builders
PromptBuilder::withFile
Adds a file to the current message.
Accepts:
- File object
- URL string (remote file)
- Base64-encoded data string
- Data URI string (data:mime/type;base64,data)
- Local file path string
Метод класса: PromptBuilder{}
Хуков нет.
Возвращает
self.
Использование
$PromptBuilder = new PromptBuilder(); $PromptBuilder->withFile( $file, ?string $mimeType ): self;
- $file(строка|File) (обязательный)
- The file (File object or string representation).
- ?string $mimeType
- .
По умолчанию:null
Список изменений
| С версии 0.1.0 | Введена. |
Код PromptBuilder::withFile() PromptBuilder::withFile WP 7.1.2
public function withFile($file, ?string $mimeType = null): self
{
$file = $file instanceof File ? $file : new File($file, $mimeType);
$part = new MessagePart($file);
$this->appendPartToMessages($part);
return $this;
}