llm_hub 0.2.0 → 0.2.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/CHANGELOG.md +8 -0
- data/README.md +1 -1
- data/lib/llm_hub/common/client_base.rb +8 -3
- data/lib/llm_hub/common/http_helper.rb +2 -2
- data/lib/llm_hub/completion/client.rb +4 -1
- data/lib/llm_hub/config.rb +3 -3
- data/lib/llm_hub/embedding/client.rb +4 -1
- data/lib/llm_hub/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 353ca2493088bec5034c53bda9389a7277d9b79f9a0af7aa9cd0dea38c7a3d96
|
4
|
+
data.tar.gz: e67417f5a3210cb1a5fbca143df86ed2bb4564ae62efe4dab751e2dd0a1bb1e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3896b924c84d3e05877333187e60c57918d9f968ad347027faa8cac6e37849315a0b2815966c1e1fc506ca898e26456fb054973965d2a535b1a56ff41852a6a2
|
7
|
+
data.tar.gz: 12c26874593c316bde1f841da6161c4395e00c33f63eff6f7e26e10b978f349150ec1a686bbaedb2527432a8d9e726d29194b64f2f7199ba4604977d68ffd60f
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -37,7 +37,7 @@ puts response
|
|
37
37
|
|
38
38
|
## Development
|
39
39
|
|
40
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake
|
40
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bundle exec rake` to run the tests and code quality checks (or `rake spec` for tests only). You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
41
41
|
|
42
42
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
43
43
|
|
@@ -8,15 +8,20 @@ module LlmHub
|
|
8
8
|
class ClientBase
|
9
9
|
include LlmHub::Common::HttpHelper
|
10
10
|
|
11
|
-
attr_reader :api_key, :provider, :retry_count
|
11
|
+
attr_reader :api_key, :provider, :retry_count, :open_time_out, :read_time_out
|
12
12
|
|
13
13
|
# Initialize a new client
|
14
14
|
# @param api_key [String] API key for the provider (required)
|
15
15
|
# @param provider [Symbol, String] Provider name (required)
|
16
|
-
|
16
|
+
# @param open_time_out [Integer] HTTP open timeout in seconds (optional, defaults to Config value)
|
17
|
+
# @param read_time_out [Integer] HTTP read timeout in seconds (optional, defaults to Config value)
|
18
|
+
# @param retry_count [Integer] Number of retries for failed requests (optional, defaults to Config value)
|
19
|
+
def initialize(api_key:, provider:, open_time_out: nil, read_time_out: nil, retry_count: nil)
|
17
20
|
@api_key = api_key
|
18
21
|
@provider = provider
|
19
|
-
@
|
22
|
+
@open_time_out = open_time_out || LlmHub::Config::DEFAULT_OPEN_TIME_OUT
|
23
|
+
@read_time_out = read_time_out || LlmHub::Config::DEFAULT_READ_TIME_OUT
|
24
|
+
@retry_count = retry_count || LlmHub::Config::DEFAULT_RETRY_COUNT
|
20
25
|
end
|
21
26
|
|
22
27
|
protected
|
@@ -29,8 +29,8 @@ module LlmHub
|
|
29
29
|
)
|
30
30
|
http_client.use_ssl = uri.scheme == 'https'
|
31
31
|
http_client.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
32
|
-
http_client.open_timeout =
|
33
|
-
http_client.read_timeout =
|
32
|
+
http_client.open_timeout = @open_time_out
|
33
|
+
http_client.read_timeout = @read_time_out
|
34
34
|
http_client
|
35
35
|
end
|
36
36
|
end
|
@@ -15,8 +15,11 @@ module LlmHub
|
|
15
15
|
# Initialize a new completion client
|
16
16
|
# @param api_key [String] API key for the provider (required)
|
17
17
|
# @param provider [Symbol, String] Provider name (:openai, :anthropic, :deepseek) (required)
|
18
|
+
# @param open_time_out [Integer] HTTP open timeout in seconds (optional, defaults to Config value)
|
19
|
+
# @param read_time_out [Integer] HTTP read timeout in seconds (optional, defaults to Config value)
|
20
|
+
# @param retry_count [Integer] Number of retries for failed requests (optional, defaults to Config value)
|
18
21
|
# @see LlmHub::Common::ClientBase#initialize
|
19
|
-
def initialize(api_key:, provider:)
|
22
|
+
def initialize(api_key:, provider:, open_time_out: nil, read_time_out: nil, retry_count: nil)
|
20
23
|
super
|
21
24
|
@provider_client = create_provider_client
|
22
25
|
end
|
data/lib/llm_hub/config.rb
CHANGED
@@ -13,8 +13,11 @@ module LlmHub
|
|
13
13
|
# Initialize a new embedding client
|
14
14
|
# @param api_key [String] API key for the provider (required)
|
15
15
|
# @param provider [Symbol, String] Provider name (:openai) (required)
|
16
|
+
# @param open_time_out [Integer] HTTP open timeout in seconds (optional, defaults to Config value)
|
17
|
+
# @param read_time_out [Integer] HTTP read timeout in seconds (optional, defaults to Config value)
|
18
|
+
# @param retry_count [Integer] Number of retries for failed requests (optional, defaults to Config value)
|
16
19
|
# @see LlmHub::Common::ClientBase#initialize
|
17
|
-
def initialize(api_key:, provider:)
|
20
|
+
def initialize(api_key:, provider:, open_time_out: nil, read_time_out: nil, retry_count: nil)
|
18
21
|
super
|
19
22
|
@provider_client = create_provider_client
|
20
23
|
end
|
data/lib/llm_hub/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: llm_hub
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- akiraNuma
|
8
8
|
bindir: exe
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-
|
10
|
+
date: 2025-07-04 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: activesupport
|