Class: Foobara::Ai::AnswerBot::DomainMappers::ServiceToListModelsCommand

Inherits:
DomainMapper
  • Object
show all
Defined in:
foobara-ai-1.0.4/src/foobara/ai/answer_bot/domain_mappers/service_to_list_models_command.rb

Constant Summary

Constants included from TruncatedInspect

TruncatedInspect::MAX_LENGTH

Instance Method Summary collapse

Methods inherited from DomainMapper

applicable?, applicable_score, #execute, foobara_on_register, from, #from, from_type, install!, map, map!, matches?, to, to_type

Methods included from TruncatedInspect

#inspect, truncating

Methods included from Concern

foobara_class_methods_module_for, foobara_concern?, included

Instance Method Details

#mapObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'src/foobara/ai/answer_bot/domain_mappers/service_to_list_models_command.rb', line 10

def map
  case service
  when Types::ServiceEnum::OPEN_AI
    Ai::OpenAiApi::ListModels
  when Types::ServiceEnum::ANTHROPIC
    Ai::AnthropicApi::ListModels
  when Types::ServiceEnum::OLLAMA
    Ai::OllamaApi::ListLocalModels
  else
    # :nocov:
    raise "Unknown service: #{service}"
    # :nocov:
  end
end