module

Memo::Providers::Registry

Provider factory

Creates provider instances from format names. Formats represent API protocols (e.g., "openai" format works with OpenAI, Azure OpenAI, and any OpenAI-compatible API).

Usage

provider = Memo::Providers::Registry.create(
  format: "openai",
  api_key: "sk-...",
  model: "text-embedding-3-small",
  base_url: "https://custom.api.com/v1"  # optional
)

Class methods

create(format : String, api_key : String | Nil = nil, model : String = "", base_url : String | Nil = nil) : Providers::Base | Nil

Create a provider instance

Returns nil if format is not supported.

Source