Class: LangchainrbRails::Generators::PromptGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- LangchainrbRails::Generators::PromptGenerator
- Includes:
- ActiveRecord::Generators::Migration
- Defined in:
- lib/langchainrb_rails/generators/langchainrb_rails/prompt_generator.rb
Overview
Adds prompt templating capabilities to your ActiveRecord model
Usage:
rails generate langchainrb_rails:prompt
Instance Method Summary collapse
Instance Method Details
#copy_migration ⇒ Object
22 23 24 |
# File 'lib/langchainrb_rails/generators/langchainrb_rails/prompt_generator.rb', line 22 def copy_migration migration_template "create_prompts.rb", "db/migrate/create_prompts.rb", migration_version: migration_version end |
#create_model_file ⇒ Object
18 19 20 |
# File 'lib/langchainrb_rails/generators/langchainrb_rails/prompt_generator.rb', line 18 def create_model_file template "prompt_model.rb", "app/models/prompt.rb" end |
#migration_version ⇒ Object
26 27 28 |
# File 'lib/langchainrb_rails/generators/langchainrb_rails/prompt_generator.rb', line 26 def migration_version "[#{::ActiveRecord::VERSION::MAJOR}.#{::ActiveRecord::VERSION::MINOR}]" end |