Every request to a text model is ultimately a list ofDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/phpaisdk/core/llms.txt
Use this file to discover all available pages before exploring further.
Message objects. Each message has a role (user, assistant, system, or tool) and one or more Content parts. Content parts can be plain text, images, audio, or files — the SDK resolves the correct internal source representation automatically so you never have to manage base64 encoding by hand.
Message factory methods
Message is a final value object constructed exclusively through four static factories.
Message::system()
Injects a system prompt. Takes a plain string and wraps it in a single Content::text() part.
Message::user()
Creates a user turn. Accepts either a plain string (converted to Content::text()) or an array of Content instances for multimodal input.
Message::assistant()
Represents a prior model turn, typically used when replaying conversation history. Optionally carries ToolCall objects from a previous agentic step.
Message::tool()
Records the result of a tool execution. The toolCallId must match the ID from the corresponding ToolCall the model emitted.
Content types
Content is a final value object with four static factories, each representing a different media type. All media content factories (image, audio, file) share the same signature:
Content::text()
Content::image()
Content::audio() and Content::file()
These follow the same resolution rules as Content::image(). Use Content::audio() for models that support AudioInput and Content::file() for models that support FileInput.
ContentSource: how the SDK classifies input
ContentSource is a backed string enum used internally by Content to record how a piece of media arrived. You do not set it directly — the SDK’s resolveSource() logic picks the correct case based on what you pass in.
| Case | Value | When it is used |
|---|---|---|
Text | 'text' | Plain text content created via Content::text(). |
Url | 'url' | A valid http:// or https:// URL. |
DataUri | 'data_uri' | A string beginning with data:. |
Base64 | 'base64' | A string passed with InputEncoding::Base64. |
Raw | 'raw' | A readable file path (read into memory) or a raw binary string with a MIME type. |
InputEncoding
InputEncoding is a single-case backed enum used to signal that a string is already base64-encoded:
InputEncoding::Base64, a string that is not a URL, not a data URI, and not a readable file path is treated as raw binary and must be accompanied by a MIME type. Passing InputEncoding::Base64 tells the SDK to store the string as-is under ContentSource::Base64 and also requires a MIME type.
Conversation history
Pass a full conversation history to->messages() on a PendingTextRequest. This replaces any prompt previously set via ->prompt().
->messages() and ->prompt() both write to the same internal $messages array. ->prompt() appends a Message::user() to the array, while ->messages() replaces it entirely. Call ->instructions() to set a system instruction rather than prepending a Message::system() manually.Multimodal message example
Here is a complete example that sends a user message containing both an image and a text question, alongside a system instruction:- URL source
- File path
- Base64 string
- Data URI