boxcars 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0d131a1f5eb1cb3c6f3cece9c2fcf3246ea81376386b4e7ea23a0d14ee739301
4
- data.tar.gz: 2d0295a8b37da8ab8b7320d9b01c763cd333c5b8f2f20dfe452a54101cd3fd38
3
+ metadata.gz: be9e433c7ff2af560cafdf85c2c3dd050e7778554320568a7c994d9d3a083299
4
+ data.tar.gz: 2dd0d494cb025151a56b33d2abf221aa78533000d6c2c80792b3ecaedb693024
5
5
  SHA512:
6
- metadata.gz: 62ee3e7bf7bf6ba12d07db731195427dd726cc1ecd97ae88998a642d78c48b9e0cfc6c317676f9b37b1007496da6565dba021d513ec26528349c00b41dd0c854
7
- data.tar.gz: 7dd1ae996ad38c616aa62f69c126a5101e4723bbacec3a25e06cf245a9792cc72edc7806d629163fea7f78d61269125ad6f136da47895bca485f928c198a21ef
6
+ metadata.gz: c2a764c28ab47080da75c9a32ca5b8b2322be1b550f1f86a58d880f83071576d5ab05ecf5e0859e5b7c7b2a75826e24f853a0bb1ae23305ada6cda482955b019
7
+ data.tar.gz: de8c1544565ac57639558d0d3c4b94f59da52dcfddb9a12a4372025cae81078a2e4209e90bca586afac69f24d60240a00c4bc6d565ddfcf2ab1b334e5457fdc2
data/CHANGELOG.md CHANGED
@@ -1,5 +1,37 @@
1
1
  # Changelog
2
2
 
3
+ ## [v0.4.0](https://github.com/BoxcarsAI/boxcars/tree/v0.4.0) (2023-07-19)
4
+
5
+ [Full Changelog](https://github.com/BoxcarsAI/boxcars/compare/v0.3.5...v0.4.0)
6
+
7
+ **Closed issues:**
8
+
9
+ - Add Anthropic Engine [\#103](https://github.com/BoxcarsAI/boxcars/issues/103)
10
+
11
+ **Merged pull requests:**
12
+
13
+ - Add Anthropic Engine - closes \#103 [\#104](https://github.com/BoxcarsAI/boxcars/pull/104) ([francis](https://github.com/francis))
14
+
15
+ ## [v0.3.5](https://github.com/BoxcarsAI/boxcars/tree/v0.3.5) (2023-07-13)
16
+
17
+ [Full Changelog](https://github.com/BoxcarsAI/boxcars/compare/v0.3.4...v0.3.5)
18
+
19
+ ## [v0.3.4](https://github.com/BoxcarsAI/boxcars/tree/v0.3.4) (2023-07-11)
20
+
21
+ [Full Changelog](https://github.com/BoxcarsAI/boxcars/compare/v0.3.3...v0.3.4)
22
+
23
+ ## [v0.3.3](https://github.com/BoxcarsAI/boxcars/tree/v0.3.3) (2023-07-10)
24
+
25
+ [Full Changelog](https://github.com/BoxcarsAI/boxcars/compare/v0.3.2...v0.3.3)
26
+
27
+ ## [v0.3.2](https://github.com/BoxcarsAI/boxcars/tree/v0.3.2) (2023-07-10)
28
+
29
+ [Full Changelog](https://github.com/BoxcarsAI/boxcars/compare/v0.3.1...v0.3.2)
30
+
31
+ **Merged pull requests:**
32
+
33
+ - add XML Train and XML Zero Shot [\#102](https://github.com/BoxcarsAI/boxcars/pull/102) ([francis](https://github.com/francis))
34
+
3
35
  ## [v0.3.1](https://github.com/BoxcarsAI/boxcars/tree/v0.3.1) (2023-07-01)
4
36
 
5
37
  [Full Changelog](https://github.com/BoxcarsAI/boxcars/compare/v0.2.16...v0.3.1)
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- boxcars (0.4.0)
4
+ boxcars (0.4.1)
5
5
  anthropic (~> 0.1)
6
6
  google_search_results (~> 2.2)
7
7
  gpt4all (~> 0.0.4)
@@ -9,9 +9,9 @@ module Boxcars
9
9
 
10
10
  # The default parameters to use when asking the engine.
11
11
  DEFAULT_PARAMS = {
12
- model: "gpt-3.5-turbo",
12
+ model: "gpt-3.5-turbo-16k",
13
13
  temperature: 0.2,
14
- max_tokens: 512
14
+ max_tokens: 2048
15
15
  }.freeze
16
16
 
17
17
  # the default name of the engine
@@ -44,7 +44,7 @@ module Boxcars
44
44
  end
45
45
 
46
46
  def conversation_model?(model)
47
- ["gpt-3.5-turbo", "gpt-4"].include?(model)
47
+ ["gpt-3.5-turbo", "gpt-4", "gpt-3.5-turbo-16k"].include?(model)
48
48
  end
49
49
 
50
50
  # Get an answer from the engine.
@@ -16,7 +16,7 @@ module Boxcars
16
16
  # @param prompt [Boxcars::Prompt] The prompt to use. Defaults to the built-in prompt.
17
17
  # @param kwargs [Hash] Additional arguments to pass to the train. wants_next_actions: true
18
18
  def initialize(boxcars:, engine: nil, name: 'Zero Shot XML', description: 'Zero Shot Train wiht XML', prompt: nil, **kwargs)
19
- @engine_prefix = '<thought>'
19
+ @engine_prefix = ''
20
20
  @wants_next_actions = kwargs.fetch(:wants_next_actions, false)
21
21
  prompt ||= my_prompt
22
22
  super(engine: engine, boxcars: boxcars, prompt: prompt, name: name, description: description, **kwargs)
@@ -33,18 +33,18 @@ module Boxcars
33
33
  " <action>the action to take, from this action list above</action>\n",
34
34
  " <action_input>input to the action</action_input>\n",
35
35
  " <observation>the result of the action</observation>\n",
36
- " ... (this Thought/Action/Action Input/Observation sequence can repeat N times)\n",
36
+ " ... (this thought/action/action_input/observation sequence repeats until you know the final answer) ...\n",
37
37
  " <thought>I know the final answer</thought>\n",
38
38
  " <final_answer>the final answer to the original input question</final_answer>\n",
39
39
  "-- FORMAT END -\n",
40
40
  "Your answer should always have begin and end tags for each element.\n",
41
- "Also make sure to specify a question for the action_input.\n",
42
- "Finally, if you can deduct the answer from the question or observation, you can ",
41
+ "Also make sure to specify arguments for the action_input.\n",
42
+ "Finally, if you can deduct the answer from the question or observations, you can ",
43
43
  "jump to final_answer and give me the answer.\n",
44
44
  "</training>"),
45
45
  hist, # insert thoughts here from previous runs
46
46
  user("<question>%<input>s</question>"),
47
- assi("<thought>%<agent_scratchpad>s")
47
+ assi("%<agent_scratchpad>s")
48
48
  ].freeze
49
49
 
50
50
  # The prompt to use for the train.
data/lib/boxcars/train.rb CHANGED
@@ -45,7 +45,7 @@ module Boxcars
45
45
  # @param intermediate_steps [Array] The intermediate steps to build the scratchpad from.
46
46
  # @return [String] The scratchpad.
47
47
  def construct_scratchpad(intermediate_steps)
48
- thoughts = ""
48
+ thoughts = engine_prefix.to_s
49
49
  intermediate_steps.each do |action, observation|
50
50
  thoughts += action.is_a?(String) ? action : " #{action.log}"
51
51
  thoughts += "\n#{observation_text(observation)}\n#{engine_prefix}"
@@ -189,8 +189,8 @@ module Boxcars
189
189
  return boxcar_result unless using_xml
190
190
 
191
191
  if boxcar_result.is_a?(Result)
192
- boxcar_result.answer = boxcar_result.answer.encode(xml: :text)
193
- else
192
+ boxcar_result.answer = boxcar_result.answer.encode(xml: :text) if boxcar_result.answer.is_a?(String)
193
+ elsif boxcar_result.is_a?(String)
194
194
  boxcar_result = boxcar_result.encode(xml: :text)
195
195
  end
196
196
  boxcar_result
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Boxcars
4
4
  # The current version of the gem.
5
- VERSION = "0.4.0"
5
+ VERSION = "0.4.1"
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: boxcars
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Francis Sullivan
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2023-07-19 00:00:00.000000000 Z
12
+ date: 2023-07-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: anthropic