LocalModelCatalog

class LocalModelCatalog(source: LocalModelSource, discovery: LocalModelDiscoveryProperties, ticker: () -> Long = System::nanoTime) : LateArrivingModels

What a LocalModelSource is serving, cached for long enough that asking is not an HTTP round trip per embedding.

Shared by LocalModelRoleResolver and LocalModelEmbeddingRoleResolver rather than held by each, because the two answer from ONE runner and a runner asked twice per call is the cost this class exists to avoid. They are separate classes only because RoleResolver.resolve and EmbeddingRoleResolver.resolve take the same arguments and return different types, so one class cannot implement both.

Elapsed time here is System.nanoTime, not a clock: this measures how long ago the runner was asked, which must survive an NTP step mid-interval. ticker is a parameter so a test can drive the interval rather than sit through it.

Parameters

source

the runner to ask

discovery

how stale an answer may be

ticker

monotonic nanosecond source; override only in tests

Constructors

Link copied to clipboard
constructor(source: LocalModelSource, discovery: LocalModelDiscoveryProperties, ticker: () -> Long = System::nanoTime)

Properties

Link copied to clipboard
open override val lateArrivingProvider: String?

Declared HERE rather than on the resolvers, because this is the object that knows whether a model can arrive late at all.

Link copied to clipboard

Provider name of the runner behind this catalog.

Functions

Link copied to clipboard

An embedding service for model if the runner is serving it AS an embedding model.

Link copied to clipboard

An embedding service for model, built once and then reused, on the same terms.

Link copied to clipboard
fun llmNamed(model: String): LlmService<*>?

A chat service for model if the runner is serving it AS a chat model, or null.

Link copied to clipboard
fun llmService(model: String): LlmService<*>?

A chat service for model, built once and then reused.

Link copied to clipboard

Everything the runner is serving of this kind, for the platform's model listings.

Link copied to clipboard
fun serves(model: String): Boolean

Whether the runner is serving model as far as this catalog can currently tell.