Package org.mockserver.mock.action.http
Class HttpLlmResponseActionHandler
java.lang.Object
org.mockserver.mock.action.http.HttpLlmResponseActionHandler
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionchaosErrorResponseOrNull(HttpLlmResponse httpLlmResponse) Returns an errorHttpResponse(status + optionalRetry-After) when the chaos profile triggers a probabilistic error, ornullotherwise.handle(HttpLlmResponse httpLlmResponse, HttpRequest request) handleStreaming(HttpLlmResponse httpLlmResponse, HttpRequest request) Handle streaming LLM response by producing a list of SSE events.streamingFormatFor(Provider provider) Returns the streaming wire format for the given provider.
-
Constructor Details
-
HttpLlmResponseActionHandler
-
-
Method Details
-
handle
-
streamingFormatFor
Returns the streaming wire format for the given provider. Used by the action handler dispatch to choose between SSE and NDJSON framing.- Parameters:
provider- the LLM provider- Returns:
- the streaming format (defaults to
StreamingFormat.SSE)
-
handleStreaming
Handle streaming LLM response by producing a list of SSE events. Called by HttpActionHandler when streaming is detected.- Parameters:
httpLlmResponse- the LLM response actionrequest- the original HTTP request- Returns:
- list of SSE events to be sent through the SSE handler
-
chaosErrorResponseOrNull
Returns an errorHttpResponse(status + optionalRetry-After) when the chaos profile triggers a probabilistic error, ornullotherwise. AnerrorStatuswith noerrorProbabilityalways fires; a fractional probability draws once (reproducible viaseed). Applies to both streaming and non-streaming responses — a provider error is a normal HTTP response, not an SSE stream.
-