OpenAI Model Registry for managing model-specific configurations and capabilities.
This module provides infrastructure for categorizing OpenAI models and managing their specific parameter requirements and capabilities.
Model Types
:reasoning- Models like o1, o3 that use max_completion_tokens:chat- Standard chat models that use max_tokens:embedding- Text embedding models:moderation- Content moderation models
Examples
iex> registry = OpenAIModelRegistry.new()
iex> OpenAIModelRegistry.is_reasoning_model?(registry, "o1")
true
iex> OpenAIModelRegistry.is_reasoning_model?(registry, "gpt-4")
false
Summary
Functions
Gets the capabilities for a specific model.
Gets a list of all explicitly registered models.
Gets the correct parameter name for token limits based on model type.
Creates a new model registry with default models.
Checks if a model is a reasoning model.
Registers a new model with its capabilities.
Registers a pattern for inferring model types.
Checks if a model supports a specific temperature value.
Types
@type model_capabilities() :: %{ model_type: model_type(), supports_tools: boolean(), supports_streaming: boolean(), supports_vision: boolean(), max_context_tokens: non_neg_integer() | nil, max_output_tokens: non_neg_integer() | nil, supported_temperatures: [float()] | nil, supports_chat_api: boolean(), supports_completions_api: boolean(), supports_responses_api: boolean() }
@type model_type() :: :reasoning | :chat | :embedding | :moderation
@type t() :: %Mojentic.LLM.Gateways.OpenAIModelRegistry{ models: %{required(String.t()) => model_capabilities()}, pattern_mappings: %{required(String.t()) => model_type()} }
Functions
@spec get_model_capabilities(t(), String.t()) :: model_capabilities()
Gets the capabilities for a specific model.
Falls back to pattern matching for unknown models, and defaults to chat model capabilities if no match is found.
Gets a list of all explicitly registered models.
Gets the correct parameter name for token limits based on model type.
@spec new() :: t()
Creates a new model registry with default models.
Checks if a model is a reasoning model.
@spec register_model(t(), String.t(), model_capabilities()) :: t()
Registers a new model with its capabilities.
@spec register_pattern(t(), String.t(), model_type()) :: t()
Registers a pattern for inferring model types.
Checks if a model supports a specific temperature value.