omniai-openai 1.1.1 → 1.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 +4 -4
- data/README.md +7 -7
- data/lib/omniai/openai/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 01d9c9144c74769c3eed7d8ec37f4cab63885057d5f16b02727e8c26e94414a0
|
4
|
+
data.tar.gz: 98e56e503c8ba01d3822d448dab53c94fef16d08c3f7896884e381f0b10b54fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 652b78a11ffb57f7b884d39fd08222fd4a87a0105a32ec0304d7d09efde5988b7f6058d3fbed46b6b3b8e8d44fec5191ffe925804f953456502020ea9cc8ef6f
|
7
|
+
data.tar.gz: 41c3516078e9a9411eebea6a0eaf3424b6a756d8b714697e51817e02f7faa9c4f170dc38c2fadb21c325a7576c5ae615468e3fb5d1438014532ae1be4c43d37b
|
data/README.md
CHANGED
@@ -45,12 +45,12 @@ end
|
|
45
45
|
A chat completion is generated by passing in prompts using any a variety of formats:
|
46
46
|
|
47
47
|
```ruby
|
48
|
-
completion = client.chat
|
48
|
+
completion = client.chat('Tell me a joke!')
|
49
49
|
completion.choice.message.content # 'Why did the chicken cross the road? To get to the other side.'
|
50
50
|
```
|
51
51
|
|
52
52
|
```ruby
|
53
|
-
completion = client.chat
|
53
|
+
completion = client.chat({
|
54
54
|
role: OmniAI::Chat::Role::USER,
|
55
55
|
content: 'Is it wise to jump off a bridge?'
|
56
56
|
})
|
@@ -58,7 +58,7 @@ completion.choice.message.content # 'No.'
|
|
58
58
|
```
|
59
59
|
|
60
60
|
```ruby
|
61
|
-
completion = client.chat
|
61
|
+
completion = client.chat([
|
62
62
|
{
|
63
63
|
role: OmniAI::Chat::Role::SYSTEM,
|
64
64
|
content: 'You are a helpful assistant.'
|
@@ -73,7 +73,7 @@ completion.choice.message.content # 'The capital of Canada is Ottawa.'
|
|
73
73
|
`model` takes an optional string (default is `gtp-4o`):
|
74
74
|
|
75
75
|
```ruby
|
76
|
-
completion = client.chat
|
76
|
+
completion = client.chat('How fast is a cheetah?', model: OmniAI::OpenAI::Chat::Model::GPT_3_5_TURBO)
|
77
77
|
completion.choice.message.content # 'A cheetah can reach speeds over 100 km/h.'
|
78
78
|
```
|
79
79
|
|
@@ -84,7 +84,7 @@ completion.choice.message.content # 'A cheetah can reach speeds over 100 km/h.'
|
|
84
84
|
`temperature` takes an optional float between `0.0` and `2.0` (defaults is `0.7`):
|
85
85
|
|
86
86
|
```ruby
|
87
|
-
completion = client.chat
|
87
|
+
completion = client.chat('Pick a number between 1 and 5', temperature: 2.0)
|
88
88
|
completion.choice.message.content # '3'
|
89
89
|
```
|
90
90
|
|
@@ -98,7 +98,7 @@ completion.choice.message.content # '3'
|
|
98
98
|
stream = proc do |chunk|
|
99
99
|
print(chunk.choice.delta.content) # 'Better', 'three', 'hours', ...
|
100
100
|
end
|
101
|
-
client.chat
|
101
|
+
client.chat('Be poetic.', stream:)
|
102
102
|
```
|
103
103
|
|
104
104
|
[OpenAI API Reference `stream`](https://platform.openai.com/docs/api-reference/chat/create#chat-create-stream)
|
@@ -108,7 +108,7 @@ client.chat.completion('Be poetic.', stream:)
|
|
108
108
|
`format` takes an optional symbol (`:json`) and that setes the `response_format` to `json_object`:
|
109
109
|
|
110
110
|
```ruby
|
111
|
-
completion = client.chat
|
111
|
+
completion = client.chat([
|
112
112
|
{ role: OmniAI::Chat::Role::SYSTEM, content: OmniAI::Chat::JSON_PROMPT },
|
113
113
|
{ role: OmniAI::Chat::Role::USER, content: 'What is the name of the drummer for the Beatles?' }
|
114
114
|
], format: :json)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniai-openai
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Sylvestre
|
@@ -69,7 +69,8 @@ files:
|
|
69
69
|
- lib/omniai/openai/transcribe.rb
|
70
70
|
- lib/omniai/openai/version.rb
|
71
71
|
homepage: https://github.com/ksylvest/omniai-openai
|
72
|
-
licenses:
|
72
|
+
licenses:
|
73
|
+
- MIT
|
73
74
|
metadata:
|
74
75
|
homepage_uri: https://github.com/ksylvest/omniai-openai
|
75
76
|
changelog_uri: https://github.com/ksylvest/omniai-openai/releases
|