Class: OllamaAgent::RuntimeCommandSystem::Completers::ProviderCompleter

Inherits:
BaseCompleter
  • Object
show all
Defined in:
lib/ollama_agent/runtime_command_system/completers.rb

Instance Method Summary collapse

Instance Method Details

#suggestions(ast:) ⇒ Object



69
70
71
72
73
74
75
76
77
78
79
# File 'lib/ollama_agent/runtime_command_system/completers.rb', line 69

def suggestions(ast:, **)
  token = ast.current_argument&.value.to_s.downcase
  Providers::Registry.known_names.sort.grep(/#{Regexp.escape(token)}/).map do |provider|
    Suggestion.new(
      text: provider,
      type: :provider,
      description: "provider",
      replacement_start: ast.current_argument&.position || ast.raw.length
    )
  end
end