Configuration for a locally-running Ollama instance.
Ollama requires no API key — authentication is handled at the network level by controlling access to the Ollama endpoint. Prefer OllamaConfig.fromValues, which validates the values and resolves contextWindow and reserveCompletion from the bundled model catalogue. The constructor is private: build one with the companion apply and adjust it with the with* setters. Java and Kotlin, which cannot see Scala default arguments, use OllamaConfig.apply(model, baseUrl) and the setters, so adding a field never breaks them.
Value parameters
baseUrl
Ollama server URL, e.g. "http://localhost:11434".
contextWindow
Model's total token capacity (prompt + completion combined).
model
Model identifier as registered in Ollama, e.g. "llama3".
reserveCompletion
Tokens held back from prompt history for the completion.
timeouts
how long a request and a stream may take: the section's timeouts block. An absent value keeps the client's own default (ProviderTimeouts)
The endpoint this config will contact, when it is known statically.
The endpoint this config will contact, when it is known statically.
Used by policy checks and diagnostics that need to know where traffic will go without knowing which provider it belongs to. None means the config carries no single URL — not that it makes no network calls.
The same config with the given proxy and TLS settings.
The same config with the given proxy and TLS settings.
The loader calls this on every config a descriptor builds, as it does withTimeouts, so a descriptor does not read the http block itself. The default returns this: a config that does not carry the setting ignores it. A config that does overrides this with its own return type.
The loader calls this on every config a descriptor builds, passing the section's timeouts block, so a descriptor does not read the block itself. The default returns this: a config that does not carry timeouts, such as one supplied by another module, ignores them. A config that does overrides this with its own return type.
Where the client gets the API key it sends with each request, when not from the key this config holds: a section's apiKeyFile, or a provider set with withApiKeyProvider (#2313).
Where the client gets the API key it sends with each request, when not from the key this config holds: a section's apiKeyFile, or a provider set with withApiKeyProvider (#2313).
The default is None, and so is the value of a config that does not support a provider.
The same config, its client asking provider for the key on each request, so a rotated key is used without rebuilding the client.
The same config, its client asking provider for the key on each request, so a rotated key is used without rebuilding the client.
The loader calls this for a section that sets apiKeyFile. The default returns this: a config whose client cannot take a provider ignores it, and its apiKeyProvider stays None - which the loader reports as an error for apiKeyFile and code setting a provider should check. A config that supports it overrides this with its own return type.