ExLLM.ModelCapabilities (ex_llm v0.5.0)

View Source

Model capability discovery and management for ExLLM.

This module provides information about what features and capabilities each model supports across different providers. It helps users make informed decisions about which model to use for their specific needs.

Features

  • Automatic capability detection
  • Provider-specific feature mapping
  • Capability comparison across models
  • Feature availability checking
  • Model recommendation based on requirements

Usage

# Get capabilities for a specific model
{:ok, caps} = ExLLM.ModelCapabilities.get_capabilities(:openai, "gpt-4-turbo")

# Check if a model supports a specific feature
ExLLM.ModelCapabilities.supports?(:anthropic, "claude-3-opus-20240229", :vision)

# Find models that support specific features
models = ExLLM.ModelCapabilities.find_models_with_features([:function_calling, :streaming])

# Compare models
comparison = ExLLM.ModelCapabilities.compare_models([
  {:openai, "gpt-4"},
  {:anthropic, "claude-3-sonnet-20240229"}
])

Summary

Functions

Compare capabilities across multiple models.

Find all models that support specific features.

Get complete capability information for a model.

Get detailed information about a specific capability.

Get model information for a specific provider and model.

Get all available features.

Get models grouped by capability.

Get recommended models based on requirements.

Check if a model supports a specific feature.

Functions

compare_models(model_specs)

@spec compare_models([{atom(), String.t()}]) :: map()

Compare capabilities across multiple models.

find_models_with_features(required_features)

@spec find_models_with_features([atom()]) :: [{atom(), String.t()}]

Find all models that support specific features.

This function searches both the hardcoded model database and dynamically loads models from YAML configuration files to provide comprehensive results.

get_capabilities(provider, model_id)

@spec get_capabilities(atom(), String.t()) ::
  {:ok, ExLLM.ModelCapabilities.ModelInfo.t()} | {:error, :not_found}

Get complete capability information for a model.

get_capability_details(provider, model_id, feature)

@spec get_capability_details(atom(), String.t(), atom()) ::
  {:ok, ExLLM.ModelCapabilities.Capability.t()}
  | {:error, :not_found | :not_supported}

Get detailed information about a specific capability.

get_model_info(provider, model)

@spec get_model_info(atom(), String.t()) ::
  {:ok, ExLLM.ModelCapabilities.ModelInfo.t()} | {:error, :not_found}

Get model information for a specific provider and model.

Parameters

  • provider - Provider atom (e.g., :openai, :anthropic)
  • model - Model identifier

Returns

  • {:ok, model_info} on success
  • {:error, :not_found} if model not found

Examples

{:ok, info} = ExLLM.ModelCapabilities.get_model_info(:openai, "gpt-4o")

list_features()

@spec list_features() :: [atom()]

Get all available features.

models_by_capability(feature)

@spec models_by_capability(atom()) :: map()

Get models grouped by capability.

This function searches both the hardcoded model database and dynamically loads models from YAML configuration files to provide comprehensive results.

recommend_models(requirements)

@spec recommend_models(keyword()) :: [{atom(), String.t(), map()}]

Get recommended models based on requirements.

supports?(provider, model_id, feature)

@spec supports?(atom(), String.t(), atom()) :: boolean()

Check if a model supports a specific feature.