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 TypeMethodDescriptionorg.mockserver.mock.Expectation[]applyTo(MockServerClient client) Build the expectation and register it with the MockServerClient.org.mockserver.mock.Expectationbuild()Build the expectation without registering it.static LlmMockBuilderEntry point for building an LLM mock expectation.respondingWith(org.mockserver.model.Completion completion) respondingWith(org.mockserver.model.EmbeddingResponse embedding) withProvider(org.mockserver.model.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
public org.mockserver.mock.Expectation build()Build the expectation without registering it.- Returns:
- the built expectation
-