llm_hub 0.1.1 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2e158630f5cb8b2c10a9727709df6f7f657455e4ff41ffa172c4d0d11107be3b
4
- data.tar.gz: d3032679c1d2299a2d6a36544eee64b43ee94a7b0f3b584fc1c469320de0d7ee
3
+ metadata.gz: 353ca2493088bec5034c53bda9389a7277d9b79f9a0af7aa9cd0dea38c7a3d96
4
+ data.tar.gz: e67417f5a3210cb1a5fbca143df86ed2bb4564ae62efe4dab751e2dd0a1bb1e4
5
5
  SHA512:
6
- metadata.gz: 893d3e70031f8bcb191047f6024911d580540352a60354ce2047a20bb3e4bd160715c04aaf685e369fc8ec8b19ca5446a2894fde27f22a79d50c78a3897d9365
7
- data.tar.gz: 0f5b42a047a08af58a8db307ece86723684dcf6ad97a6a50b296f4ae540effb0d85559ab72e4273fa4183517e8d577cc6b56490eb0aebf8f20e7927a920c88ef
6
+ metadata.gz: 3896b924c84d3e05877333187e60c57918d9f968ad347027faa8cac6e37849315a0b2815966c1e1fc506ca898e26456fb054973965d2a535b1a56ff41852a6a2
7
+ data.tar.gz: 12c26874593c316bde1f841da6161c4395e00c33f63eff6f7e26e10b978f349150ec1a686bbaedb2527432a8d9e726d29194b64f2f7199ba4604977d68ffd60f
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.2.1] - 2025-07-04
4
+
5
+ - Added new option parameters.
6
+
7
+ ## [0.2.0] - 2025-06-17
8
+
9
+ - Added Deepseek as a provider.
10
+
3
11
  ## [0.1.1] - 2025-05-30
4
12
 
5
13
  - Updated description in README.md
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # LlmHub
2
2
 
3
- This is a Ruby interface for multiple LLM providers, such as OpenAI and Anthropic.
3
+ This is a Ruby interface for multiple LLM providers, such as OpenAI, Anthropic, and DeepSeek.
4
4
 
5
5
  It provides easy access to Completion and Embedding functionalities.
6
6
 
@@ -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 spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
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
- def initialize(api_key:, provider:)
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
- @retry_count = LlmHub::Config::RETRY_COUNT
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 = LlmHub::Config::OPEN_TIME_OUT
33
- http_client.read_timeout = LlmHub::Config::READ_TIME_OUT
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
@@ -8,14 +8,18 @@ module LlmHub
8
8
  # @return [Hash<Symbol, Class>] mapping of provider names to their classes
9
9
  PROVIDER_CLASSES = {
10
10
  openai: Providers::OpenAI,
11
- anthropic: Providers::Anthropic
11
+ anthropic: Providers::Anthropic,
12
+ deepseek: Providers::Deepseek
12
13
  }.freeze
13
14
 
14
15
  # Initialize a new completion client
15
16
  # @param api_key [String] API key for the provider (required)
16
- # @param provider [Symbol, String] Provider name (:openai, :anthropic) (required)
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)
17
21
  # @see LlmHub::Common::ClientBase#initialize
18
- def initialize(api_key:, provider:)
22
+ def initialize(api_key:, provider:, open_time_out: nil, read_time_out: nil, retry_count: nil)
19
23
  super
20
24
  @provider_client = create_provider_client
21
25
  end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LlmHub
4
+ module Completion
5
+ module Providers
6
+ # DeepSeek completion provider
7
+ # Inherits from OpenAI provider since DeepSeek uses OpenAI-compatible API
8
+ class Deepseek < OpenAI
9
+ COMPLETIONS_URI = 'https://api.deepseek.com/v1/chat/completions'
10
+
11
+ def url
12
+ COMPLETIONS_URI
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -2,8 +2,8 @@
2
2
 
3
3
  module LlmHub
4
4
  module Config
5
- OPEN_TIME_OUT = 5
6
- READ_TIME_OUT = 20
7
- RETRY_COUNT = 1
5
+ DEFAULT_OPEN_TIME_OUT = 5
6
+ DEFAULT_READ_TIME_OUT = 20
7
+ DEFAULT_RETRY_COUNT = 1
8
8
  end
9
9
  end
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LlmHub
4
- VERSION = '0.1.1'
4
+ VERSION = '0.2.1'
5
5
  end
data/lib/llm_hub.rb CHANGED
@@ -18,6 +18,7 @@ require_relative 'llm_hub/common/client_base'
18
18
  require_relative 'llm_hub/completion/providers/base'
19
19
  require_relative 'llm_hub/completion/providers/openai'
20
20
  require_relative 'llm_hub/completion/providers/anthropic'
21
+ require_relative 'llm_hub/completion/providers/deepseek'
21
22
  require_relative 'llm_hub/completion/client'
22
23
 
23
24
  # Embedding providers
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.1.1
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-05-29 00:00:00.000000000 Z
10
+ date: 2025-07-04 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: activesupport
@@ -59,6 +59,7 @@ files:
59
59
  - lib/llm_hub/completion/client.rb
60
60
  - lib/llm_hub/completion/providers/anthropic.rb
61
61
  - lib/llm_hub/completion/providers/base.rb
62
+ - lib/llm_hub/completion/providers/deepseek.rb
62
63
  - lib/llm_hub/completion/providers/openai.rb
63
64
  - lib/llm_hub/config.rb
64
65
  - lib/llm_hub/embedding/client.rb