omniai-mistral 1.7.0 → 1.8.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: d6fdad55d7cfc5b9d1845a8ec2d64772e2af5cc3d74d31b3d746732bc7509b15
4
- data.tar.gz: d31338fb81948d32cb0937a5d206bd9393a92c4fb43523477a1508941e7f2c09
3
+ metadata.gz: fb5f5848e6da37687394fb93cea91e5aeae526b4c64966acffa4b501d76b8942
4
+ data.tar.gz: e49f65cc5cdf0ec56bd6dd849895ed65ca9483fc4935d316f549cc160786c476
5
5
  SHA512:
6
- metadata.gz: 2282359b0e6fcd610c1d73b7b9a236371196014458aea74585231de83a3697194879d3917b9f64b8ed5c7fabaab3a9a5f1405b849a5e891e55f7308a8143f2b4
7
- data.tar.gz: 5358665adf78efed8c92f9e52f3b2854cd23fe6f82598c2639b25b707252906c798bf46250e6f6ec7d1b2c6d39822439497216063f6e398f22470d16c5c088e9
6
+ metadata.gz: 05ad9682c87336ed1cfd5be74a1d72559ffd1c04637c5868478d31aabe6105a610d0d9b0101e9ee9643331687d0042250be5c75fa6ffa0046d43cbca3543364e
7
+ data.tar.gz: 4a94d1ebe7f89403f3752242cbb175d8b8b08a4f6aeb910a4f71435aef4a956a2d869a86b86277da58da871b10a08eff2e510469c06c48cecbc9d64634c794d7
data/README.md CHANGED
@@ -42,7 +42,7 @@ A chat completion is generated by passing in prompts using any a variety of form
42
42
 
43
43
  ```ruby
44
44
  completion = client.chat('Tell me a joke!')
45
- completion.choice.message.content # 'Why did the chicken cross the road? To get to the other side.'
45
+ completion.text # 'Why did the chicken cross the road? To get to the other side.'
46
46
  ```
47
47
 
48
48
  ```ruby
@@ -50,7 +50,7 @@ completion = client.chat do |prompt|
50
50
  prompt.system('You are a helpful assistant.')
51
51
  prompt.user('What is the capital of Canada?')
52
52
  end
53
- completion.choice.message.content # 'The capital of Canada is Ottawa.'
53
+ completion.text # 'The capital of Canada is Ottawa.'
54
54
  ```
55
55
 
56
56
  #### Model
@@ -59,7 +59,7 @@ completion.choice.message.content # 'The capital of Canada is Ottawa.'
59
59
 
60
60
  ```ruby
61
61
  completion = client.chat('Provide code for fibonacci', model: OmniAI::Mistral::Chat::Model::CODESTRAL)
62
- completion.choice.message.content # 'def fibonacci(n)...end'
62
+ completion.text # 'def fibonacci(n)...end'
63
63
  ```
64
64
 
65
65
  [Mistral API Reference `model`](https://docs.mistral.ai/getting-started/models/)
@@ -70,7 +70,7 @@ completion.choice.message.content # 'def fibonacci(n)...end'
70
70
 
71
71
  ```ruby
72
72
  completion = client.chat('Pick a number between 1 and 5', temperature: 1.0)
73
- completion.choice.message.content # '3'
73
+ completion.text # '3'
74
74
  ```
75
75
 
76
76
  [Mistral API Reference `temperature`](https://docs.mistral.ai/api/)
@@ -81,7 +81,7 @@ completion.choice.message.content # '3'
81
81
 
82
82
  ```ruby
83
83
  stream = proc do |chunk|
84
- print(chunk.choice.delta.content) # 'Better', 'three', 'hours', ...
84
+ print(chunk.text) # 'Better', 'three', 'hours', ...
85
85
  end
86
86
  client.chat('Be poetic.', stream:)
87
87
  ```
@@ -97,7 +97,7 @@ completion = client.chat(format: :json) do |prompt|
97
97
  prompt.system(OmniAI::Chat::JSON_PROMPT)
98
98
  prompt.user('What is the name of the drummer for the Beatles?')
99
99
  end
100
- JSON.parse(completion.choice.message.content) # { "name": "Ringo" }
100
+ JSON.parse(completion.text) # { "name": "Ringo" }
101
101
  ```
102
102
 
103
103
  [Mistral API Reference `response_format`](https://docs.mistral.ai/api/)
@@ -19,7 +19,7 @@ module OmniAI
19
19
  CODESTRAL = 'codestral-latest'
20
20
  end
21
21
 
22
- DEFAULT_MODEL = Model::MEDIUM
22
+ DEFAULT_MODEL = Model::LARGE
23
23
 
24
24
  module Role
25
25
  ASSISTANT = 'assistant'
@@ -39,7 +39,7 @@ module OmniAI
39
39
  stream: @stream.nil? ? nil : !@stream.nil?,
40
40
  temperature: @temperature,
41
41
  response_format: (JSON_RESPONSE_FORMAT if @format.eql?(:json)),
42
- tools: @tools&.map(&:prepare),
42
+ tools: (@tools.map(&:serialize) if @tools&.any?),
43
43
  }).compact
44
44
  end
45
45
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module OmniAI
4
4
  module Mistral
5
- VERSION = '1.7.0'
5
+ VERSION = '1.8.1'
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.7.0
4
+ version: 1.8.1
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-08-02 00:00:00.000000000 Z
11
+ date: 2024-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: event_stream_parser