Class: Ace::Support::Models::CLI::Commands::ModelsSubcommands::Info

Inherits:
Cli::Command
  • Object
show all
Includes:
Cli::Base
Defined in:
lib/ace/support/models/cli/commands/models/info.rb

Overview

Show model information

Instance Method Summary collapse

Instance Method Details

#call(model_id:, **options) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/ace/support/models/cli/commands/models/info.rb', line 27

def call(model_id:, **options)
  model = Molecules::ModelValidator.new.validate(model_id)

  if options[:json]
    puts JSON.pretty_generate(model.to_h)
  elsif options[:full]
    puts format_model_info_full(model)
  else
    puts format_model_info_brief(model)
  end
rescue ProviderNotFoundError => e
  raise Ace::Support::Cli::Error.new("Model '#{e.model_id || model_id}' not found in provider '#{e.provider_id}'")
rescue ModelNotFoundError => e
  raise Ace::Support::Cli::Error.new(e.message)
rescue CacheError => e
  raise Ace::Support::Cli::Error.new(e.message)
end