Jido.AI.Provider.Helpers (Jido AI v0.5.2)
View SourceCommon helper functions for AI provider adapters.
This module centralizes functionality that would otherwise be duplicated across provider implementations, such as:
- File path management for model caching
- Reading from and writing to cache
- Making API requests with proper authentication
- Model name standardization across providers
Summary
Functions
Caches a single model to a file.
Extracts a model from different response formats.
Extracts models from different response formats.
Fetches models from the API and caches them.
Fetches a specific model from the API and caches it.
Fetches a model from the cache.
Gets an API key from options or environment.
Gets the path to a specific model file for a provider.
Gets the path to the models file for a provider.
Merges model information from multiple providers.
Reads models from the cache file.
Standardizes a model name across providers by removing version numbers and dates. This helps match equivalent models from different providers.
Functions
Caches a single model to a file.
Extracts a model from different response formats.
Extracts models from different response formats.
Fetches models from the API and caches them.
Fetches a specific model from the API and caches it.
Fetches a model from the cache.
Gets an API key from options or environment.
Gets the path to a specific model file for a provider.
Gets the path to the models file for a provider.
Merges model information from multiple providers.
Parameters
- models: List of model maps from different providers
Returns
- A merged model map with combined information
Reads models from the cache file.
Standardizes a model name across providers by removing version numbers and dates. This helps match equivalent models from different providers.
Examples
iex> standardize_name("claude-3.7-sonnet-20250219")
"claude-3.7-sonnet"
iex> standardize_name("gpt-4-0613")
"gpt-4"