ReqLLM.Model.Metadata (ReqLLM v1.0.0-rc.5)
View SourceHandles loading metadata from JSON files for AI models.
This module is responsible for loading model metadata from provider files
in the priv/models_dev directory. For metadata processing and validation,
see ReqLLM.Metadata
.
Summary
Functions
Exposes model metadata for a provider and model from the registry.
Loads full metadata from JSON files for enhanced model creation.
Functions
Exposes model metadata for a provider and model from the registry.
This is the canonical way to access model metadata, delegating to the provider registry's internal metadata storage.
Parameters
provider_id
- Provider atom identifier (e.g.,:anthropic
)model_name
- Model name string (e.g.,"claude-3-sonnet"
)
Returns
{:ok, metadata_map}
if found, {:error, reason}
otherwise.
Examples
{:ok, metadata} = ReqLLM.Model.Metadata.get_model_metadata(:anthropic, "claude-3-sonnet")
metadata["cost"]
#=> %{"input" => 3.0, "output" => 15.0}
Loads full metadata from JSON files for enhanced model creation.
Attempts to load complete model metadata from provider files in the priv/models_dev directory for the given model specification.
Parameters
model_spec
- Model specification string in "provider:model" format
Returns
{:ok, metadata_map}
if metadata is found and valid, {:error, reason}
otherwise.
Examples
{:ok, metadata} = ReqLLM.Model.Metadata.load_full_metadata("anthropic:claude-3-sonnet")
metadata["cost"]
#=> %{"input" => 3.0, "output" => 15.0}