Class LlmChaosProfile
HttpLlmResponse, for testing
agent resilience: probabilistic provider errors (e.g. 429/529 with a
Retry-After header), mid-stream truncation, and malformed SSE chunks.
Determinism: with errorProbability of 1.0 (always) or
0.0/null (never) the error decision is fully deterministic. A
fractional probability draws once per response; set seed to make that
single draw reproducible (note: a fixed seed yields the same decision every
time). Truncation and malformed-SSE are deterministic. Follows the model
field/withX/getter convention so it round-trips without a bespoke
(de)serializer.
It also carries an optional stateful request quota (a fixed-window
rate limit): when quotaName, quotaLimit, and
quotaWindowMillis are set, requests beyond quotaLimit within
the window are rejected with quotaErrorStatus (default 429) and the
retryAfter header. Unlike the probabilistic error this is
deterministic and counts real requests across the process (see
LlmQuotaRegistry); expectations sharing a
quotaName share one counter.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleangetSeed()inthashCode()static LlmChaosProfilewithErrorProbability(Double errorProbability) withErrorStatus(Integer errorStatus) withMalformedSse(Boolean malformedSse) withQuotaErrorStatus(Integer quotaErrorStatus) withQuotaLimit(Integer quotaLimit) withQuotaName(String quotaName) withQuotaWindowMillis(Long quotaWindowMillis) withRetryAfter(String retryAfter) withTruncateAtFraction(Double truncateAtFraction) withTruncateMode(LlmChaosProfile.TruncateMode truncateMode) Methods inherited from class org.mockserver.model.ObjectWithJsonToString
toStringMethods inherited from class org.mockserver.model.ObjectWithReflectiveEqualsHashCodeToString
fieldsExcludedFromEqualsAndHashCode
-
Constructor Details
-
LlmChaosProfile
public LlmChaosProfile()
-
-
Method Details
-
llmChaosProfile
-
withErrorStatus
-
getErrorStatus
-
withRetryAfter
-
getRetryAfter
-
withErrorProbability
-
getErrorProbability
-
withTruncateMode
-
getTruncateMode
-
withTruncateAtFraction
-
getTruncateAtFraction
-
withMalformedSse
-
getMalformedSse
-
withSeed
-
getSeed
-
withQuotaName
-
getQuotaName
-
withQuotaLimit
-
getQuotaLimit
-
withQuotaWindowMillis
-
getQuotaWindowMillis
-
withQuotaErrorStatus
-
getQuotaErrorStatus
-
equals
- Overrides:
equalsin classObjectWithReflectiveEqualsHashCodeToString
-
hashCode
public int hashCode()- Overrides:
hashCodein classObjectWithReflectiveEqualsHashCodeToString
-