Skip to main content

Module messages_loop

Module messages_loop 

Source
Expand description

Messages-native gateway tool loop.

Runs the server-side gateway-tool loop for /v1/messages natively: the client’s Anthropic request is forwarded to vLLM /v1/messages essentially untouched (preserving every Anthropic field), the assistant turn is inspected, any gateway-owned tool_use is executed server-side and hidden, the loop appends the tool_result and re-POSTs, until the model stops asking for a gateway tool. Only the final assistant message reaches the client.

This never touches RequestPayload/ResponsePayload; it reuses only the protocol-neutral tool layer (ToolRegistry::dispatch) via crate::types::messages::tool_seam. Non-streaming only; streaming lives in messages_stream.

Structs§

MessagesResponse
A Messages loop result paired with safe metadata from the relevant upstream response.
MessagesUpstream
Per-request transport data reused for every upstream Messages round.

Functions§

run_messages_loop
Run the Messages-native gateway tool loop and return the final assistant message (Anthropic JSON Value).