Current section

Files

Jump to
llm_db lib llm_db generated valid_modalities.ex
Raw

lib/llm_db/generated/valid_modalities.ex

defmodule LLMDB.Generated.ValidModalities do
@moduledoc """
Auto-generated module containing all valid modality atoms.
This module is generated to prevent atom leaking by ensuring all modality
atoms exist at compile time before String.to_existing_atom/1 is used.
DO NOT EDIT THIS FILE MANUALLY - it will be overwritten.
"""
@modalities [
:text,
:image,
:audio,
:video,
:code,
:document,
:embedding,
:embeddings,
:file,
:rerank,
:speech,
:transcription,
:pdf
]
@modalities_by_name Map.new(@modalities, &{Atom.to_string(&1), &1})
@doc """
Returns the list of all valid modality atoms.
"""
@spec list() :: [atom()]
def list, do: @modalities
@doc """
Checks if the given atom is a valid modality.
"""
@spec member?(atom()) :: boolean()
def member?(atom), do: atom in @modalities
@doc false
@spec fetch(String.t() | atom()) :: {:ok, atom()} | :error
def fetch(modality) when is_atom(modality) do
if member?(modality), do: {:ok, modality}, else: :error
end
def fetch(modality) when is_binary(modality) do
Map.fetch(@modalities_by_name, modality)
end
end