open_router 0.3.0 → 0.3.2

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: 3f81b52efb709758f501e3e43fd3967d36a0cde6b78aefd2512b21aafa0f3f5d
4
- data.tar.gz: 347a0b754f0ed374ab6bdb0847e8efe1f762370c4c4e7b1faf1e3a7813dece10
3
+ metadata.gz: cab34108ce9291cf0d6062d8913a4c8d45a5b3821508ef9fffcd6ff218cdada4
4
+ data.tar.gz: 2c24c6436e6eab3a6cc203ab21b1b9fedae7273c488902da34cb1e05e4b781ad
5
5
  SHA512:
6
- metadata.gz: 64d714806a4cda2841d1310357db4a8ed2737a064530676f484fe4213d2dfc863e6143b159915f57177f33448ca03585b953b164cb0825929d426ec2beeb30ba
7
- data.tar.gz: a0fe64e1d6dcc790c478fa888f5b1db43edaec01001ca5f6903481042fb41a65d8808951d78bc49904797074620e8fdbb9616ffedcb8b1be2c0a1ee667b2de55
6
+ metadata.gz: a3b60c517311854d3a3ad85291f2c7cc2243d2b095e4dd75fe73873bf8b0e48d08643c41f1f65d7e4343b9e1dd85d7744e1c8c707823e1f76af112fd6834da8a
7
+ data.tar.gz: 5eb97536517e42a08eb8c151eaf1d3c036ee966c09fdbf73142143bd9d370c1d58edcc66fbbb35e092dad60f087498b13a6de5b4934cd332013607c6fcce9b74
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- open_router (0.2.2)
4
+ open_router (0.3.2)
5
5
  activesupport (>= 6.0)
6
6
  dotenv (>= 2)
7
7
  faraday (>= 1)
@@ -42,9 +42,11 @@ module OpenRouter
42
42
  parameters.merge!(extras)
43
43
 
44
44
  post(path: "/chat/completions", parameters:).tap do |response|
45
- raise ServerError, "Empty response from OpenRouter. Might be worth retrying once or twice." if response.blank?
46
- raise ServerError, response.dig("error", "message") if response.dig("error", "message").present?
47
- end.with_indifferent_access
45
+ raise ServerError, response.dig("error", "message") if response.presence&.dig("error", "message").present?
46
+ raise ServerError, "Empty response from OpenRouter. Might be worth retrying once or twice." if stream.blank? && response.blank?
47
+
48
+ return response.with_indifferent_access if response.is_a?(Hash)
49
+ end
48
50
  end
49
51
 
50
52
  # Fetches the list of available models from the OpenRouter API.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OpenRouter
4
- VERSION = "0.3.0"
4
+ VERSION = "0.3.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: open_router
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Obie Fernandez
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-05-03 00:00:00.000000000 Z
11
+ date: 2024-05-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport