Class: LangchainrbRails::Generators::AssistantGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- LangchainrbRails::Generators::AssistantGenerator
- Includes:
- ActiveRecord::Generators::Migration
- Defined in:
- lib/langchainrb_rails/generators/langchainrb_rails/assistant_generator.rb
Overview
Usage:
rails generate langchainrb_rails:assistant --llm=openai
Constant Summary collapse
- LLMS =
TODO: Move constant this to a shared place
{ "anthropic" => "Langchain::LLM::Anthropic", "cohere" => "Langchain::LLM::Cohere", "google_palm" => "Langchain::LLM::GooglePalm", "google_gemini" => "Langchain::LLM::GoogleGemini", "google_vertex_ai" => "Langchain::LLM::GoogleVertexAI", "hugging_face" => "Langchain::LLM::HuggingFace", "llama_cpp" => "Langchain::LLM::LlamaCpp", "mistral_ai" => "Langchain::LLM::MistralAI", "ollama" => "Langchain::LLM::Ollama", "openai" => "Langchain::LLM::OpenAI", "replicate" => "Langchain::LLM::Replicate" }.freeze
Instance Method Summary collapse
Instance Method Details
#copy_migration ⇒ Object
40 41 42 43 |
# File 'lib/langchainrb_rails/generators/langchainrb_rails/assistant_generator.rb', line 40 def copy_migration migration_template "assistant/migrations/create_assistants.rb", "db/migrate/create_assistants.rb", migration_version: migration_version migration_template "assistant/migrations/create_messages.rb", "db/migrate/create_messages.rb", migration_version: migration_version end |
#create_model_file ⇒ Object
45 46 47 48 |
# File 'lib/langchainrb_rails/generators/langchainrb_rails/assistant_generator.rb', line 45 def create_model_file template "assistant/models/assistant.rb", "app/models/assistant.rb" template "assistant/models/message.rb", "app/models/message.rb" end |
#migration_version ⇒ Object
50 51 52 |
# File 'lib/langchainrb_rails/generators/langchainrb_rails/assistant_generator.rb', line 50 def migration_version "[#{::ActiveRecord::VERSION::MAJOR}.#{::ActiveRecord::VERSION::MINOR}]" end |