org.llm4s.reliability
Members list
Type members
Classlikes
Circuit breaker configuration for service resilience.
Circuit breaker configuration for service resilience.
Value parameters
- failureThreshold
-
Number of consecutive failures before opening circuit
- recoveryTimeout
-
Time to wait before attempting recovery (half-open state)
- successThreshold
-
Number of successes in half-open state to close circuit
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
CircuitBreakerConfig.type
Attributes
- Companion
- trait
- Supertypes
-
trait Sumtrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
CircuitState.type
Configuration for reliable LLM provider calls.
Configuration for reliable LLM provider calls.
Provides retry logic, circuit breakers, and deadline enforcement to make LLM API calls resilient to transient failures.
Value parameters
- circuitBreaker
-
Circuit breaker configuration
- deadline
-
Maximum time to wait for operation completion
- enabled
-
Whether reliability features are enabled (for opt-out)
- retryPolicy
-
Retry policy for transient failures
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
ReliabilityConfig.type
Implicit syntax extensions for adding reliability to existing clients.
Implicit syntax extensions for adding reliability to existing clients.
Import this to add .withReliability() method to any LLMClient.
Example:
import org.llm4s.reliability.ReliabilitySyntax._
val client = OpenAIClient(config, metrics).map(_.withReliability("openai"))
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
ReliabilitySyntax.type
Wrapper that adds reliability features to any LLMClient.
Wrapper that adds reliability features to any LLMClient.
Provides:
- Retry with configurable policies (exponential backoff, linear, fixed)
- Circuit breaker to fail fast when service is down
- Deadline enforcement to prevent hanging operations
- Metrics tracking for retry attempts and circuit breaker state
Thread-safety: Uses AtomicInteger/AtomicReference for circuit breaker state management to ensure correct behavior under concurrent access.
Value parameters
- collector
-
Optional metrics collector for observability
- config
-
Reliability configuration
- providerName
-
Explicit provider name for stable metrics labels
- underlying
-
The client to wrap
Attributes
- Companion
- object
- Supertypes
Attributes
- Companion
- class
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
ReliableClient.type
Convenience methods for wrapping provider clients with reliability features.
Convenience methods for wrapping provider clients with reliability features.
Provides easy-to-use factory methods for creating reliable versions of each LLM provider client (OpenAI, Anthropic, Gemini, Ollama, OpenRouter, Zai).
Example usage:
// Create a reliable OpenAI client with default settings
val client = ReliableProviders.openai(
OpenAIConfig(
apiKey = "sk-...",
model = "gpt-4o"
)
)
// Or with custom reliability config
val aggressiveClient = ReliableProviders.openai(
OpenAIConfig(apiKey = "sk-...", model = "gpt-4o"),
ReliabilityConfig.aggressive
)
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
ReliableProviders.type
Retry policy for transient failures.
Retry policy for transient failures.
Defines how many times to retry and how long to wait between attempts.
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
RetryPolicy.type