View Source LumaaiEx.Config (lumaai_ex v0.1.0)

Configuration for the LumaaiEx client.

This module defines the configuration structure used by the LumaaiEx client and provides functions to create a new configuration.

Summary

Functions

Creates a new LumaaiEx configuration.

Types

@type t() :: %LumaaiEx.Config{auth_token: String.t(), base_url: String.t()}

Functions

@spec new(keyword()) :: t()

Creates a new LumaaiEx configuration.

This function will attempt to retrieve the auth token in the following order:

  1. From the provided auth_token option
  2. From the LUMAAI_API_KEY environment variable
  3. If neither is available, it will raise an error

Parameters

  • opts: Options for configuration (default: []).
    • :auth_token - Explicitly provide an auth token
    • :base_url - Override the default base URL

Returns

A LumaaiEx.Config struct.

Examples

iex> LumaaiEx.Config.new(auth_token: "your_api_key")
%LumaaiEx.Config{auth_token: "your_api_key", base_url: "https://api.lumalabs.ai"}

iex> System.put_env("LUMAAI_API_KEY", "env_api_key")
iex> LumaaiEx.Config.new()
%LumaaiEx.Config{auth_token: "env_api_key", base_url: "https://api.lumalabs.ai"}

iex> LumaaiEx.Config.new(base_url: "https://custom-api.example.com")
%LumaaiEx.Config{auth_token: "env_api_key", base_url: "https://custom-api.example.com"}