Package akka.javasdk.agent
Record Class ModelProvider.FromConfig
- Record Components:
configPath- the configuration path to read model settings from, empty for the path named byakka.javasdk.agent.model-provideradditionalModelRequestHeaders- extra HTTP headers, added to the headers of the provider thatconfigPathresolves to
- All Implemented Interfaces:
ModelProvider
- Enclosing interface:
ModelProvider
public static record ModelProvider.FromConfig(String configPath, List<akka.http.javadsl.model.HttpHeader> additionalModelRequestHeaders)
extends Record
implements ModelProvider
A model provider selected by configuration, resolved when the agent makes the request.
-
Nested Class Summary
Nested classes/interfaces inherited from interface akka.javasdk.agent.ModelProvider
ModelProvider.Anthropic, ModelProvider.AzureOpenAi, ModelProvider.Bedrock, ModelProvider.BedrockPromptCachePlacement, ModelProvider.Custom, ModelProvider.FromConfig, ModelProvider.GoogleAIGemini, ModelProvider.HuggingFace, ModelProvider.LocalAI, ModelProvider.MistralAi, ModelProvider.Ollama, ModelProvider.OpenAi, ModelProvider.VertexAi -
Constructor Summary
ConstructorsConstructorDescriptionFromConfig(String configPath) FromConfig(String configPath, List<akka.http.javadsl.model.HttpHeader> additionalModelRequestHeaders) Creates an instance of aFromConfigrecord class. -
Method Summary
Modifier and TypeMethodDescriptionList<akka.http.javadsl.model.HttpHeader> Returns the value of theadditionalModelRequestHeadersrecord component.Returns the value of theconfigPathrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.withAdditionalModelRequestHeaders(List<akka.http.javadsl.model.HttpHeader> additionalModelRequestHeaders) Returns a copy of this provider with the given extra HTTP headers on every request to the model API.
-
Constructor Details
-
FromConfig
-
FromConfig
public FromConfig(String configPath, List<akka.http.javadsl.model.HttpHeader> additionalModelRequestHeaders) Creates an instance of aFromConfigrecord class.- Parameters:
configPath- the value for theconfigPathrecord componentadditionalModelRequestHeaders- the value for theadditionalModelRequestHeadersrecord component
-
-
Method Details
-
withAdditionalModelRequestHeaders
public ModelProvider.FromConfig withAdditionalModelRequestHeaders(List<akka.http.javadsl.model.HttpHeader> additionalModelRequestHeaders) Description copied from interface:ModelProviderReturns a copy of this provider with the given extra HTTP headers on every request to the model API. Use it for authentication tokens to an AI gateway or proxy, or for routing and tracing headers.For a provider built in code, the given headers replace whatever the configuration set for that provider. For
ModelProvider.FromConfig, they are added to the headers of the provider that the configuration resolves to, and a header named in both takes the value given here.ModelProvider.CustomthrowsUnsupportedOperationExceptionunless the implementation overrides this method.- Specified by:
withAdditionalModelRequestHeadersin interfaceModelProvider- Parameters:
additionalModelRequestHeaders- the headers to add to each model request- Returns:
- a copy of this provider carrying the given headers
-
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). -
configPath
Returns the value of theconfigPathrecord component.- Returns:
- the value of the
configPathrecord component
-
additionalModelRequestHeaders
Returns the value of theadditionalModelRequestHeadersrecord component.- Returns:
- the value of the
additionalModelRequestHeadersrecord component
-