omniai 1.0.3 → 1.0.4
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 +4 -4
- data/lib/omniai/chat/choice.rb +3 -1
- data/lib/omniai/chat/message.rb +15 -10
- data/lib/omniai/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d821530b3b40043754c26a175c2b5d9c70fe3f04bd62bf61c5506963e56dae3
|
4
|
+
data.tar.gz: 6f0cf3e3292b11492bd25526391ec3a396d5a9262050dcf4d5aba35726c2ed04
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f2d2fa897c94b741435df368ca0952fe00e4dafd0f199756008749a1267ac2d4ea325338b1da359c7c84944b76ec3a875d678039b9bd88ee819cacb470a6fdd
|
7
|
+
data.tar.gz: 698f4ec0159ac6a359f5bd93c02db3e4acd0cde6cfd42c17a30c341d6ad674720aa442040c0890cd3c600068c52717b011b28601335721fbdd7a55c1d74ae61d
|
data/lib/omniai/chat/choice.rb
CHANGED
data/lib/omniai/chat/message.rb
CHANGED
@@ -4,22 +4,27 @@ module OmniAI
|
|
4
4
|
class Chat
|
5
5
|
# A message returned by the API.
|
6
6
|
class Message
|
7
|
-
attr_accessor :
|
7
|
+
attr_accessor :role, :content
|
8
8
|
|
9
|
-
# @param
|
10
|
-
# @
|
11
|
-
def
|
12
|
-
|
9
|
+
# @param data [Hash]
|
10
|
+
# @return [OmniAI::Chat::Message]
|
11
|
+
def self.for(data:)
|
12
|
+
content = data['content'] || data[:content]
|
13
|
+
role = data['role'] || data[:role]
|
14
|
+
|
15
|
+
new(content:, role: role || Role::USER)
|
13
16
|
end
|
14
17
|
|
15
|
-
# @
|
16
|
-
|
17
|
-
|
18
|
+
# @param content [String]
|
19
|
+
# @param role [String] optional (default to "user") e.g. "assistant" / "user" / "system"
|
20
|
+
def initialize(content:, role: OmniAI::Chat::Role::USER)
|
21
|
+
@role = role
|
22
|
+
@content = content
|
18
23
|
end
|
19
24
|
|
20
25
|
# @return [String]
|
21
|
-
def
|
22
|
-
|
26
|
+
def inspect
|
27
|
+
"#<#{self.class.name} role=#{role.inspect} content=#{content.inspect}>"
|
23
28
|
end
|
24
29
|
end
|
25
30
|
end
|
data/lib/omniai/version.rb
CHANGED