omniai-mistral 1.0.4 → 1.3.0

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: a8ee32af7fae89e3e808d4cc3a041b360aa4864b1fd737b5a022001207500a2c
4
- data.tar.gz: 499fe0f4993fd18effaca28b1d4b6f878a9f9612c396a9567b4d0ff8a242c097
3
+ metadata.gz: 382f5eb9d01087dbab76c84890ddd1414e89017714c211ec4163206f56f7557b
4
+ data.tar.gz: dad60217422c646066cd2c0a60339d52cd4347df31175ec889fdfbd735e19a33
5
5
  SHA512:
6
- metadata.gz: ee764591f245f35c429c639f5bf9d7859a42a7d6b2c03c159bd911b1be48861ec9774eb1e98643d8d516386132e5324f67e20936ed4e77db53fc5dbdcabf3d6c
7
- data.tar.gz: eca77c0fdc184c53c8bd590e1bae612a4f7f058a03446ba804689f455dd514c374bfe59bd9893f979feadace0ee490c10b0e1dd000a8d608269a8ae3fcbd84c7
6
+ metadata.gz: 79e0f8d805a3d577facbbd6477be06ca38de8da9370987e6ff0bea1bc9175222d12ea188d15769ecb571849ff1c3e06f27ff4ca7ef01d98b82d1651dc0670656
7
+ data.tar.gz: 773bc4ba186ee0a1ae2d27c8ca1862dfafd5d44b90ed99993f8e420c5eba89422855ba433ea14c2d894a327e8e44194df1ff25f7d4436c7ff335f0932d5701e2
data/Gemfile CHANGED
@@ -11,4 +11,5 @@ gem 'rspec_junit_formatter'
11
11
  gem 'rubocop'
12
12
  gem 'rubocop-rake'
13
13
  gem 'rubocop-rspec'
14
+ gem 'simplecov'
14
15
  gem 'webmock'
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # OmniAI::Mistral
2
2
 
3
+ [![CircleCI](https://circleci.com/gh/ksylvest/omniai-mistral.svg?style=svg)](https://circleci.com/gh/ksylvest/omniai-mistral)
4
+
3
5
  An Mistral implementation of the [OmniAI](https://github.com/ksylvest/omniai) APIs.
4
6
 
5
7
  ## Installation
@@ -24,21 +24,22 @@ module OmniAI
24
24
 
25
25
  # @param api_key [String] optional - defaults to `OmniAI::Mistral.config.api_key`
26
26
  # @param host [String] optional - defaults to `OmniAI::Mistral.config.host`
27
+ # @param logger [Logger] optional - defaults to `OmniAI::Mistral.config.logger`
28
+ # @param timeout [Integer] optional - defaults to `OmniAI::Mistral.config.timeout`
27
29
  def initialize(
28
30
  api_key: OmniAI::Mistral.config.api_key,
31
+ host: OmniAI::Mistral.config.host,
29
32
  logger: OmniAI::Mistral.config.logger,
30
- host: OmniAI::Mistral.config.host
33
+ timeout: OmniAI::Mistral.config.timeout
31
34
  )
32
35
  raise(ArgumentError, %(ENV['MISTRAL_API_KEY'] must be defined or `api_key` must be passed)) if api_key.nil?
33
36
 
34
- super(api_key:, logger:)
35
-
36
- @host = host
37
+ super
37
38
  end
38
39
 
39
40
  # @return [HTTP::Client]
40
41
  def connection
41
- @connection ||= HTTP.auth("Bearer #{api_key}").persistent(@host)
42
+ @connection ||= super.auth("Bearer #{api_key}")
42
43
  end
43
44
 
44
45
  # @raise [OmniAI::Error]
@@ -2,15 +2,21 @@
2
2
 
3
3
  module OmniAI
4
4
  module Mistral
5
- # Config for the Mistral `api_key` / `host` / `logger`, `chat_options`.
5
+ # Configuration for Mistral.
6
6
  class Config < OmniAI::Config
7
- attr_accessor :chat_options
7
+ DEFAULT_HOST = 'https://api.mistral.ai'
8
8
 
9
- def initialize
9
+ # @param api_key [String, nil] optional - defaults to `ENV['MISTRAL_API_KEY']`
10
+ # @param host [String, nil] optional - defaults to `ENV['MISTRAL_HOST'] w/ fallback to `DEFAULT_HOST`
11
+ # @param logger [Logger, nil] optional - defaults to
12
+ # @param timeout [Integer, Hash, nil] optional
13
+ def initialize(
14
+ api_key: ENV.fetch('MISTRAL_API_KEY', nil),
15
+ host: ENV.fetch('MISTRAL_HOST', DEFAULT_HOST),
16
+ logger: nil,
17
+ timeout: nil
18
+ )
10
19
  super
11
- @api_key = ENV.fetch('MISTRAL_API_KEY', nil)
12
- @host = ENV.fetch('MISTRAL_HOST', 'https://api.mistral.ai')
13
- @chat_options = {}
14
20
  end
15
21
  end
16
22
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module OmniAI
4
4
  module Mistral
5
- VERSION = '1.0.4'
5
+ VERSION = '1.3.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniai-mistral
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Sylvestre
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-06-15 00:00:00.000000000 Z
11
+ date: 2024-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: event_stream_parser
@@ -67,7 +67,8 @@ files:
67
67
  - lib/omniai/mistral/config.rb
68
68
  - lib/omniai/mistral/version.rb
69
69
  homepage: https://github.com/ksylvest/omniai-mistral
70
- licenses: []
70
+ licenses:
71
+ - MIT
71
72
  metadata:
72
73
  homepage_uri: https://github.com/ksylvest/omniai-mistral
73
74
  changelog_uri: https://github.com/ksylvest/omniai-mistral/releases