mistral-ai 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +44 -4
- data/controllers/client.rb +11 -5
- data/static/gem.rb +1 -1
- data/template.md +43 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a5a4440552277c82714d8e396bd842688a82bdc0d620d71a2783e51111e122ea
|
4
|
+
data.tar.gz: 1bcd20702986e71433cfeb3bb61970af0bc87da6a2274d1b89dd85c8f118dff0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: efed3e028c80c4cbd0f694c5b739637fcf6277b71c95549f2cde0e3d278b09224e267d29098091cecfad8b792411f8f38edae48000f379a4b2fc2e88aef9fffc
|
7
|
+
data.tar.gz: d6d92ec1ed4dac56c90367d0e499d5f0b3be992bef29291502dc470d8b9c12274c19331062fe6ad22898c1ece0261bbf2c392c9416dd5520058575f2675c6ff6
|
data/Gemfile.lock
CHANGED
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.
|
12
|
+
gem 'mistral-ai', '~> 1.1.0'
|
13
13
|
```
|
14
14
|
|
15
15
|
```ruby
|
@@ -61,6 +61,7 @@ Result:
|
|
61
61
|
- [Without Streaming Events](#without-streaming-events)
|
62
62
|
- [Receiving Stream Events](#receiving-stream-events)
|
63
63
|
- [embeddings](#embeddings)
|
64
|
+
- [models](#models)
|
64
65
|
- [Streaming and Server-Sent Events (SSE)](#streaming-and-server-sent-events-sse)
|
65
66
|
- [Server-Sent Events (SSE) Hang](#server-sent-events-sse-hang)
|
66
67
|
- [System Messages](#system-messages)
|
@@ -84,11 +85,11 @@ Result:
|
|
84
85
|
### Installing
|
85
86
|
|
86
87
|
```sh
|
87
|
-
gem install mistral-ai -v 1.
|
88
|
+
gem install mistral-ai -v 1.1.0
|
88
89
|
```
|
89
90
|
|
90
91
|
```sh
|
91
|
-
gem 'mistral-ai', '~> 1.
|
92
|
+
gem 'mistral-ai', '~> 1.1.0'
|
92
93
|
```
|
93
94
|
|
94
95
|
### Credentials
|
@@ -270,6 +271,45 @@ Result:
|
|
270
271
|
|
271
272
|
```
|
272
273
|
|
274
|
+
#### models
|
275
|
+
|
276
|
+
```ruby
|
277
|
+
result = client.models
|
278
|
+
```
|
279
|
+
|
280
|
+
Result:
|
281
|
+
```ruby
|
282
|
+
{ 'object' => 'list',
|
283
|
+
'data' =>
|
284
|
+
[{ 'id' => 'mistral-medium',
|
285
|
+
'object' => 'model',
|
286
|
+
'created' => 1_703_855_983,
|
287
|
+
'owned_by' => 'mistralai',
|
288
|
+
'root' => nil,
|
289
|
+
'parent' => nil,
|
290
|
+
'permission' =>
|
291
|
+
[{ 'id' => 'modelperm-30...',
|
292
|
+
'object' => 'model_permission',
|
293
|
+
'created' => 1_703_855_983,
|
294
|
+
'allow_create_engine' => false,
|
295
|
+
'allow_sampling' => true,
|
296
|
+
'allow_logprobs' => false,
|
297
|
+
'allow_search_indices' => false,
|
298
|
+
'allow_view' => true,
|
299
|
+
'allow_fine_tuning' => false,
|
300
|
+
'organization' => '*',
|
301
|
+
'group' => nil,
|
302
|
+
'is_blocking' => false }] },
|
303
|
+
{ 'id' => 'mistral-small',
|
304
|
+
'object' => 'model',
|
305
|
+
'created' => 1_703_855_983,
|
306
|
+
'owned_by' => 'mistralai',
|
307
|
+
# ...
|
308
|
+
},
|
309
|
+
# ...
|
310
|
+
] }
|
311
|
+
```
|
312
|
+
|
273
313
|
### Streaming and Server-Sent Events (SSE)
|
274
314
|
|
275
315
|
[Server-Sent Events (SSE)](https://en.wikipedia.org/wiki/Server-sent_events) is a technology that allows certain endpoints to offer streaming capabilities, such as creating the impression that "the model is typing along with you," rather than delivering the entire answer all at once.
|
@@ -477,7 +517,7 @@ gem build mistral-ai.gemspec
|
|
477
517
|
|
478
518
|
gem signin
|
479
519
|
|
480
|
-
gem push mistral-ai-1.
|
520
|
+
gem push mistral-ai-1.1.0.gem
|
481
521
|
```
|
482
522
|
|
483
523
|
### Updating the README
|
data/controllers/client.rb
CHANGED
@@ -43,13 +43,17 @@ module Mistral
|
|
43
43
|
request('v1/chat/completions', payload, server_sent_events:, &callback)
|
44
44
|
end
|
45
45
|
|
46
|
-
def embeddings(payload,
|
46
|
+
def embeddings(payload, _server_sent_events: nil, &callback)
|
47
47
|
request('v1/embeddings', payload, server_sent_events: false, &callback)
|
48
48
|
end
|
49
49
|
|
50
|
-
def
|
50
|
+
def models(_server_sent_events: nil, &callback)
|
51
|
+
request('v1/models', nil, server_sent_events: false, request_method: 'GET', &callback)
|
52
|
+
end
|
53
|
+
|
54
|
+
def request(path, payload, server_sent_events: nil, request_method: 'POST', &callback)
|
51
55
|
server_sent_events_enabled = server_sent_events.nil? ? @server_sent_events : server_sent_events
|
52
|
-
url = "#{@address}
|
56
|
+
url = "#{@address}#{path}"
|
53
57
|
|
54
58
|
if !callback.nil? && !server_sent_events_enabled
|
55
59
|
raise BlockWithoutServerSentEventsError,
|
@@ -58,15 +62,17 @@ module Mistral
|
|
58
62
|
|
59
63
|
results = []
|
60
64
|
|
65
|
+
method_to_call = request_method == 'POST' ? :post : :get
|
66
|
+
|
61
67
|
response = Faraday.new(request: @request_options) do |faraday|
|
62
68
|
faraday.response :raise_error
|
63
|
-
end.
|
69
|
+
end.send(method_to_call) do |request|
|
64
70
|
request.url url
|
65
71
|
request.headers['Content-Type'] = 'application/json'
|
66
72
|
|
67
73
|
request.headers['Authorization'] = "Bearer #{@api_key}" unless @api_key.nil?
|
68
74
|
|
69
|
-
request.body = payload.to_json
|
75
|
+
request.body = payload.to_json unless payload.nil?
|
70
76
|
|
71
77
|
if server_sent_events_enabled
|
72
78
|
parser = EventStreamParser::Parser.new
|
data/static/gem.rb
CHANGED
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.
|
12
|
+
gem 'mistral-ai', '~> 1.1.0'
|
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.
|
58
|
+
gem install mistral-ai -v 1.1.0
|
59
59
|
```
|
60
60
|
|
61
61
|
```sh
|
62
|
-
gem 'mistral-ai', '~> 1.
|
62
|
+
gem 'mistral-ai', '~> 1.1.0'
|
63
63
|
```
|
64
64
|
|
65
65
|
### Credentials
|
@@ -241,6 +241,45 @@ Result:
|
|
241
241
|
|
242
242
|
```
|
243
243
|
|
244
|
+
#### models
|
245
|
+
|
246
|
+
```ruby
|
247
|
+
result = client.models
|
248
|
+
```
|
249
|
+
|
250
|
+
Result:
|
251
|
+
```ruby
|
252
|
+
{ 'object' => 'list',
|
253
|
+
'data' =>
|
254
|
+
[{ 'id' => 'mistral-medium',
|
255
|
+
'object' => 'model',
|
256
|
+
'created' => 1_703_855_983,
|
257
|
+
'owned_by' => 'mistralai',
|
258
|
+
'root' => nil,
|
259
|
+
'parent' => nil,
|
260
|
+
'permission' =>
|
261
|
+
[{ 'id' => 'modelperm-30...',
|
262
|
+
'object' => 'model_permission',
|
263
|
+
'created' => 1_703_855_983,
|
264
|
+
'allow_create_engine' => false,
|
265
|
+
'allow_sampling' => true,
|
266
|
+
'allow_logprobs' => false,
|
267
|
+
'allow_search_indices' => false,
|
268
|
+
'allow_view' => true,
|
269
|
+
'allow_fine_tuning' => false,
|
270
|
+
'organization' => '*',
|
271
|
+
'group' => nil,
|
272
|
+
'is_blocking' => false }] },
|
273
|
+
{ 'id' => 'mistral-small',
|
274
|
+
'object' => 'model',
|
275
|
+
'created' => 1_703_855_983,
|
276
|
+
'owned_by' => 'mistralai',
|
277
|
+
# ...
|
278
|
+
},
|
279
|
+
# ...
|
280
|
+
] }
|
281
|
+
```
|
282
|
+
|
244
283
|
### Streaming and Server-Sent Events (SSE)
|
245
284
|
|
246
285
|
[Server-Sent Events (SSE)](https://en.wikipedia.org/wiki/Server-sent_events) is a technology that allows certain endpoints to offer streaming capabilities, such as creating the impression that "the model is typing along with you," rather than delivering the entire answer all at once.
|
@@ -448,7 +487,7 @@ gem build mistral-ai.gemspec
|
|
448
487
|
|
449
488
|
gem signin
|
450
489
|
|
451
|
-
gem push mistral-ai-1.
|
490
|
+
gem push mistral-ai-1.1.0.gem
|
452
491
|
```
|
453
492
|
|
454
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.
|
4
|
+
version: 1.1.0
|
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-
|
11
|
+
date: 2023-12-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: event_stream_parser
|