omniai 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/omniai/chat/request.rb +5 -5
- data/lib/omniai/config.rb +2 -0
- 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: 4e387dddb26068bab8b4aa35a8e990d6db7aed7f034ae4593105b680282e5d43
|
4
|
+
data.tar.gz: 20f9b49d315dea539937521507058a16b8d6f8b0aaeea26f1b6be2cacf07122c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c3f503fe81921c2d690f169bc22d3d55b00b590920dc31c47c625a93dd142c995e369a9ffa3675c82bf7d04d3861e3b6e09b98b6e3afbd72bfed91b606e8473
|
7
|
+
data.tar.gz: 443d264b0f4c39058fd759b379e604cb631435334fff5fe7528b06cf8502af40c2fbfdca86300e5135029e90ab6104bb0c2b86e5198bd69fcd9c8071e6fbc07a
|
data/lib/omniai/chat/request.rb
CHANGED
@@ -6,7 +6,7 @@ module OmniAI
|
|
6
6
|
#
|
7
7
|
# Usage:
|
8
8
|
#
|
9
|
-
# class OmniAI::OpenAI::ChatGPT::
|
9
|
+
# class OmniAI::OpenAI::ChatGPT::Request < OmniAI::Chat::Request
|
10
10
|
# module Model
|
11
11
|
# CHAT = "davinci"
|
12
12
|
# end
|
@@ -23,7 +23,7 @@ module OmniAI
|
|
23
23
|
# @param model [String] required
|
24
24
|
# @param temperature [Float, nil] optional
|
25
25
|
# @param stream [Proc, nil] optional
|
26
|
-
# @param format [Symbol, nil] optional - :
|
26
|
+
# @param format [Symbol, nil] optional - :json
|
27
27
|
def initialize(client:, messages:, model:, temperature: nil, stream: nil, format: nil)
|
28
28
|
@client = client
|
29
29
|
@messages = messages
|
@@ -44,12 +44,12 @@ module OmniAI
|
|
44
44
|
protected
|
45
45
|
|
46
46
|
# @param response [HTTP::Response]
|
47
|
-
# @return [OmniAI::Chat::Completion
|
47
|
+
# @return [OmniAI::Chat::Completion]
|
48
48
|
def parse!(response:)
|
49
49
|
if @stream
|
50
50
|
stream!(response:)
|
51
51
|
else
|
52
|
-
OmniAI::
|
52
|
+
OmniAI::Chat::Completion.new(data: response.parse)
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
@@ -62,7 +62,7 @@ module OmniAI
|
|
62
62
|
parser.feed(chunk) do |_, data|
|
63
63
|
break if data.eql?('[DONE]')
|
64
64
|
|
65
|
-
chunk = OmniAI::
|
65
|
+
chunk = OmniAI::Chat::Chunk.new(data: JSON.parse(data))
|
66
66
|
@stream.call(chunk)
|
67
67
|
end
|
68
68
|
end
|
data/lib/omniai/config.rb
CHANGED
data/lib/omniai/version.rb
CHANGED