open_router 0.3.1 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/open_router/client.rb +3 -1
- data/lib/open_router/http.rb +3 -1
- data/lib/open_router/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1773f2cff533a7439d354cd4d9fa42214d643f3f20863afc4a7f5d7acf97afd3
|
4
|
+
data.tar.gz: 4cab37fcd901e07dcbdb126d25004f7d09a3da6b9e69ca5253369c775aedc6a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6db1bab41944573d6e848d4369e68da6a46987e5460efe8aac9e6fcdbfdf7133699a19e674cc5e95f3a635832d17d9838b9d13c81c7f10b76c7d8f894687118
|
7
|
+
data.tar.gz: d6b7696c301960da0f35cf342ac184b3c9d2f811fd84f56bab2b07e7682c4ca3165c2a89c1c69855afd04665592a7bfd99fc31b3165ef818670dbe207c122877
|
data/Gemfile.lock
CHANGED
data/lib/open_router/client.rb
CHANGED
@@ -44,7 +44,9 @@ module OpenRouter
|
|
44
44
|
post(path: "/chat/completions", parameters:).tap do |response|
|
45
45
|
raise ServerError, response.dig("error", "message") if response.presence&.dig("error", "message").present?
|
46
46
|
raise ServerError, "Empty response from OpenRouter. Might be worth retrying once or twice." if stream.blank? && response.blank?
|
47
|
-
|
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.
|
data/lib/open_router/http.rb
CHANGED
@@ -72,7 +72,9 @@ module OpenRouter
|
|
72
72
|
def headers
|
73
73
|
{
|
74
74
|
"Authorization" => "Bearer #{OpenRouter.configuration.access_token}",
|
75
|
-
"Content-Type" => "application/json"
|
75
|
+
"Content-Type" => "application/json",
|
76
|
+
"X-Title" => "OpenRouter Ruby Client",
|
77
|
+
"HTTP-Referer" => "https://github.com/OlympiaAI/open_router"
|
76
78
|
}.merge(OpenRouter.configuration.extra_headers)
|
77
79
|
end
|
78
80
|
|
data/lib/open_router/version.rb
CHANGED