Class: Protege::Generators::ProviderGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Includes:
ExtensionNaming
Defined in:
lib/generators/protege/provider/provider_generator.rb

Overview

Scaffolds an inference provider — the adapter between Protege and an LLM backend — into the host app's providers directory (+config.providers_path+, default app/providers). A provider subclasses Protege::Provider, declares its protege_id, and implements generate (hash in, hash out). It is auto-discovered; activate it by pointing config.provider_id at its id and putting its credentials under that key in config.providers.

The Provider suffix is applied for you, and the protege_id is derived from the name.

Examples:

bin/rails g protege:provider my_llm

Instance Method Summary collapse

Instance Method Details

#create_providervoid

This method returns an undefined value.

Render the provider scaffold into config.providers_path.



28
29
30
31
# File 'lib/generators/protege/provider/provider_generator.rb', line 28

def create_provider
  template 'provider.rb.tt',
           File.join(Protege.configuration.providers_path, "#{extension_file_name('Provider')}.rb")
end