omniai 1.1.0 → 1.1.1
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/README.md +4 -3
- data/lib/omniai/client.rb +1 -1
- data/lib/omniai/transcribe.rb +1 -1
- 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: c22e433e659a447047be5c560093b288f71619b65c30d28c1f0b772a731f02b9
|
4
|
+
data.tar.gz: c654b22f69ec301f4858e2ec82d9999e14f4b1aeb99b71edc4511410b8c77064
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1068c486faab118bb1171da1ec53a57a4f3b45625b2d5d74de3dc49df4d40c552cc99bab4f640d1cf4eed5693715002a49a14e487b1f75008962c85a158d157
|
7
|
+
data.tar.gz: 3900c46ed2929cae7409b8b3048ef5339738414adfacee83a3b388a8ab93cea6e88d7031513647adafd136e6d1ddf0f9a0e553ea2a42d4de2013602f56919241
|
data/README.md
CHANGED
@@ -80,7 +80,7 @@ messages = [
|
|
80
80
|
'What is the capital of Canada?'
|
81
81
|
]
|
82
82
|
completion = client.chat(messages, model: '...', temperature: 0.7, format: :json)
|
83
|
-
completion.choice.message.content
|
83
|
+
completion.choice.message.content # '...'
|
84
84
|
```
|
85
85
|
|
86
86
|
#### w/ a Collection of Files
|
@@ -100,7 +100,7 @@ message = {
|
|
100
100
|
}
|
101
101
|
|
102
102
|
completion = client.chat(message)
|
103
|
-
completion.choice.message.content
|
103
|
+
completion.choice.message.content # '...'
|
104
104
|
```
|
105
105
|
|
106
106
|
#### Streaming
|
@@ -117,5 +117,6 @@ client.chat('Tell me a joke.', stream:)
|
|
117
117
|
Clients that support chat (e.g. OpenAI w/ "Whisper", etc) convert recordings to text via the following calls:
|
118
118
|
|
119
119
|
```ruby
|
120
|
-
client.transcribe(file.path)
|
120
|
+
transcription = client.transcribe(file.path)
|
121
|
+
transcription.text # '...'
|
121
122
|
```
|
data/lib/omniai/client.rb
CHANGED
@@ -56,7 +56,7 @@ module OmniAI
|
|
56
56
|
# @param format [Symbol] :text, :srt, :vtt, or :json (default)
|
57
57
|
#
|
58
58
|
# @return text [OmniAI::Transcribe::Transcription]
|
59
|
-
def transcribe(file, model:, language: nil, prompt: nil, temperature: nil, format:
|
59
|
+
def transcribe(file, model:, language: nil, prompt: nil, temperature: nil, format: nil)
|
60
60
|
raise NotImplementedError, "#{self.class.name}#speak undefined"
|
61
61
|
end
|
62
62
|
end
|
data/lib/omniai/transcribe.rb
CHANGED
@@ -119,7 +119,7 @@ module OmniAI
|
|
119
119
|
response = request!
|
120
120
|
raise HTTPError, response.flush unless response.status.ok?
|
121
121
|
|
122
|
-
data = @format.eql?(Format::JSON) ? response.parse : { text: String(response.body) }
|
122
|
+
data = @format.nil? || @format.eql?(Format::JSON) ? response.parse : { text: String(response.body) }
|
123
123
|
Transcription.new(format: @format, data:)
|
124
124
|
end
|
125
125
|
|
data/lib/omniai/version.rb
CHANGED