RoundRobinRouter

Distributes requests across clients in sequential rotation, ensuring even load distribution.

When multiple clients serve the same provider, cycles through them using an atomic counter. Thread-safe for concurrent access.

Parameters

clientsPerProvider

Map of providers to their available clients

Constructors

Link copied to clipboard
constructor(clientsPerProvider: Map<LLMProvider, List<LLMClient>>)
constructor(clients: List<LLMClient>)

Creates router from a flat list of clients, grouping by provider automatically.

constructor(vararg clients: LLMClient)

Creates router from vararg clients, grouping by provider automatically.

constructor(vararg llmClients: Pair<LLMProvider, LLMClient>)

Creates router from provider-client pairs, grouping by provider automatically.

Properties

Link copied to clipboard
open override val clients: List<LLMClient>

All clients that this router can use

Functions

Link copied to clipboard
open override fun clientFor(model: LLModel): LLMClient?

Selects a client to handle the given model.