Package org.mockserver.client
Class LlmMockBuilder
- java.lang.Object
-
- org.mockserver.client.LlmMockBuilder
-
public class LlmMockBuilder extends Object
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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Expectation[]applyTo(MockServerClient client)Build the expectation and register it with the MockServerClient.Expectationbuild()Build the expectation without registering it.static LlmMockBuilderllmMock(String path)Entry point for building an LLM mock expectation.LlmMockBuilderrespondingWith(Completion completion)LlmMockBuilderrespondingWith(EmbeddingResponse embedding)LlmMockBuilderwithModel(String model)LlmMockBuilderwithProvider(Provider provider)
-
-
-
Method Detail
-
llmMock
public static LlmMockBuilder llmMock(String path)
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
public LlmMockBuilder withProvider(Provider provider)
-
withModel
public LlmMockBuilder withModel(String model)
-
respondingWith
public LlmMockBuilder respondingWith(Completion completion)
-
respondingWith
public LlmMockBuilder respondingWith(EmbeddingResponse embedding)
-
applyTo
public Expectation[] applyTo(MockServerClient client)
Build the expectation and register it with the MockServerClient.- Parameters:
client- the MockServerClient to register with- Returns:
- the created expectations
-
build
public Expectation build()
Build the expectation without registering it.- Returns:
- the built expectation
-
-