Package org.mockserver.client
Class LlmMockBuilder
java.lang.Object
org.mockserver.client.LlmMockBuilder
Fluent builder for creating LLM mock expectations.
Usage:
llmMock("/v1/messages")
.withProvider(Provider.ANTHROPIC)
.withModel("claude-sonnet-4")
.respondingWith(
completion()
.withText("The capital of France is Paris.")
.withStopReason("end_turn")
.withUsage(usage().withInputTokens(42).withOutputTokens(8))
)
.applyTo(mockServerClient);
-
Method Summary
Modifier and TypeMethodDescriptionapplyTo(MockServerClient client) Build the expectation and register it with the MockServerClient.build()Build the expectation without registering it.static LlmMockBuilderEntry point for building an LLM mock expectation.respondingWith(Completion completion) respondingWith(EmbeddingResponse embedding) withProvider(Provider provider)
-
Method Details
-
llmMock
Entry point for building an LLM mock expectation.- Parameters:
path- the HTTP path to match (e.g. "/v1/messages", "/v1/chat/completions")- Returns:
- a new LlmMockBuilder
-
withProvider
-
withModel
-
respondingWith
-
respondingWith
-
applyTo
Build the expectation and register it with the MockServerClient.- Parameters:
client- the MockServerClient to register with- Returns:
- the created expectations
-
build
Build the expectation without registering it.- Returns:
- the built expectation
-