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.
(extract-tool-result provider-id message)Return one canonical tool result from a :tool message.
String and text-part content use message-level identifiers. A typed ToolResultPart supplies its own id, name, content, and error status. Mixed or conflicting representations are rejected rather than silently dropping tool output or routing it to the wrong call.
Return one canonical tool result from a :tool message. String and text-part content use message-level identifiers. A typed ToolResultPart supplies its own id, name, content, and error status. Mixed or conflicting representations are rejected rather than silently dropping tool output or routing it to the wrong call.
(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>.
(image-url-or-data-uri! provider-id part)Return an image URL, converting raw base64 :image/data to a data URI. Data URIs already supplied in either canonical field are preserved.
Return an image URL, converting raw base64 :image/data to a data URI. Data URIs already supplied in either canonical field are preserved.
(map-finish-reason raw mapping)Map provider finish reason strings to canonical keywords.
Map provider finish reason strings to canonical keywords.
(merge-extra-body provider-id canonical extra-body)(merge-extra-body provider-id canonical extra-body reserved-fields)Merge provider extra_body fields into a canonical wire body.
String key spellings are normalized to keywords. Any extra field that collides with a canonical body field or an explicitly reserved field is rejected rather than silently discarded.
Merge provider extra_body fields into a canonical wire body. String key spellings are normalized to keywords. Any extra field that collides with a canonical body field or an explicitly reserved field is rejected rather than silently discarded.
(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.
(reject-error-tool-result! provider-id tool-result)Reject an error result when a provider wire format has no error-status field.
Reject an error result when a provider wire format has no error-status field.
(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 |