module Application

Includes
Async::Service::Managed::Environment

Default Async::Service environment for the Laiya HTTP API.

Definitions

def service_class

Return the service implementation class.

Signature

returns Class

The Laiya service class.

Implementation

def service_class
	Laiya::Service::Application
end

def endpoint

Parse the HTTP bind endpoint from the environment.

Signature

returns Async::HTTP::Endpoint

The configured endpoint.

Implementation

def endpoint
	Async::HTTP::Endpoint.parse(ENV.fetch("LAIYA_URL", "http://localhost:9292"))
end

def count

Run one Laiya service instance.

Signature

returns Integer

The desired service count.

Implementation

def count
	1
end

def configuration

Build the default OpenAI-backed configuration.

Signature

returns Laiya::Configuration

The service configuration.

Implementation

def configuration
	Laiya::Configuration.build do |builder|
		builder.provider :openai, Laiya::Provider::OpenAI.new
		builder.default_provider :openai
	end
end

def application

Build the HTTP application for this environment.

Signature

returns Laiya::Web::Application

The configured API application.

Implementation

def application
	Laiya::Web::Application.new(configuration: self.configuration)
end