MistralConfig

org.llm4s.llmconnect.config.MistralConfig
See theMistralConfig companion object
@Experimental
final case class MistralConfig extends ProviderConfig

Configuration for the Mistral AI API.

Prefer MistralConfig.fromValues over the companion apply; it resolves contextWindow and reserveCompletion automatically from the model name.

This was in llm4s-core until Mistral moved onto llm4s-openai-compatible's shared client (#1132); its package is unchanged.

The constructor is private: build one with the companion apply, whose defaults cover every field after model, and adjust it with the with* setters. Java and Kotlin, which cannot see Scala default arguments, use MistralConfig.apply(apiKey, model) and the setters, so adding a field never breaks them (#2264).

Value parameters

apiKey

Mistral API key; redacted in toString.

apiKeyProvider

asked for the key on every request instead of sending apiKey, so a rotated key is used without rebuilding the client (#2477): a section's apiKeyFile sets one

baseUrl

API root; defaults to MistralConfig.DEFAULT_BASE_URL. Requests go to <baseUrl>/v1/chat/completions - see MistralConfig.apiBaseUrl.

contextWindow

Model's total token capacity (prompt + completion combined).

model

Model identifier, e.g. "mistral-large-latest".

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)

Attributes

Companion
object
Source
MistralConfig.scala
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

override def endpointUrl: Option[BaseUrl]

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.

Attributes

Definition Classes
Source
MistralConfig.scala
override def toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
Any
Source
MistralConfig.scala

Attributes

Source
MistralConfig.scala

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.

Attributes

Returns

the config, or a org.llm4s.error.ConfigurationError from a config that cannot take one: a provider that authenticates without an API key (Ollama, Bedrock, Vertex AI), or one whose client reads the key once. ProviderConfig.noApiKeyProvider builds that error. It is never ignored.

Definition Classes
Source
MistralConfig.scala

Attributes

Source
MistralConfig.scala
def withContextWindow(contextWindow: Int): MistralConfig

Attributes

Source
MistralConfig.scala
override def withModel(model: ModelName): MistralConfig

The same provider and credentials, pointed at a different model.

The same provider and credentials, pointed at a different model.

Attributes

Definition Classes
Source
MistralConfig.scala

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. There is no default, so a configured proxy is never bypassed by omission. A config whose provider makes no HTTP call returns itself and keeps network at the default; the loader then refuses a section with an http block of its own (the process-wide llm4s.http has nothing to route there, so it is not an error).

Attributes

Definition Classes
Source
MistralConfig.scala
def withReserveCompletion(reserveCompletion: Int): MistralConfig

Attributes

Source
MistralConfig.scala
override def withTimeouts(timeouts: ProviderTimeouts): MistralConfig

The same config with the given timeouts.

The same config with the given timeouts.

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. There is no default: a config states what it does with them. One whose provider makes no timed call (a model run in-process) returns itself and keeps timeouts at the default, and the loader then refuses a section that sets timeouts rather than dropping them.

Attributes

Definition Classes
Source
MistralConfig.scala

Inherited methods

Attributes

Inherited from:
Product

Attributes

Inherited from:
Product

Concrete fields

override val providerId: ProviderId

Canonical id of the provider this config addresses, e.g. ProviderId("openai").

Canonical id of the provider this config addresses, e.g. ProviderId("openai").

Attributes

Source
MistralConfig.scala