Package org.mockserver.llm.client
Record Class LlmBackend
java.lang.Object
java.lang.Record
org.mockserver.llm.client.LlmBackend
public record LlmBackend(String name, Provider provider, String baseUrl, String apiKey, String model, Map<String,String> headers, Long timeoutMillis)
extends Record
Declares a real LLM backend that MockServer can call as a client
(the opposite direction to the mock codecs, which build outbound mock
responses). Used only by runtime-LLM features (drift detection,
semantic matching) — never on the deterministic assertion/matching path.
Reuses the Provider enum as the "type", mirroring the codec registry
so the provider taxonomy stays the single source of truth. Most fields are
optional: baseUrl and model default per provider in the
per-provider LlmClient, so enabling a backend is usually just a
type plus a key (Ollama needs neither).
Immutable: headers is defensively copied to an unmodifiable map in the
compact constructor. apiKey is a secret and is redacted by
toString().
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionapiKey()Returns the value of theapiKeyrecord component.baseUrl()Returns the value of thebaseUrlrecord component.final booleanIndicates whether some other object is "equal to" this one.booleanfinal inthashCode()Returns a hash code value for this object.headers()Returns the value of theheadersrecord component.model()Returns the value of themodelrecord component.name()Returns the value of thenamerecord component.static LlmBackendConvenience for the common case: a provider type and an API key, all other fields defaulted.provider()Returns the value of theproviderrecord component.Returns the value of thetimeoutMillisrecord component.toString()Returns a string representation of this record class.
-
Constructor Details
-
LlmBackend
public LlmBackend(String name, Provider provider, String baseUrl, String apiKey, String model, Map<String, String> headers, Long timeoutMillis) Creates an instance of aLlmBackendrecord class.- Parameters:
name- the value for thenamerecord componentprovider- the value for theproviderrecord componentbaseUrl- the value for thebaseUrlrecord componentapiKey- the value for theapiKeyrecord componentmodel- the value for themodelrecord componentheaders- the value for theheadersrecord componenttimeoutMillis- the value for thetimeoutMillisrecord component
-
-
Method Details
-
of
Convenience for the common case: a provider type and an API key, all other fields defaulted. -
hasApiKey
public boolean hasApiKey() -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
provider
Returns the value of theproviderrecord component.- Returns:
- the value of the
providerrecord component
-
baseUrl
Returns the value of thebaseUrlrecord component.- Returns:
- the value of the
baseUrlrecord component
-
apiKey
Returns the value of theapiKeyrecord component.- Returns:
- the value of the
apiKeyrecord component
-
model
Returns the value of themodelrecord component.- Returns:
- the value of the
modelrecord component
-
headers
Returns the value of theheadersrecord component.- Returns:
- the value of the
headersrecord component
-
timeoutMillis
Returns the value of thetimeoutMillisrecord component.- Returns:
- the value of the
timeoutMillisrecord component
-