Class: LanguageOperator::CLI::Wizards::ModelWizard

Inherits:
Object
  • Object
show all
Includes:
Helpers::ProviderHelper, Helpers::UxHelper, Helpers::ValidationHelper
Defined in:
lib/language_operator/cli/wizards/model_wizard.rb

Overview

Interactive wizard for creating language models

Guides users through provider selection, credential input, model selection, and resource creation.

Examples:

wizard = Wizards::ModelWizard.new(ctx)
wizard.run

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers::ProviderHelper

#fetch_provider_models, #test_provider_connection

Methods included from Helpers::ValidationHelper

#ask_k8s_name, #ask_secret, #ask_select, #ask_url, #ask_yes_no

Methods included from Helpers::UxHelper

#box, #highlight_ruby_code, #logo, #pastel, #prompt, #spinner, #table

Constructor Details

#initialize(ctx) ⇒ ModelWizard

Returns a new instance of ModelWizard.



28
29
30
# File 'lib/language_operator/cli/wizards/model_wizard.rb', line 28

def initialize(ctx)
  @ctx = ctx
end

Instance Attribute Details

#ctxObject (readonly)

Returns the value of attribute ctx.



26
27
28
# File 'lib/language_operator/cli/wizards/model_wizard.rb', line 26

def ctx
  @ctx
end

Instance Method Details

#runBoolean

Run the wizard and create the model

Returns:

  • (Boolean)

    true if model was created successfully



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/language_operator/cli/wizards/model_wizard.rb', line 35

def run
  show_welcome

  # Step 1: Provider selection
  provider_info = select_provider
  return false unless provider_info

  # Step 2: Get credentials
  credentials = get_credentials(provider_info)
  return false unless credentials

  # Step 3: Test connection
  test_result = test_connection(provider_info, credentials)
  return false unless test_result[:success]

  # Step 4: Select model
  model_id = select_model(provider_info, credentials)
  return false unless model_id

  # Step 5: Get display name
  model_name = get_model_name(model_id)
  return false unless model_name

  # Create resources
  success = create_model_resource(model_name, provider_info, credentials, model_id)
  return false unless success

  # Show success
  show_success(model_name, model_id, provider_info)

  true
end