Class: RubyLLM::Evals::PromptsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- RubyLLM::Evals::PromptsController
- Defined in:
- app/controllers/ruby_llm/evals/prompts_controller.rb
Instance Method Summary collapse
- #compare ⇒ Object
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#compare ⇒ Object
46 47 48 49 |
# File 'app/controllers/ruby_llm/evals/prompts_controller.rb', line 46 def compare @runs = @prompt.runs.includes(prompt_executions: :sample).order(created_at: :asc) @samples = @prompt.samples.order(id: :asc) end |
#create ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'app/controllers/ruby_llm/evals/prompts_controller.rb', line 23 def create @prompt = Prompt.new(prompt_params) if @prompt.save redirect_to @prompt, notice: "Prompt was successfully created." else render :new, status: :unprocessable_entity end end |
#destroy ⇒ Object
41 42 43 44 |
# File 'app/controllers/ruby_llm/evals/prompts_controller.rb', line 41 def destroy @prompt.destroy! redirect_to prompts_path, notice: "Prompt was successfully destroyed.", status: :see_other end |
#edit ⇒ Object
20 21 |
# File 'app/controllers/ruby_llm/evals/prompts_controller.rb', line 20 def edit end |
#index ⇒ Object
7 8 9 10 11 |
# File 'app/controllers/ruby_llm/evals/prompts_controller.rb', line 7 def index prompts = Prompt.all prompts = prompts.where("name LIKE ?", "%#{Prompt.sanitize_sql_like(@filters[:name])}%") if @filters[:name].present? @prompts = Page.new prompts, page: params[:page].to_i end |
#new ⇒ Object
16 17 18 |
# File 'app/controllers/ruby_llm/evals/prompts_controller.rb', line 16 def new @prompt = Prompt.new end |
#show ⇒ Object
13 14 |
# File 'app/controllers/ruby_llm/evals/prompts_controller.rb', line 13 def show end |
#update ⇒ Object
33 34 35 36 37 38 39 |
# File 'app/controllers/ruby_llm/evals/prompts_controller.rb', line 33 def update if @prompt.update(prompt_params) redirect_to @prompt, notice: "Prompt was successfully updated.", status: :see_other else render :edit, status: :unprocessable_entity end end |