ruby_bots 0.1.6 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d3ae9ad8837740fc9574b3ad68105a54678bb180a3c0f1331229be9e46147922
4
- data.tar.gz: ffa3586b535a14513cfc2620b176d9d55419f07a35ce78630512021fc8d37a4b
3
+ metadata.gz: 29571f3bd669b0439ad6dd186dec36d86d8f3c4dce500907ceaa3373894bf29c
4
+ data.tar.gz: 95acd176ab7009822f2abb6b852ccc583d724bec3b7ee0d7d42b66f855bb5ed8
5
5
  SHA512:
6
- metadata.gz: 7fe703cdf7a5442ae286bbd6302b766eeff0b62b70fa383a9c0b99789f3fcf16aae48e985550aa8a47b57425bd3fdeb3d52499616b2db687708f9a2268e1c91a
7
- data.tar.gz: b857002e5f6871633e41b681c958aca0ae65fb2faf9033125a9b530ceb299d312cd6786b4883d1e061223a93b6bb1a8bab13ff6df3c4c98961cfe08dbc4f023d
6
+ metadata.gz: c177016cc28ec702aa21b257c017065642f90ad8a60aee00d7ec76854783b7ff3846cd86f931bb4c5623e3cc863193dea73ffeff11d1d8517d3e7a57ef40abf1
7
+ data.tar.gz: d249a01cde7ab60936807385d7ddd714e68ba592847caf58c6026ebdef1be551f6b84ae945c2013c4066a6a7efdd71b81108b802d65a5dc098ea4b581ee8ef22
@@ -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.6'.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.6
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-06-01 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