Skip to main content

chat_completions_handler

Function chat_completions_handler 

Source
pub async fn chat_completions_handler(
    __arg0: State<Arc<AppState>>,
    tenant: Option<Extension<TenantId>>,
    auth: Option<Extension<AuthContext>>,
    payload: Result<Json<ChatCompletionsRequest>, JsonRejection>,
) -> Response
Expand description

POST /v1/chat/completions — OpenAI chat-completions shim, wired through to the internal invoke protocol (T41, v0.4).

Same flow as completions_handler but with the chat envelope (response object: "chat.completion", choices carry a {role, content} message object) and the messages array concatenated into a single prompt string via crate::openai_translator::assemble_chat_prompt.