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.
(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).
(developer-role-swap messages model)Swap system → developer for models that require it.
Swap system → developer for models that require it.
(extract-text-from-parts content)Extract text string from parts.
Extract text string from parts.
(extract-tool-calls-from-parts content)Extract tool-call parts from message content.
Extract tool-call parts from message content.
(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.
(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.
(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>.
(map-finish-reason raw mapping)Map provider finish reason strings to canonical keywords.
Map provider finish reason strings to canonical keywords.
(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.
(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.
(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.
Provider-specific format conversion and normalization.
Provider-specific format conversion and normalization.
(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-usage this profile raw-usage)Given raw provider usage data, return canonical Usage map.
Given raw provider usage data, return canonical Usage map.
(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-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-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-capabilities this)Return set of capabilities supported by this transport.
Return set of capabilities supported by this transport.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |