Parse files in the gettext root folder
Summary
Functions
Returns the provider the dashboard should preselect in the LLM override form, along with the instance settings that back it.
The provider slugs the dashboard override form offers, which are also the only
accepted values of :default_provider.
Returns a summary of the configured LLM provider for display in the dashboard.
Human-readable label for a provider slug, or nil if it is not a known one.
Turns the dashboard override form's params into the provider override map the translation chain consumes.
Functions
@spec instance_default() :: %{ provider: String.t() | nil, model: String.t() | nil, adapter: module() | nil, endpoint_config: map() }
Returns the provider the dashboard should preselect in the LLM override form, along with the instance settings that back it.
An instance that already configures a provider — a self-hosted vLLM gateway
whose endpoint and API key come from the release's own environment, say —
should not make an operator retype those into a dashboard form. Set
:default_provider and the override form opens with that adapter selected and
the configured model filled in, and treats blank credential fields as "use
whatever the instance is already configured with":
config :gettext_translator, GettextTranslator,
endpoint: MyApp.LLM.ChatVLLM,
endpoint_model: System.get_env("GETTEXT_TRANSLATOR_MODEL", "gemma-4-26b-a4b-it"),
default_provider: :vllmThe value may be an atom or a string naming one of the adapters the form offers
(:openai, :anthropic, :ollama, :google_ai, :vllm).
:provider is nil when :default_provider is unset, which leaves the
override form behaving exactly as it did before this option existed.
@spec known_providers() :: [String.t()]
The provider slugs the dashboard override form offers, which are also the only
accepted values of :default_provider.
@spec provider_info() :: %{configured: boolean(), adapter_name: String.t(), model: String.t()} | %{configured: false}
Returns a summary of the configured LLM provider for display in the dashboard.
Returns %{configured: true, adapter_name: "ChatOpenAI", model: "gpt-4"} when
configured, or %{configured: false} otherwise.
Human-readable label for a provider slug, or nil if it is not a known one.
"google_ai" is not what anyone wants to read in a form label.
@spec resolve_override(map(), map()) :: %{ adapter: module(), adapter_name: String.t(), model: String.t(), config: map() }
Turns the dashboard override form's params into the provider override map the translation chain consumes.
Lives here rather than in the page because it is provider/config resolution rather than view logic, and because the two decisions it makes are worth testing directly:
Which adapter module. Choosing the provider the instance is configured for uses that instance's own
:endpointmodule, not the generic LangChain one. For a self-hosted gateway that is the whole point: a module likeMyApp.LLM.ChatVLLMresolves its endpoint and bearer token from the release environment, whereChatOpenAIwould need the full completions URL typed into the form.Which credentials. Blank fields inherit the instance's
:endpoint_config, but only when the submitted adapter is the configured one — picking a different provider must not send it another provider's key. Anything actually typed always wins.