boxcars 0.1.0 → 0.1.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: 4e5d528b00df4b8dec38f01fb5452f835c4ceb74b5a6ccda720cfedb4f6890ff
4
- data.tar.gz: 1560138d2ff1214097ae219afe660eea36a41d157f6059221d41326b5e7019f2
3
+ metadata.gz: 6ffc107602f3a2ae47bdb5b5410f6abc8c2ea2c3a13f350630e4d3ece92768f7
4
+ data.tar.gz: d4fcc08768de5f512a15bf0ca929d50b2a7296937c27c0f1b390189bf0956782
5
5
  SHA512:
6
- metadata.gz: 105433bf91880203ded6155ceb05fe53dd5da63cbc7dfd24d2ea5f28f2fcc8af0d2cd8ab740ba3a49e5fde43f5edf2a6b01548ab6849d28ecdfbc7bba7736d55
7
- data.tar.gz: 7f933f60e42a5b4da4638331489e4b3778578b5bf4b63072b7625bdb4896f46c5b441a6009db93f41e135323e5c752e35cf0e6ff9aa72350dcff9201bcbe697d
6
+ metadata.gz: b89e78ce7fec471c8c4f03d32a37bdffd5d1371ac474d14f7e1c90e653ccce62b30a95a845c5c1c1013f5a028c00bb3c87c35cc1394add0554bb33e232b6de63
7
+ data.tar.gz: 9007dcd0b5dfc8d3b886579cd563b085c04c471ffc3bb167f5d80adb74f85ceacdd5d40942f1772bd59ce4da5903deec2262420e28eba430394d0f831d6cd751
data/CHANGELOG.md CHANGED
@@ -1,5 +1,7 @@
1
- ## [Unreleased]
1
+ ## [0.1.1] - 2o23-02-16
2
+ Changed
3
+ - updated to OpenAI gem 3.0
2
4
 
3
- ## [0.1.0] - 2023-02-07
5
+ ## [0.1.0] - 2023-02-15
4
6
 
5
7
  - Initial release
data/Gemfile.lock CHANGED
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- boxcars (0.1.0)
4
+ boxcars (0.1.1)
5
5
  google_search_results (~> 2.2)
6
- ruby-openai (~> 2.2)
6
+ ruby-openai (~> 3.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
@@ -24,74 +24,74 @@ GEM
24
24
  concurrent-ruby (1.2.0)
25
25
  crack (0.4.5)
26
26
  rexml
27
- debug (1.7.0)
27
+ debug (1.7.1)
28
28
  irb (>= 1.5.0)
29
29
  reline (>= 0.3.1)
30
30
  diff-lcs (1.5.0)
31
31
  dotenv (2.8.1)
32
32
  google_search_results (2.2.0)
33
33
  hashdiff (1.0.1)
34
- httparty (0.20.0)
35
- mime-types (~> 3.0)
34
+ httparty (0.21.0)
35
+ mini_mime (>= 1.0.0)
36
36
  multi_xml (>= 0.5.2)
37
37
  i18n (1.12.0)
38
38
  concurrent-ruby (~> 1.0)
39
- io-console (0.5.11)
40
- irb (1.5.1)
39
+ io-console (0.6.0)
40
+ irb (1.6.2)
41
41
  reline (>= 0.3.0)
42
- json (2.6.2)
43
- mime-types (3.4.1)
44
- mime-types-data (~> 3.2015)
45
- mime-types-data (3.2022.0105)
42
+ json (2.6.3)
43
+ mini_mime (1.1.2)
46
44
  minitest (5.17.0)
47
45
  multi_xml (0.6.0)
48
46
  parallel (1.22.1)
49
- parser (3.2.0.0)
47
+ parser (3.2.1.0)
50
48
  ast (~> 2.4.1)
51
- public_suffix (5.0.0)
49
+ public_suffix (5.0.1)
52
50
  rainbow (3.1.1)
53
51
  rake (13.0.6)
54
- regexp_parser (2.6.0)
55
- reline (0.3.1)
52
+ regexp_parser (2.7.0)
53
+ reline (0.3.2)
56
54
  io-console (~> 0.5)
57
55
  rexml (3.2.5)
58
- rspec (3.11.0)
59
- rspec-core (~> 3.11.0)
60
- rspec-expectations (~> 3.11.0)
61
- rspec-mocks (~> 3.11.0)
62
- rspec-core (3.11.0)
63
- rspec-support (~> 3.11.0)
64
- rspec-expectations (3.11.0)
56
+ rspec (3.12.0)
57
+ rspec-core (~> 3.12.0)
58
+ rspec-expectations (~> 3.12.0)
59
+ rspec-mocks (~> 3.12.0)
60
+ rspec-core (3.12.1)
61
+ rspec-support (~> 3.12.0)
62
+ rspec-expectations (3.12.2)
65
63
  diff-lcs (>= 1.2.0, < 2.0)
66
- rspec-support (~> 3.11.0)
67
- rspec-mocks (3.11.1)
64
+ rspec-support (~> 3.12.0)
65
+ rspec-mocks (3.12.3)
68
66
  diff-lcs (>= 1.2.0, < 2.0)
69
- rspec-support (~> 3.11.0)
70
- rspec-support (3.11.0)
71
- rubocop (1.38.0)
67
+ rspec-support (~> 3.12.0)
68
+ rspec-support (3.12.0)
69
+ rubocop (1.45.1)
72
70
  json (~> 2.3)
73
71
  parallel (~> 1.10)
74
- parser (>= 3.1.2.1)
72
+ parser (>= 3.2.0.0)
75
73
  rainbow (>= 2.2.2, < 4.0)
76
74
  regexp_parser (>= 1.8, < 3.0)
77
75
  rexml (>= 3.2.5, < 4.0)
78
- rubocop-ast (>= 1.23.0, < 2.0)
76
+ rubocop-ast (>= 1.24.1, < 2.0)
79
77
  ruby-progressbar (~> 1.7)
80
- unicode-display_width (>= 1.4.0, < 3.0)
81
- rubocop-ast (1.23.0)
82
- parser (>= 3.1.1.0)
78
+ unicode-display_width (>= 2.4.0, < 3.0)
79
+ rubocop-ast (1.26.0)
80
+ parser (>= 3.2.1.0)
81
+ rubocop-capybara (2.17.1)
82
+ rubocop (~> 1.41)
83
83
  rubocop-rake (0.6.0)
84
84
  rubocop (~> 1.0)
85
- rubocop-rspec (2.17.1)
85
+ rubocop-rspec (2.18.1)
86
86
  rubocop (~> 1.33)
87
- ruby-openai (2.2.0)
88
- dotenv (>= 2.7.6, < 2.9.0)
89
- httparty (>= 0.18.1, < 0.21.0)
87
+ rubocop-capybara (~> 2.17)
88
+ ruby-openai (3.3.0)
89
+ httparty (>= 0.18.1)
90
90
  ruby-progressbar (1.11.0)
91
91
  sqlite3 (1.6.0-x86_64-darwin)
92
92
  tzinfo (2.0.6)
93
93
  concurrent-ruby (~> 1.0)
94
- unicode-display_width (2.3.0)
94
+ unicode-display_width (2.4.2)
95
95
  vcr (6.1.0)
96
96
  webmock (3.18.1)
97
97
  addressable (>= 2.8.0)
data/boxcars.gemspec ADDED
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/boxcars/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "boxcars"
7
+ spec.version = Boxcars::VERSION
8
+ spec.authors = ["Francis Sullivan", "Tabrez Syed"]
9
+ spec.email = ["hi@boxcars.ai"]
10
+
11
+ spec.summary = "Boxcars provide an API to connect together Boxcars and then conduct them. Inspired by python langchain."
12
+ spec.description = "You simply give a number of boxcars to a conductor, and it does the magic."
13
+ spec.homepage = "https://github.com/BoxcarsAI/boxcars"
14
+ spec.license = "MIT"
15
+ spec.required_ruby_version = ">= 2.6.0"
16
+
17
+ spec.metadata["homepage_uri"] = spec.homepage
18
+ spec.metadata["source_code_uri"] = spec.homepage
19
+ spec.metadata["changelog_uri"] = "https://github.com/BoxcarsAI/boxcars/blob/main/CHANGELOG.md"
20
+ spec.metadata["rubygems_mfa_required"] = "true"
21
+
22
+ # Specify which files should be added to the gem when it is released.
23
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
24
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
25
+ `git ls-files -z`.split("\x0").reject do |f|
26
+ (f == __FILE__) || f.match(%r{\A(?:(?:test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
27
+ end
28
+ end
29
+ spec.bindir = "exe"
30
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
31
+ spec.require_paths = ["lib"]
32
+
33
+ # dev / test dependencies
34
+ spec.add_development_dependency "debug", "~> 1.1"
35
+ spec.add_development_dependency "dotenv", "~> 2.8"
36
+ spec.add_development_dependency "rspec", "~> 3.2"
37
+
38
+ # runtime dependencies
39
+ spec.add_dependency "google_search_results", "~> 2.2"
40
+ spec.add_dependency "ruby-openai", "~> 3.0"
41
+
42
+ # For more information and examples about making a new gem, checkout our
43
+ # guide at: https://bundler.io/guides/creating_gem.html
44
+ end
@@ -46,7 +46,7 @@ module Boxcars
46
46
  prompts = []
47
47
  input_list.each do |inputs|
48
48
  new_prompt = prompt.format(**inputs)
49
- # puts "Prompt after formatting:\n#{new_prompt.colorize(:cyan)}"
49
+ puts "Prompt after formatting:\n#{new_prompt.colorize(:cyan)}"
50
50
  prompts.push(new_prompt)
51
51
  end
52
52
  engine.generate(prompts: prompts, stop: stop)
@@ -34,7 +34,7 @@ module Boxcars
34
34
  end
35
35
 
36
36
  def call(inputs:)
37
- t = predict(question: inputs[input_key], dialect: dialect, top_k: 5, table_info: schema, stop: ["SQLQuery:"]).strip
37
+ t = predict(question: inputs[input_key], dialect: dialect, top_k: 5, table_info: schema, stop: ["Answer:"]).strip
38
38
  answer = get_answer(t)
39
39
  puts answer.colorize(:magenta)
40
40
  { output_key => answer }
@@ -50,6 +50,7 @@ module Boxcars
50
50
  begin
51
51
  output = call(inputs: inputs)
52
52
  rescue StandardError => e
53
+ puts "Error in #{name} boxcar#call: #{e}".colorize(:red)
53
54
  raise e
54
55
  end
55
56
  validate_outputs(outputs: output.keys)
@@ -74,6 +74,7 @@ module Boxcars
74
74
  observation = boxcar.run(output.boxcar_input)
75
75
  return_direct = boxcar.return_direct
76
76
  rescue StandardError => e
77
+ puts "Error in #{boxcar.name} boxcar#call: #{e}".colorize(:red)
77
78
  raise e
78
79
  end
79
80
  else
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Boxcars
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
data/lib/boxcars.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'logger'
4
+
3
5
  # Boxcars is a framework for running a series of tools to get an answer to a question.
4
6
  module Boxcars
5
7
  # Error class for all Boxcars errors.
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.1.0
4
+ version: 0.1.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-02-15 00:00:00.000000000 Z
12
+ date: 2023-02-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: debug
@@ -73,14 +73,14 @@ dependencies:
73
73
  requirements:
74
74
  - - "~>"
75
75
  - !ruby/object:Gem::Version
76
- version: '2.2'
76
+ version: '3.0'
77
77
  type: :runtime
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
81
  - - "~>"
82
82
  - !ruby/object:Gem::Version
83
- version: '2.2'
83
+ version: '3.0'
84
84
  description: You simply give a number of boxcars to a conductor, and it does the magic.
85
85
  email:
86
86
  - hi@boxcars.ai
@@ -99,6 +99,7 @@ files:
99
99
  - Rakefile
100
100
  - bin/console
101
101
  - bin/setup
102
+ - boxcars.gemspec
102
103
  - lib/boxcars.rb
103
104
  - lib/boxcars/boxcar.rb
104
105
  - lib/boxcars/boxcar/calculator.rb