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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 29571f3bd669b0439ad6dd186dec36d86d8f3c4dce500907ceaa3373894bf29c
|
4
|
+
data.tar.gz: 95acd176ab7009822f2abb6b852ccc583d724bec3b7ee0d7d42b66f855bb5ed8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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-
|
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
|
4
|
-
@messages = [
|
5
|
-
|
6
|
-
|
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
|
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
|
|
data/lib/ruby_bots/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2023-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: debug
|