lara-sdk 1.9.1 → 1.10.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 370e00f8aea75a62aaa75afe314ccdac0917176902accfdeed31742b83cb1fdd
4
- data.tar.gz: 251d5fb842d8aae2a055fd3705ac1af73def99396b342610accc07224e3f0569
3
+ metadata.gz: 33000e4a2972ae2f98c8e9b2e307122e4d729d1e50e5d78325fde5d5b7d470b4
4
+ data.tar.gz: 11a9586abaf2b895fe0d7f50f04470c462b80f83c44ffb33a9a4c869c30bb4bb
5
5
  SHA512:
6
- metadata.gz: 006a24cc826bd26ddef6f73ff54f1721d8fa45f21358b51bab6a502c824ac2313f4c2ee38cc2ca8dd83952df8f961d8b9ce082aa6b0fb5e8c93867c9b5e978ce
7
- data.tar.gz: e48c25fc3d1207010b55051516e1c50b83532127fdc57cbd11752680a973348557e78b5345a70fa856e43913bfca0cd87d437004361611f8b4212a3e8857321d
6
+ metadata.gz: bab5b019aaab9736023be72456df455558afcc17dce5060792c6b4d8fe73a34c81065a86320614437a234792b6ca204ddddd3884049e0927e51d16d894eb3441
7
+ data.tar.gz: 0a5bd84f86a55cce9ab60930178411857cc84df2534d6b91deb5300ab0e9ff12bdc126a7e374458d83a64c7cd105dda4ba6852b4eac313b40852e528941d7158
@@ -5,10 +5,10 @@ require_relative "base"
5
5
  module Lara
6
6
  module Models
7
7
  class Glossary < Base
8
- attr_reader :id, :name, :owner_id, :created_at, :updated_at, :shared_at, :is_personal, :permission_mask
8
+ attr_reader :id, :name, :owner_id, :created_at, :updated_at, :shared_at, :permission_mask
9
9
 
10
10
  def initialize(id:, name:, owner_id:, created_at: nil, updated_at: nil, shared_at: nil,
11
- is_personal: nil, permission_mask: nil, **_kwargs)
11
+ permission_mask: nil, **_kwargs)
12
12
  super()
13
13
  @id = id
14
14
  @name = name
@@ -16,8 +16,6 @@ module Lara
16
16
  @created_at = Base.parse_time(created_at)
17
17
  @updated_at = Base.parse_time(updated_at)
18
18
  @shared_at = Base.parse_time(shared_at)
19
- # The API sends is_personal: true and omits the key otherwise; it never sends false or null.
20
- @is_personal = is_personal || false
21
19
  # Effective combined mask in GET list/detail; selected share's stored mask in GET /shares.
22
20
  # Nil when omitted, including non-GET responses.
23
21
  @permission_mask = permission_mask
@@ -6,11 +6,11 @@ module Lara
6
6
  module Models
7
7
  class Memory < Base
8
8
  attr_reader :id, :created_at, :updated_at, :name, :external_id, :secret,
9
- :owner_id, :collaborators_count, :shared_at, :is_personal, :permission_mask
9
+ :owner_id, :collaborators_count, :shared_at, :permission_mask
10
10
 
11
11
  def initialize(id:, name:, owner_id:, created_at: nil, updated_at: nil,
12
12
  external_id: nil, secret: nil, collaborators_count: nil, shared_at: nil,
13
- is_personal: nil, permission_mask: nil, **_kwargs)
13
+ permission_mask: nil, **_kwargs)
14
14
  super()
15
15
  @id = id
16
16
  @name = name
@@ -21,8 +21,6 @@ module Lara
21
21
  @secret = secret
22
22
  @collaborators_count = collaborators_count
23
23
  @shared_at = Base.parse_time(shared_at)
24
- # The API sends is_personal: true and omits the key otherwise; it never sends false or null.
25
- @is_personal = is_personal || false
26
24
  # Effective combined mask in GET list/detail; selected share's stored mask in GET /shares.
27
25
  # Nil when omitted, including non-GET responses.
28
26
  @permission_mask = permission_mask
@@ -115,10 +115,10 @@ module Lara
115
115
  end
116
116
 
117
117
  class Styleguide < Base
118
- attr_reader :id, :name, :content, :owner_id, :created_at, :updated_at, :shared_at, :is_personal, :permission_mask
118
+ attr_reader :id, :name, :content, :owner_id, :created_at, :updated_at, :shared_at, :permission_mask
119
119
 
120
120
  def initialize(id:, name:, content: nil, owner_id: nil, created_at: nil, updated_at: nil,
121
- shared_at: nil, is_personal: nil, permission_mask: nil, **_kwargs)
121
+ shared_at: nil, permission_mask: nil, **_kwargs)
122
122
  super()
123
123
  @id = id
124
124
  @name = name
@@ -127,8 +127,6 @@ module Lara
127
127
  @created_at = Base.parse_time(created_at)
128
128
  @updated_at = Base.parse_time(updated_at)
129
129
  @shared_at = Base.parse_time(shared_at)
130
- # The API sends is_personal: true and omits the key otherwise; it never sends false or null.
131
- @is_personal = is_personal || false
132
130
  # Effective combined mask in GET list/detail; selected share's stored mask in GET /shares.
133
131
  # Nil when omitted, including non-GET responses.
134
132
  @permission_mask = permission_mask
@@ -169,11 +167,73 @@ module Lara
169
167
  end
170
168
  end
171
169
 
170
+ class IntelligenceError < Base
171
+ attr_reader :status_code, :message
172
+
173
+ def initialize(status_code:, message:)
174
+ super()
175
+ @status_code = status_code
176
+ @message = message
177
+ end
178
+
179
+ def self.from_hash(hash)
180
+ return nil if hash.nil?
181
+
182
+ new(status_code: hash["statusCode"] || hash["status_code"], message: hash["message"])
183
+ end
184
+ end
185
+
186
+ class IntelligenceFailure < Base
187
+ attr_reader :applied, :error
188
+
189
+ def initialize(applied:, error:)
190
+ super()
191
+ @applied = applied
192
+ @error = IntelligenceError.from_hash(error)
193
+ end
194
+ end
195
+
196
+ # Applied is false or "partial" for reference retrieval failures.
197
+ class ReferenceRetrievalFailure < IntelligenceFailure
198
+ end
199
+
200
+ class ReasoningWarning < Base
201
+ attr_reader :code, :message
202
+
203
+ def initialize(code:, message:)
204
+ super()
205
+ @code = code
206
+ @message = message
207
+ end
208
+ end
209
+
210
+ class ReasoningFeedback < Base
211
+ attr_reader :applied, :error, :warnings
212
+
213
+ def initialize(applied:, error: nil, warnings: [])
214
+ super()
215
+ @applied = applied
216
+ @error = IntelligenceError.from_hash(error)
217
+ @warnings = warnings.map { |warning| ReasoningWarning.new(**warning.transform_keys(&:to_sym)) }
218
+ end
219
+ end
220
+
221
+ class TextWarnings < Base
222
+ attr_reader :reasoning, :references, :prosa
223
+
224
+ def initialize(reasoning: nil, references: nil, prosa: nil)
225
+ super()
226
+ @reasoning = ReasoningFeedback.new(**reasoning.transform_keys(&:to_sym)) if reasoning
227
+ @references = ReferenceRetrievalFailure.new(**references.transform_keys(&:to_sym)) if references
228
+ @prosa = IntelligenceFailure.new(**prosa.transform_keys(&:to_sym)) if prosa
229
+ end
230
+ end
231
+
172
232
  class TextResult < Base
173
233
  attr_reader :content_type, :source_language, :translation,
174
234
  :adapted_to, :glossaries,
175
235
  :adapted_to_matches, :glossaries_matches,
176
- :profanities, :styleguide_results
236
+ :profanities, :styleguide_results, :warnings
177
237
 
178
238
  def self.from_hash(hash)
179
239
  return nil unless hash.is_a?(Hash)
@@ -200,13 +260,14 @@ module Lara
200
260
  adapted_to_matches: adapted_to_matches,
201
261
  glossaries_matches: glossaries_matches,
202
262
  profanities: profanities,
203
- styleguide_results: styleguide_results
263
+ styleguide_results: styleguide_results,
264
+ warnings: hash["warnings"] && TextWarnings.new(**hash["warnings"].transform_keys(&:to_sym))
204
265
  )
205
266
  end
206
267
 
207
268
  def initialize(content_type:, source_language:, translation:, adapted_to: nil, glossaries: nil,
208
269
  adapted_to_matches: nil, glossaries_matches: nil, profanities: nil,
209
- styleguide_results: nil)
270
+ styleguide_results: nil, warnings: nil)
210
271
  super()
211
272
  @content_type = content_type
212
273
  @source_language = source_language
@@ -217,6 +278,7 @@ module Lara
217
278
  @glossaries_matches = glossaries_matches
218
279
  @profanities = profanities
219
280
  @styleguide_results = styleguide_results
281
+ @warnings = warnings
220
282
  end
221
283
 
222
284
  class << self
@@ -56,6 +56,8 @@ module Lara
56
56
  # @param verbose [Boolean]
57
57
  # @param style [String,nil]
58
58
  # @param reasoning [Boolean] When true with a block, yields partial results during reasoning
59
+ # @param image_context [Hash,Array<Hash>,nil] One HTTPS or base64 PNG/JPEG/WebP image; requires reasoning when non-empty.
60
+ # Image validation is performed by the API. An empty array preserves text-only translation.
59
61
  # @param headers [Hash,nil]
60
62
  # @param metadata [String, Hash, nil]
61
63
  # @param profanities_detect [String,nil] One of "target", "source_target"
@@ -65,7 +67,7 @@ module Lara
65
67
  def translate(text, target:, source: nil, source_hint: nil, adapt_to: nil, glossaries: nil,
66
68
  instructions: nil, content_type: nil, multiline: true, timeout_ms: nil,
67
69
  priority: nil, use_cache: nil, cache_ttl_s: nil, no_trace: false, verbose: false,
68
- style: nil, reasoning: false, headers: nil, metadata: nil,
70
+ style: nil, reasoning: false, image_context: nil, headers: nil, metadata: nil,
69
71
  profanities_detect: nil, profanities_handling: nil,
70
72
  styleguide_id: nil, styleguide_reasoning: nil,
71
73
  styleguide_explanation_language: nil, &callback)
@@ -94,6 +96,7 @@ module Lara
94
96
  verbose: verbose,
95
97
  style: style,
96
98
  reasoning: reasoning,
99
+ image_context: image_context,
97
100
  metadata: metadata,
98
101
  profanities_detect: profanities_detect,
99
102
  profanities_handling: profanities_handling,
data/lib/lara/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Lara
4
- VERSION = "1.9.1"
4
+ VERSION = "1.10.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lara-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.1
4
+ version: 1.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Translated
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-10-06 00:00:00.000000000 Z
11
+ date: 2026-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday