Liking cljdoc? Tell your friends :D

llm.sdk.transport

Transport protocol definition. A transport owns the translation between canonical SDK shapes and provider-native wire formats.

Transport protocol definition. A transport owns the translation between
canonical SDK shapes and provider-native wire formats.
raw docstring

bytes->base64clj

(bytes->base64 bs)
source

content->stringclj

(content->string content)

Extract text string from message content (string or vector of parts).

Extract text string from message content (string or vector of parts).
sourceraw docstring

developer-role-swapclj

(developer-role-swap messages model)

Swap system → developer for models that require it.

Swap system → developer for models that require it.
sourceraw docstring

extract-text-from-partsclj

(extract-text-from-parts content)

Extract text string from parts.

Extract text string from parts.
sourceraw docstring

extract-tool-calls-from-partsclj

(extract-tool-calls-from-parts content)

Extract tool-call parts from message content.

Extract tool-call parts from message content.
sourceraw docstring

file-binary-dataclj

(file-binary-data part)

Return base64 encoded file bytes from :file/data or :file/bytes. :file/data is assumed to already be base64 encoded.

Return base64 encoded file bytes from :file/data or :file/bytes.
:file/data is assumed to already be base64 encoded.
sourceraw docstring

file-data-for-input-fileclj

(file-data-for-input-file part)

Return base64 content for providers whose file input field expects encoded file data. Text content is UTF-8 encoded.

Return base64 content for providers whose file input field expects
encoded file data. Text content is UTF-8 encoded.
sourceraw docstring

file-data-uri-for-input-fileclj

(file-data-uri-for-input-file part)

Return a data URI for OpenAI file_data fields. OpenAI Responses and Chat Completions reject raw base64 here; they expect data:<mime>;base64,<payload>.

Return a data URI for OpenAI file_data fields.
OpenAI Responses and Chat Completions reject raw base64 here; they expect
data:<mime>;base64,<payload>.
sourceraw docstring

file-extensionclj

(file-extension part)
source

file-mime-typeclj

(file-mime-type part)
source

file-nameclj

(file-name part)
source

file-text-contentclj

(file-text-content part)
source

map-finish-reasonclj

(map-finish-reason raw mapping)

Map provider finish reason strings to canonical keywords.

Map provider finish reason strings to canonical keywords.
sourceraw docstring

missing-file-source!clj

(missing-file-source! provider-id part)
source

parts->text-partsclj

(parts->text-parts content)

Convert a string or seq of parts into a vector of text parts.

Convert a string or seq of parts into a vector of text parts.
sourceraw docstring

sanitize-messagesclj

(sanitize-messages messages)

Strip internal fields from messages before sending to strict providers. Removes codex_reasoning_items, codex_message_items, tool_name, call_id, response_item_id from tool_calls.

Strip internal fields from messages before sending to strict providers.
Removes codex_reasoning_items, codex_message_items, tool_name, call_id,
response_item_id from tool_calls.
sourceraw docstring

stop-sequencesclj

(stop-sequences stop)

Normalize canonical :request/stop into providers' stop-sequence arrays. A single string is one sequence, not a seq of characters.

Normalize canonical :request/stop into providers' stop-sequence arrays.
A single string is one sequence, not a seq of characters.
sourceraw docstring

text->base64clj

(text->base64 s)
source

Transportcljprotocol

Provider-specific format conversion and normalization.

Provider-specific format conversion and normalization.

build-requestclj

(build-request this profile request)

Given a provider profile and canonical request, return the native request map (body + url + method + headers) ready for HTTP execution.

Given a provider profile and canonical request, return the native
request map (body + url + method + headers) ready for HTTP execution.

normalize-usageclj

(normalize-usage this profile raw-usage)

Given raw provider usage data, return canonical Usage map.

Given raw provider usage data, return canonical Usage map.

parse-errorclj

(parse-error this profile status body)

Given HTTP status and body, return a classified error map.

Given HTTP status and body, return a classified error map.

parse-responseclj

(parse-response this profile raw-response)

Given a provider profile and raw HTTP response body, return a canonical Response map.

Given a provider profile and raw HTTP response body, return a
canonical Response map.

parse-stream-eventclj

(parse-stream-event this profile line)

Given an SSE line string, return a StreamEvent map, a vector of StreamEvent maps (when one SSE line carries multiple semantic events, e.g. Perplexity's final chunk with citations + usage + finish_reason), or nil if the line should be ignored.

Given an SSE line string, return a StreamEvent map, a vector of
StreamEvent maps (when one SSE line carries multiple semantic
events, e.g. Perplexity's final chunk with citations + usage +
finish_reason), or nil if the line should be ignored.

request-capabilitiesclj

(request-capabilities this)

Return set of capabilities supported by this transport.

Return set of capabilities supported by this transport.
sourceraw docstring

unsupported-file-part!clj

(unsupported-file-part! provider-id part)
source

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close