omniai 0.0.6 → 0.0.7
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.rb +7 -6
- data/lib/omniai/client.rb +5 -3
- 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: 53ccc1363252abefa6089ff068b11b3ac15b5817339dc935ae9b78cf1d146b20
|
4
|
+
data.tar.gz: 1b4fe76443ef245f7198c1d55edab1fa6d985afbef1638705caf3d40a1b88c05
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f687cd00e0cbed7994d8a172c657d135741e8ca5afdc8f4bcff53ffb6ec6746f553f26cfeeddcf08a81a261e72e7dcd0b4aee06e0b9e336016a1843189bb4a29
|
7
|
+
data.tar.gz: 6d89697cc18301852e6648b2a323634a59df9bf90032146d35837ead4a4746bad13527aeef8c67af8cd0290bdaae3177de50d29c220c8fff86f844f081484970
|
data/lib/omniai/chat.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module OmniAI
|
4
|
-
# An abstract class that provides an interface for chatting for various vendors (e.g. OpenAI
|
4
|
+
# An abstract class that provides an interface for chatting for various vendors (e.g. OpenAI’s ChatGPT).
|
5
5
|
#
|
6
6
|
# Usage:
|
7
7
|
#
|
@@ -23,13 +23,14 @@ module OmniAI
|
|
23
23
|
|
24
24
|
# @raise [OmniAI::Error]
|
25
25
|
#
|
26
|
-
# @param messages [String]
|
27
|
-
# @param model [String]
|
28
|
-
# @param format [Symbol]
|
29
|
-
# @param temperature [Float]
|
26
|
+
# @param messages [String, Array, Hash, OmnniAI::Chat::Message]
|
27
|
+
# @param model [String] optional
|
28
|
+
# @param format [Symbol] optional :text or :json
|
29
|
+
# @param temperature [Float, nil] optional
|
30
|
+
# @param stream [Proc, nil] optional
|
30
31
|
#
|
31
32
|
# @return [OmniAI::Chat::Request]
|
32
|
-
def completion(messages, model:, temperature:
|
33
|
+
def completion(messages, model:, temperature: nil, format: nil, stream: nil)
|
33
34
|
raise NotImplementedError, "#{self.class.name}#completion undefined"
|
34
35
|
end
|
35
36
|
end
|
data/lib/omniai/client.rb
CHANGED
@@ -6,7 +6,7 @@ module OmniAI
|
|
6
6
|
# Usage:
|
7
7
|
#
|
8
8
|
# class OmniAI::OpenAI::Client < OmniAI::Client
|
9
|
-
# def initialize(api_key: ENV.fetch('OPENAI_API_KEY'))
|
9
|
+
# def initialize(api_key: ENV.fetch('OPENAI_API_KEY'), logger: nil)
|
10
10
|
# super
|
11
11
|
# end
|
12
12
|
#
|
@@ -21,13 +21,15 @@ module OmniAI
|
|
21
21
|
attr_accessor :api_key
|
22
22
|
|
23
23
|
# @param api_key [String]
|
24
|
-
|
24
|
+
# @param logger [Logger]
|
25
|
+
def initialize(api_key:, logger: nil)
|
25
26
|
@api_key = api_key
|
27
|
+
@logger = logger
|
26
28
|
end
|
27
29
|
|
28
30
|
# @return [HTTP::Client]
|
29
31
|
def connection
|
30
|
-
|
32
|
+
raise NotImplementedError, "#{self.class.name}#connection undefined"
|
31
33
|
end
|
32
34
|
|
33
35
|
# @return [OmniAI::Chat] an instance of OmniAI::Chat
|
data/lib/omniai/version.rb
CHANGED