ruby_bots 0.1.5 → 0.2.0

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: 07ac76eec3731f78296f677eb869f4b1545c584c3e4aba05b95a80711d203413
4
- data.tar.gz: 279987919a463d8f59c65ede5fdf9c9db1497c1776487706cebe526463a8c20e
3
+ metadata.gz: 29571f3bd669b0439ad6dd186dec36d86d8f3c4dce500907ceaa3373894bf29c
4
+ data.tar.gz: 95acd176ab7009822f2abb6b852ccc583d724bec3b7ee0d7d42b66f855bb5ed8
5
5
  SHA512:
6
- metadata.gz: 21154ec95ef5549881902124e1959667eb29199f4198c21df1f41a9c2fb042309f4570b2504bbbb1d0fa4086622a71547a238ed1797152b6c6275e373ebf8e24
7
- data.tar.gz: 070eb08f2a94df14666e94716ac154d97ce52c6524a31527b8778110ae500b7a71aa9f96ff8378443a263e32ba744ae0e1bc1cb06811811a16da693f6c0c74fe
6
+ metadata.gz: c177016cc28ec702aa21b257c017065642f90ad8a60aee00d7ec76854783b7ff3846cd86f931bb4c5623e3cc863193dea73ffeff11d1d8517d3e7a57ef40abf1
7
+ data.tar.gz: d249a01cde7ab60936807385d7ddd714e68ba592847caf58c6026ebdef1be551f6b84ae945c2013c4066a6a7efdd71b81108b802d65a5dc098ea4b581ee8ef22
@@ -121,8 +121,6 @@ module RubyBots
121
121
  tool_name = tool_string.match(/([a-zA-Z_\- ]*)\[([\s\S]*)\]/)[1]
122
122
  tool_input = tool_string.match(/([a-zA-Z_\- ]*)\[([\s\S]*)\]/)[2]
123
123
 
124
- notify_observers(:action, tool_name, tool_input)
125
-
126
124
  tool = tools.find { |t| t.name == tool_name }
127
125
 
128
126
  tool.response(tool_input)
@@ -1,6 +1,6 @@
1
1
  module RubyBots
2
2
  # Class to provide a router to different tools.
3
- # This bot connects to the OpenAI API and uses gpt-4 by default to choose a proper tool to route the user's input.
3
+ # This bot connects to the OpenAI API and uses gpt-3.5-turbo by default to choose a proper tool to route the user's input.
4
4
  # The bot will only select and use one tool by default.
5
5
  class RouterBot < OpenAIBot
6
6
  DEFAULT_DESCRIPTION = <<~DESCRIPTION.strip_heredoc
@@ -1,18 +1,31 @@
1
1
  module RubyBots
2
2
  class OpenAIStreamingTool < OpenAIChatTool
3
- def run(input, &block)
4
- @messages = [
5
- { role: :system, content: system_instructions },
6
- { role: :user, content: input }
7
- ]
3
+ def initialize(name: 'OpenAI Streaming Tool', description: DEFAULT_DESCRIPTION, messages: nil)
4
+ @messages = messages || []
5
+ super(name:, description:)
6
+ end
7
+
8
+ def response
9
+ super('')
10
+ end
11
+
12
+ private
13
+
14
+ def run(input)
15
+ messages = [
16
+ { role: :system, content: system_instructions }
17
+ ] + @messages
18
+ unless input.empty?
19
+ messages += [
20
+ { role: :user, content: input }
21
+ ]
22
+ end
8
23
 
9
24
  client.chat(
10
25
  parameters: {
11
- messages: @messages,
12
- model: 'gpt-4',
13
- temperature: 0.7,
26
+ messages:,
14
27
  stream: stream_proc
15
- }
28
+ }.merge(default_params)
16
29
  )
17
30
  end
18
31
 
@@ -16,7 +16,7 @@ module RubyBots
16
16
 
17
17
  def default_params
18
18
  {
19
- model: 'gpt-4',
19
+ model: 'gpt-3.5-turbo',
20
20
  temperature: 0
21
21
  }
22
22
  end
@@ -1,3 +1,3 @@
1
1
  module RubyBots
2
- VERSION = '0.1.5 '.freeze
2
+ VERSION = '0.2.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_bots
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Paulson
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-05-23 00:00:00.000000000 Z
11
+ date: 2023-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: debug