strongmind-platform-sdk 3.26.20 → 3.26.21

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: fe19acc463ab51338600a018634c09307ad3d488fa6af6b93503ead8fb893738
4
- data.tar.gz: 6d2f80173459c0f0b4df787c05c1471493394366446a186f3cfec11b138219a1
3
+ metadata.gz: 9bf954ff38af3f4ea2265c5b1130138130d7122e9bd2253c17f7b8ae1317dc14
4
+ data.tar.gz: 40acedd434a8a09742f30a597a6d084f257a536fa886b1aabe123627785e3ad3
5
5
  SHA512:
6
- metadata.gz: ced6a264d77d7fb918bb39684a21ff44e67aebfe87a51dee95d0e341d1ae9c958410d431822ce5a896a3fc1f50bc4a81c16d4eedc255b931b4ff9560d37d7d5d
7
- data.tar.gz: 728fb45330b056137e0d9dddec4805e3fb558985dcfac613562ee865c7a275b33c7ddd579908c073aeb84fdbd6c1b30fe37c1b1c5342cff93ca6b34e61d85ff6
6
+ metadata.gz: fcfda3a8756c2814ec1800adc35bed5b8a449a07a1d390e7cb8ef99de40657d03d1ac5e47191138392511485d255dec08de5660980e155078daa79799da3d8c6
7
+ data.tar.gz: 03e3d406908aa3ce885bb4c76c2c8265b727958d409e37860957ce40e852f559dad4b60c758bf04e27582a73e60d6d33e030060fb77c00e07dd6c04d81afe714
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PlatformSdk
4
+ module LlmGateway
5
+ class Client
6
+ def initialize(base_url:, api_key:, timeout: 30, conn: nil)
7
+ @connection = conn || Faraday.new(url: base_url) do |f|
8
+ f.request :json
9
+ f.request :retry, max: 2, interval: 0.5, backoff_factor: 2,
10
+ exceptions: [Faraday::TimeoutError, Faraday::ConnectionFailed]
11
+ f.response :json
12
+ f.adapter Faraday.default_adapter
13
+ f.headers["Authorization"] = "Bearer #{api_key}"
14
+ f.options.timeout = timeout
15
+ f.options.open_timeout = timeout
16
+ end
17
+ end
18
+
19
+ def score_response(question_content:, grading_rubric:, max_score:, min_score:, student_response:)
20
+ response = @connection.post("assessments/grade") do |req|
21
+ req.body = {
22
+ question_content:,
23
+ grading_rubric:,
24
+ max_score:,
25
+ min_score:,
26
+ student_response:
27
+ }
28
+ end
29
+
30
+ handle_response(response)
31
+ rescue Faraday::TimeoutError => e
32
+ raise NetworkError, "Request timeout: #{e.message}"
33
+ rescue Faraday::ConnectionFailed => e
34
+ raise NetworkError, "Connection failed: #{e.message}"
35
+ end
36
+
37
+ private
38
+
39
+ def handle_response(response)
40
+ case response.status
41
+ when 200..299 then response.body
42
+ when 401 then raise AuthenticationError, "Authentication failed"
43
+ when 422 then raise Error, "Validation error: #{response.body}"
44
+ when 503 then raise ServiceUnavailableError, "LLM Gateway service unavailable"
45
+ else
46
+ detail = response.body.is_a?(Hash) ? response.body["detail"] : nil
47
+ raise Error, "LLM Gateway error (#{response.status}): #{detail || "Unknown error"}"
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "platform_sdk/llm_gateway/client"
4
+
5
+ module PlatformSdk
6
+ module LlmGateway
7
+ class Error < StandardError; end
8
+ class NetworkError < Error; end
9
+ class AuthenticationError < Error; end
10
+ class ServiceUnavailableError < Error; end
11
+ end
12
+ end
@@ -3,7 +3,7 @@
3
3
  module PlatformSdk
4
4
  MAJOR = 3
5
5
  MINOR = 26
6
- PATCH = 20
6
+ PATCH = 21
7
7
 
8
8
  VERSION = "#{PlatformSdk::MAJOR}.#{PlatformSdk::MINOR}.#{PlatformSdk::PATCH}"
9
9
  end
data/lib/platform_sdk.rb CHANGED
@@ -26,6 +26,7 @@ require "platform_sdk/sidekiq"
26
26
  require "platform_sdk/jobs/send_noun_to_pipeline_job"
27
27
  require "platform_sdk/jira"
28
28
  require "platform_sdk/catalog_manager"
29
+ require "platform_sdk/llm_gateway"
29
30
 
30
31
  module PlatformSdk
31
32
  class Error < StandardError; end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: strongmind-platform-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.26.20
4
+ version: 3.26.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Platform Team
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-10-30 00:00:00.000000000 Z
11
+ date: 2026-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -282,6 +282,8 @@ files:
282
282
  - lib/platform_sdk/jobs/send_noun_to_pipeline_job.rb
283
283
  - lib/platform_sdk/learnosity_api.rb
284
284
  - lib/platform_sdk/learnosity_api/client.rb
285
+ - lib/platform_sdk/llm_gateway.rb
286
+ - lib/platform_sdk/llm_gateway/client.rb
285
287
  - lib/platform_sdk/one_roster.rb
286
288
  - lib/platform_sdk/one_roster/client.rb
287
289
  - lib/platform_sdk/ops_genie.rb