Class: TinyPair
- Inherits:
-
Object
- Object
- TinyPair
- Defined in:
- lib/tiny_pair.rb
Overview
Constant Summary collapse
- MODEL_INSTRUCTIONS =
<<~INSTR You will be given some minitest tests in Ruby, and I want you to return the matching Ruby implementation. You should use the latest version of Ruby you know of, and try to keep the output code to an 80-column width Do not explain the code or any surrounding documentation: only provide the implementation code in plaintext and nothing else. INSTR
- TESTS =
<<~TEST_TEXT class TestCalc < Minitest::Test def test_add_two_and_two assert_equal 4, Calc.add(2, 2) end def test_add_two_and_seven assert_equal 9, Calc.add(2, 7) end def test_multi_three_and_five assert_equal 15, Calc.multi(3, 5) end def test_multi_six_and_nineteen assert_equal 114, Calc.multi(6, 19) end end TEST_TEXT
Instance Method Summary collapse
-
#implement(tests:) ⇒ Object
tests: the raw text of a series of minitest tests.
-
#initialize(instructions: MODEL_INSTRUCTIONS) ⇒ TinyPair
constructor
A new instance of TinyPair.
Constructor Details
#initialize(instructions: MODEL_INSTRUCTIONS) ⇒ TinyPair
Returns a new instance of TinyPair.
40 41 42 43 44 45 46 |
# File 'lib/tiny_pair.rb', line 40 def initialize(instructions: MODEL_INSTRUCTIONS) @client = TinyGemini.new( model: 'gemini-1.5-flash', system_instruction: MODEL_INSTRUCTIONS, api_key: ENV['GEMINI_KEY'] ) end |
Instance Method Details
#implement(tests:) ⇒ Object
tests: the raw text of a series of minitest tests
49 50 51 52 53 54 |
# File 'lib/tiny_pair.rb', line 49 def implement(tests:) @client.prompt({ parts: { text: tests }, role: 'user' }) end |