mistral-ai 1.1.0 → 1.1.1

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: a5a4440552277c82714d8e396bd842688a82bdc0d620d71a2783e51111e122ea
4
- data.tar.gz: 1bcd20702986e71433cfeb3bb61970af0bc87da6a2274d1b89dd85c8f118dff0
3
+ metadata.gz: d35454c7499ef405271de5ccb410f77dcc4bbc6be2c5727e73113630c8991f5d
4
+ data.tar.gz: 88e62dfaf6d8e6c22c23dfcec8c8677f546e204d7a0e5f53d87eeeb2349a1886
5
5
  SHA512:
6
- metadata.gz: efed3e028c80c4cbd0f694c5b739637fcf6277b71c95549f2cde0e3d278b09224e267d29098091cecfad8b792411f8f38edae48000f379a4b2fc2e88aef9fffc
7
- data.tar.gz: d6d92ec1ed4dac56c90367d0e499d5f0b3be992bef29291502dc470d8b9c12274c19331062fe6ad22898c1ece0261bbf2c392c9416dd5520058575f2675c6ff6
6
+ metadata.gz: 74aaaced1816ab4ef2270284013e9101a48a4d9d3a74b151f6075b787a16870f31b5b212113c6f2c7dadd2fa1b82a0b22d73360d4972a867a58c91cb42310dee
7
+ data.tar.gz: 26246a45258074c3a78b9cf817cf32ff9c15760ab3906485067223b7fa21446cb036d5b3d4e6a1f50bf0ffa1ecee62fe1f028213ae0f89429fe66c7be728bf6d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mistral-ai (1.1.0)
4
+ mistral-ai (1.1.1)
5
5
  event_stream_parser (~> 1.0)
6
6
  faraday (~> 2.8, >= 2.8.1)
7
7
 
@@ -22,7 +22,7 @@ GEM
22
22
  language_server-protocol (3.17.0.3)
23
23
  method_source (1.0.0)
24
24
  parallel (1.24.0)
25
- parser (3.2.2.4)
25
+ parser (3.3.0.0)
26
26
  ast (~> 2.4.1)
27
27
  racc
28
28
  pry (0.14.2)
data/README.md CHANGED
@@ -9,7 +9,7 @@ A Ruby gem for interacting with [Mistral AI](https://mistral.ai)'s large languag
9
9
  ## TL;DR and Quick Start
10
10
 
11
11
  ```ruby
12
- gem 'mistral-ai', '~> 1.1.0'
12
+ gem 'mistral-ai', '~> 1.1.1'
13
13
  ```
14
14
 
15
15
  ```ruby
@@ -85,11 +85,11 @@ Result:
85
85
  ### Installing
86
86
 
87
87
  ```sh
88
- gem install mistral-ai -v 1.1.0
88
+ gem install mistral-ai -v 1.1.1
89
89
  ```
90
90
 
91
91
  ```sh
92
- gem 'mistral-ai', '~> 1.1.0'
92
+ gem 'mistral-ai', '~> 1.1.1'
93
93
  ```
94
94
 
95
95
  ### Credentials
@@ -410,7 +410,8 @@ Mistral may launch a new endpoint that we haven't covered in the Gem yet. If tha
410
410
  result = client.request(
411
411
  'v1/chat/completions',
412
412
  { model: 'mistral-medium',
413
- messages: [{ role: 'user', content: 'hi!' }] }
413
+ messages: [{ role: 'user', content: 'hi!' }] },
414
+ request_method: 'POST', server_sent_events: true
414
415
  )
415
416
  ```
416
417
 
@@ -494,7 +495,6 @@ MistralError
494
495
 
495
496
  MissingAPIKeyError
496
497
  BlockWithoutServerSentEventsError
497
- UnsupportedError
498
498
 
499
499
  RequestError
500
500
  ```
@@ -517,7 +517,7 @@ gem build mistral-ai.gemspec
517
517
 
518
518
  gem signin
519
519
 
520
- gem push mistral-ai-1.1.0.gem
520
+ gem push mistral-ai-1.1.1.gem
521
521
  ```
522
522
 
523
523
  ### Updating the README
data/components/errors.rb CHANGED
@@ -10,7 +10,6 @@ module Mistral
10
10
 
11
11
  class MissingAPIKeyError < MistralError; end
12
12
  class BlockWithoutServerSentEventsError < MistralError; end
13
- class UnsupportedError < MistralError; end
14
13
 
15
14
  class RequestError < MistralError
16
15
  attr_reader :request, :payload
@@ -51,7 +51,7 @@ module Mistral
51
51
  request('v1/models', nil, server_sent_events: false, request_method: 'GET', &callback)
52
52
  end
53
53
 
54
- def request(path, payload, server_sent_events: nil, request_method: 'POST', &callback)
54
+ def request(path, payload = nil, server_sent_events: nil, request_method: 'POST', &callback)
55
55
  server_sent_events_enabled = server_sent_events.nil? ? @server_sent_events : server_sent_events
56
56
  url = "#{@address}#{path}"
57
57
 
@@ -62,7 +62,7 @@ module Mistral
62
62
 
63
63
  results = []
64
64
 
65
- method_to_call = request_method == 'POST' ? :post : :get
65
+ method_to_call = request_method.to_s.strip.downcase.to_sym
66
66
 
67
67
  response = Faraday.new(request: @request_options) do |faraday|
68
68
  faraday.response :raise_error
@@ -114,7 +114,7 @@ module Mistral
114
114
  end
115
115
 
116
116
  def safe_parse_json(raw)
117
- raw.start_with?('{', '[') ? JSON.parse(raw) : raw
117
+ raw.to_s.lstrip.start_with?('{', '[') ? JSON.parse(raw) : raw
118
118
  rescue JSON::ParserError
119
119
  raw
120
120
  end
data/static/gem.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  module Mistral
4
4
  GEM = {
5
5
  name: 'mistral-ai',
6
- version: '1.1.0',
6
+ version: '1.1.1',
7
7
  author: 'gbaptista',
8
8
  summary: 'Interact with Mistral AI.',
9
9
  description: "A Ruby gem for interacting with Mistral AI's large language models.",
data/template.md CHANGED
@@ -9,7 +9,7 @@ A Ruby gem for interacting with [Mistral AI](https://mistral.ai)'s large languag
9
9
  ## TL;DR and Quick Start
10
10
 
11
11
  ```ruby
12
- gem 'mistral-ai', '~> 1.1.0'
12
+ gem 'mistral-ai', '~> 1.1.1'
13
13
  ```
14
14
 
15
15
  ```ruby
@@ -55,11 +55,11 @@ Result:
55
55
  ### Installing
56
56
 
57
57
  ```sh
58
- gem install mistral-ai -v 1.1.0
58
+ gem install mistral-ai -v 1.1.1
59
59
  ```
60
60
 
61
61
  ```sh
62
- gem 'mistral-ai', '~> 1.1.0'
62
+ gem 'mistral-ai', '~> 1.1.1'
63
63
  ```
64
64
 
65
65
  ### Credentials
@@ -380,7 +380,8 @@ Mistral may launch a new endpoint that we haven't covered in the Gem yet. If tha
380
380
  result = client.request(
381
381
  'v1/chat/completions',
382
382
  { model: 'mistral-medium',
383
- messages: [{ role: 'user', content: 'hi!' }] }
383
+ messages: [{ role: 'user', content: 'hi!' }] },
384
+ request_method: 'POST', server_sent_events: true
384
385
  )
385
386
  ```
386
387
 
@@ -464,7 +465,6 @@ MistralError
464
465
 
465
466
  MissingAPIKeyError
466
467
  BlockWithoutServerSentEventsError
467
- UnsupportedError
468
468
 
469
469
  RequestError
470
470
  ```
@@ -487,7 +487,7 @@ gem build mistral-ai.gemspec
487
487
 
488
488
  gem signin
489
489
 
490
- gem push mistral-ai-1.1.0.gem
490
+ gem push mistral-ai-1.1.1.gem
491
491
  ```
492
492
 
493
493
  ### Updating the README
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mistral-ai
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - gbaptista
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-29 00:00:00.000000000 Z
11
+ date: 2024-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: event_stream_parser
@@ -88,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  requirements: []
91
- rubygems_version: 3.4.22
91
+ rubygems_version: 3.3.3
92
92
  signing_key:
93
93
  specification_version: 4
94
94
  summary: Interact with Mistral AI.