llm_hub 0.1.0 → 0.1.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: 8dd3ffff8762625d2ab27200f05b3e6e2d1c4b79aa458a1497d208eda656db38
4
- data.tar.gz: 9e98d2e9bf3a1afb8d071e7740a4aef5c10bfb719f03ac51745609c3dd382a55
3
+ metadata.gz: 2e158630f5cb8b2c10a9727709df6f7f657455e4ff41ffa172c4d0d11107be3b
4
+ data.tar.gz: d3032679c1d2299a2d6a36544eee64b43ee94a7b0f3b584fc1c469320de0d7ee
5
5
  SHA512:
6
- metadata.gz: 5a353fcd5c607bd96c30dbdb41103d92cf042c04c04d7b2a1f3982961f52f2e3d60241cf02237f1ac93bfab76e80c6e724ea50e830633e22f5f5bd2d426bf184
7
- data.tar.gz: '08262623da034f3091866f2c0e3e983731145091016533f902af1d7e8140de0e24f1c3480dd9e5d35752f4ed6eeb497694329823b914bfb5056a3461e7852bf4'
6
+ metadata.gz: 893d3e70031f8bcb191047f6024911d580540352a60354ce2047a20bb3e4bd160715c04aaf685e369fc8ec8b19ca5446a2894fde27f22a79d50c78a3897d9365
7
+ data.tar.gz: 0f5b42a047a08af58a8db307ece86723684dcf6ad97a6a50b296f4ae540effb0d85559ab72e4273fa4183517e8d577cc6b56490eb0aebf8f20e7927a920c88ef
data/.rubocop.yml CHANGED
@@ -1,5 +1,7 @@
1
1
  AllCops:
2
2
  TargetRubyVersion: 3.1
3
+ NewCops: enable
4
+ SuggestExtensions: false
3
5
 
4
6
  Style/StringLiterals:
5
7
  EnforcedStyle: single_quotes
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.1.1] - 2025-05-30
4
+
5
+ - Updated description in README.md
6
+
7
+ - Updated RuboCop configuration and fixed all offenses.
8
+
3
9
  ## [0.1.0] - 2025-05-30
4
10
 
5
11
  - Initial release
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # LlmHub
2
2
 
3
- TODO: Delete this and the text below, and describe your gem
3
+ This is a Ruby interface for multiple LLM providers, such as OpenAI and Anthropic.
4
4
 
5
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/llm_hub`. To experiment with that code, run `bin/console` for an interactive prompt.
5
+ It provides easy access to Completion and Embedding functionalities.
6
6
 
7
7
  ## Installation
8
8
 
@@ -6,7 +6,7 @@ require 'llm_hub'
6
6
 
7
7
  # Completion example using OpenAI's GPT-4o-mini model
8
8
  client = LlmHub::Completion::Client.new(
9
- api_key: ENV['OPENAI_API_KEY'],
9
+ api_key: ENV.fetch('OPENAI_API_KEY', nil),
10
10
  provider: :openai
11
11
  )
12
12
 
@@ -29,7 +29,7 @@ puts response[:answer] if response[:answer]
29
29
 
30
30
  # Embedding example using OpenAI's text-embedding-3-small model
31
31
  embedding_client = LlmHub::Embedding::Client.new(
32
- api_key: ENV['OPENAI_API_KEY'],
32
+ api_key: ENV.fetch('OPENAI_API_KEY', nil),
33
33
  provider: :openai
34
34
  )
35
35
 
@@ -33,7 +33,7 @@ module LlmHub
33
33
  provider_class.new(@api_key)
34
34
  end
35
35
 
36
- def with_retry(&_block)
36
+ def with_retry(&)
37
37
  retries = 0
38
38
  begin
39
39
  yield
@@ -33,7 +33,9 @@ module LlmHub
33
33
  end
34
34
 
35
35
  def extract_answer(response_body)
36
- response_body&.dig('content')&.first&.dig('text')
36
+ content_array = response_body&.dig('content')
37
+ first_content = content_array&.first
38
+ first_content&.dig('text')
37
39
  end
38
40
 
39
41
  def extract_tokens(response_body)
@@ -32,7 +32,7 @@ module LlmHub
32
32
  choices = response_body&.dig('choices')
33
33
  return nil if choices.nil? || choices.empty?
34
34
 
35
- choices[0]&.dig('message')&.dig('content')
35
+ choices[0]&.dig('message', 'content')
36
36
  end
37
37
 
38
38
  def extract_tokens(response_body)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LlmHub
4
- VERSION = '0.1.0'
4
+ VERSION = '0.1.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: llm_hub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - akiraNuma
@@ -37,50 +37,8 @@ dependencies:
37
37
  - - ">="
38
38
  - !ruby/object:Gem::Version
39
39
  version: '0'
40
- - !ruby/object:Gem::Dependency
41
- name: rake
42
- requirement: !ruby/object:Gem::Requirement
43
- requirements:
44
- - - "~>"
45
- - !ruby/object:Gem::Version
46
- version: '13.0'
47
- type: :development
48
- prerelease: false
49
- version_requirements: !ruby/object:Gem::Requirement
50
- requirements:
51
- - - "~>"
52
- - !ruby/object:Gem::Version
53
- version: '13.0'
54
- - !ruby/object:Gem::Dependency
55
- name: rspec
56
- requirement: !ruby/object:Gem::Requirement
57
- requirements:
58
- - - "~>"
59
- - !ruby/object:Gem::Version
60
- version: '3.0'
61
- type: :development
62
- prerelease: false
63
- version_requirements: !ruby/object:Gem::Requirement
64
- requirements:
65
- - - "~>"
66
- - !ruby/object:Gem::Version
67
- version: '3.0'
68
- - !ruby/object:Gem::Dependency
69
- name: rubocop
70
- requirement: !ruby/object:Gem::Requirement
71
- requirements:
72
- - - "~>"
73
- - !ruby/object:Gem::Version
74
- version: '1.21'
75
- type: :development
76
- prerelease: false
77
- version_requirements: !ruby/object:Gem::Requirement
78
- requirements:
79
- - - "~>"
80
- - !ruby/object:Gem::Version
81
- version: '1.21'
82
- description: A Ruby interface for multiple LLM providers like OpenAI and Anthropic.
83
- Provides easy access to Completion and Embedding functionalities.
40
+ description: This is a Ruby interface for multiple LLM providers, such as OpenAI and
41
+ Anthropic.It provides easy access to Completion and Embedding functionalities.
84
42
  email:
85
43
  - akiran@akiranumakura.com
86
44
  executables: []
@@ -115,6 +73,7 @@ metadata:
115
73
  homepage_uri: https://github.com/akiraNuma/llm_hub
116
74
  source_code_uri: https://github.com/akiraNuma/llm_hub
117
75
  changelog_uri: https://github.com/akiraNuma/llm_hub/blob/main/CHANGELOG.md
76
+ rubygems_mfa_required: 'true'
118
77
  rdoc_options: []
119
78
  require_paths:
120
79
  - lib
@@ -131,5 +90,5 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
90
  requirements: []
132
91
  rubygems_version: 3.6.3
133
92
  specification_version: 4
134
- summary: A Ruby interface for multiple LLM providers like OpenAI and Anthropic.
93
+ summary: This is a Ruby interface for multiple LLM providers, such as OpenAI and Anthropic.
135
94
  test_files: []