nsmcp::ChatCompletionsBackend method streamHeaders (public)

 <instance of nsmcp::ChatCompletionsBackend[i]> streamHeaders key \
    fields

Defined in /usr/local/ns/tcl/nsmcp/question-chat-completions.tcl

Record streamed HTTP response headers. Update status and content type under the shared response-buffer mutex while the stream remains active.

Parameters:
key (required)
Retained stream or configuration key.
fields (required)
HTTP callback dictionary containing response status and headers.
Returns:
The callback update result.

Testcases:
No testcase defined.
Source code:
ns_mutex lock ${:mutex}
try {
    if {[nsv_get ${:streamStore} $key record]} {
        dict set record status [dict get $fields status]
        dict set record contentType [ns_set iget [dict get $fields headers] content-type]
        nsv_set ${:streamStore} $key $record
    }
} finally {
    ns_mutex unlock ${:mutex}
}
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: