Where a codec can get the bytes for an image or a file part.
A single boolean cannot answer "can I send this part", because the canonical source
has three kinds and the protocols disagree about them: OpenAI Responses takes a
provider file_id, Anthropic takes one for a document but not for an image, Gemini
takes neither, and a URL is not the same thing as a file the provider already has.
Declaring true for all of them made the declaration wrong in one direction or the
other, and false refused parts the codec could encode.
So a capability names the kinds it accepts, one boolean each:
| Kind | Canonical source | Who resolves it |
|---|---|---|
:inline | {:base64, data} | the bytes travel in the request |
:url | {:url, url}, or a bare string | the provider fetches it over HTTP |
:uri | {:uri, uri} | the provider resolves a URI in its own namespace (s3://, gs://) |
:file | {:file_id, id} | the provider resolves an opaque id it issued |
:url and :uri are separate because they answer different questions. An HTTP URL
is something any client could fetch; an s3:// or gs:// URI is only reachable by
the provider, in its own account. A codec that accepts one and not the other can
now say so, and one that accepts neither stops claiming it accepts both.
The default accepts nothing, which is what false meant before. accepts?/2
answers the question for a concrete part, and kinds/1 lists what a declaration
allows.
%LlmCall.Capabilities{
image_input: %LlmCall.Capabilities.Input{inline: true, url: true}
}
Summary
Functions
Whether a canonical source is one this declaration accepts.
The kind a canonical source belongs to.
The kinds a declaration accepts, in canonical order.
Types
Functions
@spec accepts?(t(), LlmCall.Content.source()) :: boolean()
Whether a canonical source is one this declaration accepts.
@spec kind(LlmCall.Content.source()) :: kind()
The kind a canonical source belongs to.
A bare string is a URL: it is the shorthand the HTTP codecs already read as one.
The kinds a declaration accepts, in canonical order.