Class: LangsmithrbRails::Generators::CiGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/langsmithrb_rails/ci/ci_generator.rb

Overview

Generator for adding CI integration for LangSmith evaluations

Instance Method Summary collapse

Instance Method Details

#create_ci_scriptObject



16
17
18
19
20
# File 'lib/generators/langsmithrb_rails/ci/ci_generator.rb', line 16

def create_ci_script
  empty_directory "script/ci"
  template "langsmith_export_summary.rb", "script/ci/langsmith_export_summary.rb"
  chmod "script/ci/langsmith_export_summary.rb", 0755
end

#create_github_workflowObject



11
12
13
14
# File 'lib/generators/langsmithrb_rails/ci/ci_generator.rb', line 11

def create_github_workflow
  empty_directory ".github/workflows"
  template "langsmith-evals.yml", ".github/workflows/langsmith-evals.yml"
end

#display_post_install_messageObject



22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/generators/langsmithrb_rails/ci/ci_generator.rb', line 22

def display_post_install_message
  say "\n"
  say "LangSmith CI integration has been added to your Rails application! 🎉", :green
  say "\n"
  say "This adds:", :yellow
  say "  1. GitHub Actions workflow for running evaluations", :yellow
  say "  2. Script for generating evaluation summaries for PR comments", :yellow
  say "\n"
  say "To customize the CI configuration:", :yellow
  say "  1. Edit .github/workflows/langsmith-evals.yml", :yellow
  say "  2. Configure the evaluation dataset and target in the workflow", :yellow
  say "\n"
end