omniai 1.0.7 → 1.0.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3be83f1587fcdde2ec982dc7220e5c0abd9d9c756b3879b50cb8be2558dad0f7
4
- data.tar.gz: 6b031c1deaf0d9ef144fdba86a25650671b4492e960fcb633f1558a72922d61e
3
+ metadata.gz: 2f4665d73734c57eaf861adb6a941c7e3102c5de00ec4739f29b69123b829a1d
4
+ data.tar.gz: '03487dbb919fb7821be77fcbecac4d0adefa5c62d511fffa2ca06d6c3f28c946'
5
5
  SHA512:
6
- metadata.gz: a07f2c8b25842f73c34fb8ca80bbb3efb1554da4bae6ffaca140167ee4581a198b175252d687dad1ac9dd34c05d4dbd63bfce951ecc5c907119c175d7dd92597
7
- data.tar.gz: ea95daacea2365aeb68253d1c7168cfbae8cb26323a2e60ffc8212b43ad0c24497f8e8679188dec6a838dc21daf10387e363ad7a55a21def55c22a48968763f0
6
+ metadata.gz: 105c7d3af61b4f79b1bdfb15c083ea48cbe92bb6b81bc2ccdccef2f8873ed2b358cbf3a7c3418187a7b2b4d27d0768a5c1a8ce36866d263eb107cee91842011f
7
+ data.tar.gz: 4ddad063456e0d1a98c6b21c284fb66ba5ce672f6b4df4f03522ebf3f341269ebecf28607132a84120b9de621b9e5ca65b219b0f072bbf36bc5f4970461458a4
data/Gemfile CHANGED
@@ -11,3 +11,5 @@ gem 'rspec_junit_formatter'
11
11
  gem 'rubocop'
12
12
  gem 'rubocop-rake'
13
13
  gem 'rubocop-rspec'
14
+ gem 'simplecov'
15
+ gem 'webmock'
data/README.md CHANGED
@@ -66,7 +66,7 @@ Clients that support chat (e.g. Anthropic w/ "Claude", Google w/ "Gemini", Mistr
66
66
 
67
67
  ```ruby
68
68
  completion = client.chat('Tell me a joke.')
69
- puts(completion.choice.message.content) # '...'
69
+ completion.choice.message.content # '...'
70
70
  ```
71
71
 
72
72
  #### w/ a Collection of Messages
@@ -77,13 +77,10 @@ messages = [
77
77
  role: 'system',
78
78
  content: 'You are a helpful assistant with an expertise in geography.',
79
79
  },
80
- {
81
- role: 'user',
82
- content: 'What is the capital of Canada?',
83
- },
80
+ 'What is the capital of Canada?'
84
81
  ]
85
82
  completion = client.chat(messages, model: '...', temperature: 0.7, format: :json)
86
- puts(completion.choice.message.content) # '...'
83
+ completion.choice.message.content
87
84
  ```
88
85
 
89
86
  #### w/ a Collection of Files
@@ -103,7 +100,7 @@ message = {
103
100
  }
104
101
 
105
102
  completion = client.chat(message)
106
- puts(completion.choice.message.content) # '...'
103
+ completion.choice.message.content
107
104
  ```
108
105
 
109
106
  #### Streaming
@@ -33,7 +33,7 @@ module OmniAI
33
33
 
34
34
  # @return [Array<OmniAI::Chat::Choice>]
35
35
  def choices
36
- @choices ||= @data['choices'].map { |data| Choice.new(data:) }
36
+ @choices ||= @data['choices'].map { |data| Choice.for(data:) }
37
37
  end
38
38
 
39
39
  # @param [index] [Integer]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OmniAI
4
- VERSION = '1.0.7'
4
+ VERSION = '1.0.9'
5
5
  end
data/lib/omniai.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'event_stream_parser'
3
4
  require 'http'
4
5
  require 'zeitwerk'
5
6
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniai
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7
4
+ version: 1.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Sylvestre