module Memo::Providers::Registry

Overview

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
)

Defined in:

memo/providers/registry.cr

Class Method Summary

Class Method Detail

def self.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.


[View source]