chatgpt-rb 0.1.2 → 0.1.3

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: 2dcefe52467b8bae3bc12c17e1f36a20b7a5a8a207f21c20d3db413b19f0a15e
4
- data.tar.gz: 0cde2181779a22b431d8afd59dc89a80a1a5c58634fd02f7795cc31a9ee874be
3
+ metadata.gz: 3f4e1f6a8aea8a8fa06d4ebe9c35da19c8e7813c945a1ce534eeadd0e5088282
4
+ data.tar.gz: 611a070396c1c5006bd3df9b961dc2b2ed1a0fd3259626b4b38edbc2c08337c1
5
5
  SHA512:
6
- metadata.gz: 5ba3dd8cf78ef49ca4df7ed0521c309b8cc44bc837a0fd14aed5a7f346cced3a5204c56581514b19761d0f081b82edae25298a871eba7dfc409a226819f3a1b5
7
- data.tar.gz: 73f97ff7857d9947cfd60036eb8c0b455e603fe73b84d02624ff693f969cfcdef47c8e078c3e7a95cb78fde9ca70fccffc3d2b52c36c9465220adfa4e3e8aa95
6
+ metadata.gz: b2d583053bfb3700bda25d4416796997ce24c8acfd053deb34a639119b48aea90e555acb0edf4fd8c002e72716eb195629ee1b913ab6db06511d65457431c618
7
+ data.tar.gz: 3dc0bcfb0bb3eabc87972722ff617431349634c501406a02eada63bf61d03df5c9b05c515759db76e6ea119d85c7325781a8887f51ec802bde108eae15cb1e59
data/bin/chatgpt-rb CHANGED
@@ -49,10 +49,12 @@ end.parse!
49
49
  begin
50
50
  puts "Type any message to talk with ChatGPT. Type '\\help' for a list of commands."
51
51
 
52
- functions = options[:functions_files].map do |function_file|
52
+ functions = options[:functions_files].flat_map do |function_file|
53
53
  puts "Loading functions from #{function_file}"
54
54
 
55
- ChatgptRb::DSL::Conversation.new(ChatgptRb::Conversation.new).instance_eval(File.read(function_file))
55
+ ChatgptRb::Conversation.new.tap do |conversation|
56
+ ChatgptRb::DSL::Conversation.new(conversation).instance_eval(File.read(function_file))
57
+ end.functions.values
56
58
  end
57
59
 
58
60
  messages = if options[:file]
@@ -35,7 +35,7 @@ module ChatgptRb
35
35
  @prompt = prompt
36
36
  @base_uri = base_uri
37
37
  ChatgptRb::DSL::Conversation.configure(self, &configuration) if block_given?
38
- @messages << { role: "system", content: prompt } if prompt
38
+ @messages.unshift(role: "system", content: prompt) if prompt
39
39
  end
40
40
 
41
41
  # @param content [String]
@@ -0,0 +1,3 @@
1
+ module ChatgptRb
2
+ VERSION = "0.1.3"
3
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chatgpt-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Breckenridge
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-26 00:00:00.000000000 Z
11
+ date: 2023-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -123,7 +123,7 @@ dependencies:
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  description: Provides libraries for interacting with the ChatGPT API and a CLI program
126
- `chatgpt-rb` for live conversations.
126
+ `chatgpt-rb` for live conversations. Supports writing functions in Ruby.
127
127
  email:
128
128
  - aaron@breckridge.dev
129
129
  executables:
@@ -141,6 +141,7 @@ files:
141
141
  - lib/chatgpt_rb/dsl/parameter.rb
142
142
  - lib/chatgpt_rb/function.rb
143
143
  - lib/chatgpt_rb/parameter.rb
144
+ - lib/chatgpt_rb/version.rb
144
145
  homepage: https://github.com/breckenedge/chatgpt-rb
145
146
  licenses:
146
147
  - MIT