class Builder

Mutable DSL for configuring a Laiya::Configuration.

Definitions

def initialize(configuration)

Attach a DSL builder to the configuration it will update.

Signature

parameter configuration Laiya::Configuration

The mutable configuration.

Implementation

def initialize(configuration)
	@configuration = configuration
end

def provider(name, instance, models: nil)

Configure a provider on the attached configuration.

Signature

parameter name String | Symbol

The provider's routing name.

parameter instance Interface(:call)

The provider implementation.

option :models Symbol | Interface(:each, :find) | Nil

The model source or :discover.

Implementation

def provider(name, instance, models: nil)
	@configuration.provider(name, instance, models: models)
end

def model(name, provider:, display_name: nil, limits: nil)

Configure a model route on the attached configuration.

Signature

parameter name String | Symbol

The model ID.

parameter provider String | Symbol

The provider name.

option :display_name String | Nil

A human-readable model name.

option :limits Hash | Nil

Positive context, input, and output token limits.

Implementation

def model(name, provider:, display_name: nil, limits: nil)
	@configuration.model(name, provider: provider, display_name: display_name, limits: limits)
end

def default_provider(name)

Set the default provider on the attached configuration.

Signature

parameter name String | Symbol

The provider name.

Implementation

def default_provider(name)
	@configuration.default_provider = name
end