Package akka.javasdk.agent
Record Class ModelProvider.Ollama
- All Implemented Interfaces:
ModelProvider
- Enclosing interface:
ModelProvider
public static record ModelProvider.Ollama(String baseUrl, String modelName, Double temperature, Double topP, Duration connectionTimeout, Duration responseTimeout, int maxRetries, boolean think, List<akka.http.javadsl.model.HttpHeader> additionalModelRequestHeaders)
extends Record
implements ModelProvider
Settings for the Ollama Large Language Model provider.
-
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
ConstructorsConstructorDescriptionOllama(String baseUrl, String modelName, Double temperature, Double topP, Duration connectionTimeout, Duration responseTimeout, int maxRetries, boolean think, List<akka.http.javadsl.model.HttpHeader> additionalModelRequestHeaders) Creates an instance of aOllamarecord class. -
Method Summary
Modifier and TypeMethodDescriptionList<akka.http.javadsl.model.HttpHeader> Returns the value of theadditionalModelRequestHeadersrecord component.baseUrl()Returns the value of thebaseUrlrecord component.Returns the value of theconnectionTimeoutrecord component.final booleanIndicates whether some other object is "equal to" this one.static ModelProvider.OllamafromConfig(com.typesafe.config.Config config) final inthashCode()Returns a hash code value for this object.intReturns the value of themaxRetriesrecord component.Returns the value of themodelNamerecord component.Returns the value of theresponseTimeoutrecord component.Returns the value of thetemperaturerecord component.booleanthink()Returns the value of thethinkrecord component.topP()Returns the value of thetopPrecord component.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.withBaseUrl(String baseUrl) withConnectionTimeout(Duration connectionTimeout) withMaxRetries(int maxRetries) withModelName(String modelName) withResponseTimeout(Duration responseTimeout) withTemperature(double temperature) withThink(boolean think) withTopP(double topP)
-
Constructor Details
-
Ollama
public Ollama(String baseUrl, String modelName, Double temperature, Double topP, Duration connectionTimeout, Duration responseTimeout, int maxRetries, boolean think, List<akka.http.javadsl.model.HttpHeader> additionalModelRequestHeaders) Creates an instance of aOllamarecord class.- Parameters:
baseUrl- the value for thebaseUrlrecord componentmodelName- the value for themodelNamerecord componenttemperature- the value for thetemperaturerecord componenttopP- the value for thetopPrecord componentconnectionTimeout- the value for theconnectionTimeoutrecord componentresponseTimeout- the value for theresponseTimeoutrecord componentmaxRetries- the value for themaxRetriesrecord componentthink- the value for thethinkrecord componentadditionalModelRequestHeaders- the value for theadditionalModelRequestHeadersrecord component
-
-
Method Details
-
fromConfig
-
withBaseUrl
-
withModelName
-
withTemperature
-
withTopP
-
withConnectionTimeout
-
withResponseTimeout
-
withMaxRetries
-
withThink
-
withAdditionalModelRequestHeaders
public ModelProvider.Ollama 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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
baseUrl
Returns the value of thebaseUrlrecord component.- Returns:
- the value of the
baseUrlrecord component
-
modelName
Returns the value of themodelNamerecord component.- Returns:
- the value of the
modelNamerecord component
-
temperature
Returns the value of thetemperaturerecord component.- Returns:
- the value of the
temperaturerecord component
-
topP
Returns the value of thetopPrecord component.- Returns:
- the value of the
topPrecord component
-
connectionTimeout
Returns the value of theconnectionTimeoutrecord component.- Returns:
- the value of the
connectionTimeoutrecord component
-
responseTimeout
Returns the value of theresponseTimeoutrecord component.- Returns:
- the value of the
responseTimeoutrecord component
-
maxRetries
public int maxRetries()Returns the value of themaxRetriesrecord component.- Returns:
- the value of the
maxRetriesrecord component
-
think
public boolean think()Returns the value of thethinkrecord component.- Returns:
- the value of the
thinkrecord component
-
additionalModelRequestHeaders
Returns the value of theadditionalModelRequestHeadersrecord component.- Returns:
- the value of the
additionalModelRequestHeadersrecord component
-