exe/jumon in jumon-0.1.1 vs exe/jumon in jumon-0.1.2
- old
+ new
@@ -1,15 +1,27 @@
+#!/usr/bin/env ruby
# frozen_string_literal: true
-# !/usr/bin/env ruby
-
require 'openai'
require 'jumon'
require 'cli/ui'
-yaml = YAML.load_file(ARGV[0], symbolize_names: true)
+prompts_path = ARGV[0]
+case prompts_path
+when nil, "-h", "--help"
+ $stderr.puts "USAGE: jumon <path>"
+ exit 1
+end
+
+unless File.exist?(prompts_path)
+ $stderr.puts "ERROR: file #{prompts_path} does not exist!"
+ exit 1
+end
+
+yaml = YAML.load_file(prompts_path, symbolize_names: true)
+
prompt = Jumon::Prompt.new(yaml)
config = Jumon::Configuration.new(yaml)
system_subject = Jumon::Subject.new(prompt.system)
system_subject.set_subjects
@@ -52,6 +64,6 @@
assistant: res['choices'] ? res['choices'][0]['message']['content'] : 'ERROR'
}
end
end
-puts results.to_yaml
\ No newline at end of file
+puts results.to_yaml