ProviderTimeouts

org.llm4s.llmconnect.config.ProviderTimeouts
See theProviderTimeouts companion object
@Stable
final case class ProviderTimeouts

How long a provider's HTTP calls may take, as configured in the timeouts block of a named provider section:

llm4s.providers.my-openai {
 provider = "openai"
 model    = "gpt-4o"
 timeouts { request = 3m, stream = 15m }
}

Each value is optional. An absent value means ''this provider's own default'', which differs by client (for example 2 minutes for a Gemini or Ollama request and 10 minutes for its stream), so a client reads a timeout with requestOr or streamOr and supplies its own default. A section without a timeouts block behaves exactly as it did before the block existed.

  • request bounds a call that returns one response: a completion, an embedding.
  • stream bounds a streamed completion, from the request to the end of the stream. It is separate because a long generation legitimately outlives a request that returns at once.

A value must be positive and finite: java.net.http.HttpRequest.timeout rejects anything else, and Duration.Inf is not a FiniteDuration. Loading a section checks it (validated); a value set with withRequest or withStream on a hand-built config is not checked until a client uses it.

The constructor is private: build one with the companion apply or ProviderTimeouts.default and adjust it with the with* setters, so adding a field later never breaks a caller.

Value parameters

request

the timeout of a call that returns one response, or None for the client's default

stream

the timeout of a streamed completion, or None for the client's default

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def isDefault: Boolean

true when neither timeout is set, so every client keeps its own default.

true when neither timeout is set, so every client keeps its own default.

Attributes

def requestOr(default: FiniteDuration): FiniteDuration

The configured request timeout, or default when the section sets none.

The configured request timeout, or default when the section sets none.

Attributes

def streamOr(default: FiniteDuration): FiniteDuration

The configured stream timeout, or default when the section sets none.

The configured stream timeout, or default when the section sets none.

Attributes

def withRequest(request: FiniteDuration): ProviderTimeouts
def withRequest(request: Option[FiniteDuration]): ProviderTimeouts
def withStream(stream: FiniteDuration): ProviderTimeouts
def withStream(stream: Option[FiniteDuration]): ProviderTimeouts

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product