mistral_translator 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.env.example +3 -0
- data/CHANGELOG.md +16 -0
- data/README.md +11 -7
- data/docs/api-reference/configuration.md +1 -1
- data/docs/api-reference/methods.md +1 -1
- data/docs/installation.md +1 -1
- data/lib/mistral_translator/configuration.rb +3 -2
- data/lib/mistral_translator/version.rb +2 -2
- metadata +4 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 278978acb1df0d447293200f13ff58745640a62f5bf43a41ebc7b31db2d50b98
|
|
4
|
+
data.tar.gz: c86fc021d49a554fd4d44883e1383a5ea4ba82251074b4b358b3b5cf97f27fd2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ca6e0c3b2e2346ab8432dfc24080adcb994f75df453111851d6f8441465d09107d59216fc84efc1f84acf823a4a4ec284c5d1b1212c8ceda9a3d8861e95a2208
|
|
7
|
+
data.tar.gz: 39b55072eb24870acd861b8c7ec7c8aa279a9f7b03b4a84f0cdabd4982c2d9f04da1b39b2eea05024d6e3a2c1bc7737ee95557f0eaa588c61ec3fbc5d04af540
|
data/.env.example
ADDED
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [0.3.1] - 2026-10-27
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- Default model is now `mistral-small-latest`. Mistral retired the `mistral-small` name, so every call without an explicit `config.model` failed with a 404. The alias follows the current Mistral Small version; set `config.model` to pin one.
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- `bin/check_api`: checks the API key and the default model, then runs the examples against the real API when the plan allows generation. The key is read from `MISTRAL_TEST_API_KEY`, `.env`, or a hidden prompt, and never printed.
|
|
12
|
+
- Weekly workflow running `bin/check_api`, which opens an issue on failure.
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
|
|
16
|
+
- CI: a single workflow, RuboCop plus the test suite on Ruby 3.2, 3.3, 3.4 and 4.0.
|
|
17
|
+
- The test suite no longer prints part of the API key, and no longer deletes VCR cassettes after each run.
|
|
18
|
+
|
|
3
19
|
## [0.3.0] - 2025-12-09
|
|
4
20
|
|
|
5
21
|
### Added
|
data/README.md
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Ruby gem for AI-powered translation and text summarization using Mistral AI API, with advanced Rails support.
|
|
4
4
|
|
|
5
|
-
[](https://rubygems.org/gems/mistral_translator)
|
|
6
|
+
[](https://rubygems.org/gems/mistral_translator)
|
|
7
|
+
[](https://github.com/Peyochanchan/mistral_translator/actions/workflows/ci.yml)
|
|
8
|
+
[](https://github.com/Peyochanchan/mistral_translator/actions/workflows/weekly-api-check.yml)
|
|
9
|
+
[](LICENSE.txt)
|
|
10
10
|
|
|
11
11
|
## Quick Start
|
|
12
12
|
|
|
@@ -159,7 +159,7 @@ MistralTranslator.configure do |config|
|
|
|
159
159
|
config.api_key = ENV['MISTRAL_API_KEY']
|
|
160
160
|
|
|
161
161
|
# Optional
|
|
162
|
-
config.model = "mistral-small"
|
|
162
|
+
config.model = "mistral-small-latest" # AI model to use (an alias that follows the current Mistral Small)
|
|
163
163
|
config.retry_delays = [1, 2, 4, 8, 16] # Retry delays in seconds
|
|
164
164
|
config.enable_metrics = true # Enable performance metrics
|
|
165
165
|
|
|
@@ -233,7 +233,7 @@ The complete documentation includes:
|
|
|
233
233
|
## Requirements
|
|
234
234
|
|
|
235
235
|
- Ruby 3.2+
|
|
236
|
-
- Mistral AI API key
|
|
236
|
+
- Mistral AI API key, on a plan with API access (Mistral's free plan cannot generate text)
|
|
237
237
|
- Rails 6.0+ (optional, for Rails integration features)
|
|
238
238
|
|
|
239
239
|
## Testing
|
|
@@ -247,6 +247,10 @@ bundle exec rspec spec/mistral_translator/
|
|
|
247
247
|
|
|
248
248
|
# Run all tests with documentation format
|
|
249
249
|
bundle exec rspec --format documentation
|
|
250
|
+
|
|
251
|
+
# Check the API key and default model, then run the examples against the real
|
|
252
|
+
# API (reads MISTRAL_TEST_API_KEY, .env or asks for the key, never prints it)
|
|
253
|
+
bin/check_api
|
|
250
254
|
```
|
|
251
255
|
|
|
252
256
|
### Integration Tests
|
|
@@ -11,7 +11,7 @@ Référence complète des options de configuration.
|
|
|
11
11
|
```ruby
|
|
12
12
|
MistralTranslator.configure do |config|
|
|
13
13
|
config.api_key = ENV['MISTRAL_API_KEY'] # Obligatoire
|
|
14
|
-
config.model = "mistral-small" # Défaut
|
|
14
|
+
config.model = "mistral-small-latest" # Défaut
|
|
15
15
|
config.api_url = "https://api.mistral.ai" # URL API
|
|
16
16
|
config.default_max_tokens = 4000 # Limite tokens
|
|
17
17
|
config.default_temperature = 0.3 # Créativité (0-1)
|
|
@@ -268,7 +268,7 @@ Configure la gem avec un bloc.
|
|
|
268
268
|
```ruby
|
|
269
269
|
MistralTranslator.configure do |config|
|
|
270
270
|
config.api_key = ENV['MISTRAL_API_KEY']
|
|
271
|
-
config.model = "mistral-small"
|
|
271
|
+
config.model = "mistral-small-latest"
|
|
272
272
|
config.retry_delays = [1, 2, 4, 8]
|
|
273
273
|
config.enable_metrics = true
|
|
274
274
|
end
|
data/docs/installation.md
CHANGED
|
@@ -76,7 +76,7 @@ end
|
|
|
76
76
|
```ruby
|
|
77
77
|
MistralTranslator.configure do |config|
|
|
78
78
|
config.api_key = ENV['MISTRAL_API_KEY']
|
|
79
|
-
config.model = "mistral-small" # Modèle par défaut
|
|
79
|
+
config.model = "mistral-small-latest" # Modèle par défaut
|
|
80
80
|
config.retry_delays = [2, 4, 8, 16] # Délais retry
|
|
81
81
|
config.enable_metrics = true # Suivi des stats
|
|
82
82
|
config.default_max_tokens = 4000 # Limite tokens
|
|
@@ -11,7 +11,7 @@ module MistralTranslator
|
|
|
11
11
|
def initialize
|
|
12
12
|
@api_key = nil
|
|
13
13
|
@api_url = "https://api.mistral.ai"
|
|
14
|
-
@model = "mistral-small"
|
|
14
|
+
@model = "mistral-small-latest"
|
|
15
15
|
@default_max_tokens = nil
|
|
16
16
|
@default_temperature = nil
|
|
17
17
|
@retry_delays = [2, 4, 8, 16, 32, 64, 128, 256, 512, 1024]
|
|
@@ -110,7 +110,8 @@ module MistralTranslator
|
|
|
110
110
|
@metrics_mutex.synchronize do
|
|
111
111
|
@metrics.merge({
|
|
112
112
|
average_translation_time: if @metrics[:total_translations].positive?
|
|
113
|
-
(@metrics[:total_duration] /
|
|
113
|
+
(@metrics[:total_duration] /
|
|
114
|
+
@metrics[:total_translations]).round(3)
|
|
114
115
|
else
|
|
115
116
|
0
|
|
116
117
|
end,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module MistralTranslator
|
|
4
|
-
VERSION = "0.3.
|
|
4
|
+
VERSION = "0.3.1"
|
|
5
5
|
|
|
6
6
|
# Informations additionnelles sur la gem
|
|
7
7
|
API_VERSION = "v1"
|
|
8
|
-
SUPPORTED_MODEL = "mistral-small"
|
|
8
|
+
SUPPORTED_MODEL = "mistral-small-latest"
|
|
9
9
|
|
|
10
10
|
# Méthode pour obtenir des informations complètes sur la version
|
|
11
11
|
def self.version_info
|
metadata
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mistral_translator
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
|
-
-
|
|
7
|
+
- Pierre Cherbero
|
|
8
8
|
bindir: exe
|
|
9
9
|
cert_chain: []
|
|
10
10
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
@@ -117,6 +117,7 @@ executables: []
|
|
|
117
117
|
extensions: []
|
|
118
118
|
extra_rdoc_files: []
|
|
119
119
|
files:
|
|
120
|
+
- ".env.example"
|
|
120
121
|
- ".rspec"
|
|
121
122
|
- ".rubocop.yml"
|
|
122
123
|
- ".ruby-version"
|
|
@@ -196,7 +197,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
196
197
|
- !ruby/object:Gem::Version
|
|
197
198
|
version: '0'
|
|
198
199
|
requirements: []
|
|
199
|
-
rubygems_version:
|
|
200
|
+
rubygems_version: 4.0.5
|
|
200
201
|
specification_version: 4
|
|
201
202
|
summary: Gem to translate and summarize text with Mistral API
|
|
202
203
|
test_files: []
|