matheus 0.7.1 → 0.8.0

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: ac93e4b9cc074bcacf3f6a1876bc7b3b64ed327b9311e38e06296bb0865326fd
4
- data.tar.gz: 1cea1255adfd37b392788346126c47b280e77fbb6efc0e81315e7b136fed3731
3
+ metadata.gz: 668bbb45792868d5cdc9d9e8ec08e57a0ee0cad7f6b8f6f06d9d0525054c6419
4
+ data.tar.gz: 85432c2885378382bce069b276898886bfb6b6b3e90af780d8de303844b793fb
5
5
  SHA512:
6
- metadata.gz: 65ffbf0cf5faabd5ca15b6dece5e5f5c4be20b6667bac5d593cb529d85198611d9b3339e29acc3fe3751e93515f6a387317228b473ef62aa6854c0d8e3284930
7
- data.tar.gz: febd6039248df0aa1c7ec14be94fe5656a16a393646cab3e1e9564aad73a168a5556584e8e14addc95757440cfca49130929e39ff8eb6dde166c9ae973c85e9c
6
+ metadata.gz: c415912e5e87e7f9fed56d1d1a4cbc50573bc57a8ada623b8e950cf852e7eeb08c05285a87491e44bca50919162407c44b19720610891abcbe4cb86c059cef38
7
+ data.tar.gz: 4c512102ec35dcf5641771c60cc848e42c1b1dc936312f1a94816f0044346961158ddc51a84b91ad1a551c4021201c2376c1e21e0a4428d07d38d53ec95e1976
data/.standard.yml ADDED
@@ -0,0 +1 @@
1
+ ruby_version: 3.2
data/.tool-versions CHANGED
@@ -1 +1 @@
1
- ruby 3.3.5
1
+ ruby 3.4
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.8.0]
4
+
5
+ - Replace `ruby-openai` with `ruby_llm` in `q`.
6
+ - Change the `q` model from `gpt-4o-mini` to `gpt-5.4-nano`.
7
+ - Fix the `q` errors that occur when json 3.0 is installed.
8
+
3
9
  ## [0.7.1]
4
10
 
5
11
  - Update sound playback commands to run in the background with success status
@@ -32,7 +32,7 @@ module Matheus
32
32
  def parse_args(args)
33
33
  first_arg = args.fetch(0) { raise "Missing amount or source currency" }
34
34
 
35
- if (amount = Float(first_arg) rescue nil) # standard:disable Style/RescueModifier
35
+ if (amount = Float(first_arg, exception: false))
36
36
  source = args.fetch(1) { raise "Missing source currency" }
37
37
  target = args.fetch(2) { raise "Missing target currency" }
38
38
  date = Date.parse(args.fetch(3, Date.today.to_s))
data/lib/matheus/q.rb CHANGED
@@ -1,4 +1,4 @@
1
- require "openai"
1
+ require "ruby_llm"
2
2
  require "tty-markdown"
3
3
  require "tty-prompt"
4
4
  require "json"
@@ -21,7 +21,7 @@ module Matheus
21
21
  save_qa(question, answer)
22
22
  end
23
23
 
24
- answer.tap { |it| print_markdown(it) }
24
+ answer.tap { |text| print_markdown(text) }
25
25
  rescue => e
26
26
  Failure(e.message)
27
27
  end
@@ -31,26 +31,16 @@ module Matheus
31
31
  def ask_llm(question)
32
32
  raise "Question can't be blank." if question.blank?
33
33
 
34
- response = client.chat(
35
- parameters: {
36
- model: "gpt-4o-mini",
37
- messages: [{role: "user", content: "#{BASE_PROMPT}#{question}"}]
38
- }
39
- )
40
-
41
- raise response["error"]["message"] if response.has_key?("error")
42
-
43
- response.dig("choices", 0, "message", "content")
44
- rescue Faraday::ClientError => error
45
- raise error.response_body.dig("error", "message") || error
34
+ chat.ask("#{BASE_PROMPT}#{question}").content
46
35
  end
47
36
 
48
37
  def print_markdown(text)
49
38
  puts TTY::Markdown.parse(text)
50
39
  end
51
40
 
52
- def client
53
- OpenAI::Client.new(access_token: ENV.fetch("OPENAI_API_KEY"))
41
+ def chat
42
+ RubyLLM.configure { |config| config.openai_api_key = ENV.fetch("OPENAI_API_KEY") }
43
+ RubyLLM.chat(model: "gpt-5.4-nano")
54
44
  end
55
45
 
56
46
  def save_qa(question, answer)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Matheus
4
- VERSION = "0.7.1"
4
+ VERSION = "0.8.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: matheus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matheus Richard
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2025-03-11 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: zeitwerk
@@ -39,19 +38,19 @@ dependencies:
39
38
  - !ruby/object:Gem::Version
40
39
  version: 7.2.0
41
40
  - !ruby/object:Gem::Dependency
42
- name: ruby-openai
41
+ name: ruby_llm
43
42
  requirement: !ruby/object:Gem::Requirement
44
43
  requirements:
45
44
  - - "~>"
46
45
  - !ruby/object:Gem::Version
47
- version: 7.1.0
46
+ version: '2.0'
48
47
  type: :runtime
49
48
  prerelease: false
50
49
  version_requirements: !ruby/object:Gem::Requirement
51
50
  requirements:
52
51
  - - "~>"
53
52
  - !ruby/object:Gem::Version
54
- version: 7.1.0
53
+ version: '2.0'
55
54
  - !ruby/object:Gem::Dependency
56
55
  name: tty-markdown
57
56
  requirement: !ruby/object:Gem::Requirement
@@ -123,6 +122,7 @@ extensions: []
123
122
  extra_rdoc_files: []
124
123
  files:
125
124
  - ".rspec"
125
+ - ".standard.yml"
126
126
  - ".tool-versions"
127
127
  - CHANGELOG.md
128
128
  - LICENSE.txt
@@ -154,7 +154,7 @@ metadata:
154
154
  homepage_uri: https://github.com/MatheusRich/matheus
155
155
  source_code_uri: https://github.com/MatheusRich/matheus
156
156
  changelog_uri: https://github.com/MatheusRich/matheus/blob/main/CHANGELOG.md
157
- post_install_message:
157
+ rubygems_mfa_required: 'true'
158
158
  rdoc_options: []
159
159
  require_paths:
160
160
  - lib
@@ -169,8 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
169
169
  - !ruby/object:Gem::Version
170
170
  version: '0'
171
171
  requirements: []
172
- rubygems_version: 3.5.16
173
- signing_key:
172
+ rubygems_version: 3.6.9
174
173
  specification_version: 4
175
174
  summary: A bunch of CLI tools I made for my own use.
176
175
  test_files: []