raix 0.9.1 → 0.9.2

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: '0868c4163ea58511e3c0dfc66b2b22a5cb2dbb16a7575746b36cd70af4777137'
4
- data.tar.gz: 4e396262603a787dc58817e9fbb536264f25cdb9462bcbe035d675e59cb179ad
3
+ metadata.gz: 5464c46a401957877b024ec9a1140b6f2624add3f21c172253663988c74baa49
4
+ data.tar.gz: a556464db7a06866cf6ecd27530b7ddcbbc372fa8e4f96f7ba84f0c6467de3b1
5
5
  SHA512:
6
- metadata.gz: 8ae8a80e0e45dfba22290aefe27c39fd914f9046228dac33af1bc631e55a9eff73e38500c12c9eec6ba7bff67a5a16d51438ccf80cbcf423b070125dcd5710c4
7
- data.tar.gz: ffb45352168291e28041b787fa8c2bf61c032d5bd5c59fb5a5653a602d6b1bb5ef282475ce7d828722113df797369127a1a4cdeec5da1c53ad887f1665b0385a
6
+ metadata.gz: c99d540f8f8c7c0c35a57628d322ff0eef31803c0bee7244476633bd092320bd7040ceebb4b20126b55529bfe0fb373fee01e4977871a3eedf1e135331e9b4e2
7
+ data.tar.gz: 53e124ebdf99b0b176fb0c30d15c40e9a3156e210686d705237aa43fc02e2ca0e71a63e5efd75deffaf1f5565a34837ccd6d7f1b1dd6f2cbf6b6d9d5c3f137d2
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## [0.9.2] - 2025-06-03
2
+ ### Fixed
3
+ - Fixed OpenAI chat completion compatibility
4
+ - Fixed SHA256 hexdigest generation for MCP tool names
5
+ - Added ostruct as explicit dependency to prevent warnings
6
+ - Fixed rubocop lint error for alphabetized gemspec dependencies
7
+ - Updated default OpenRouter model
8
+
1
9
  ## [0.9.1] - 2025-05-30
2
10
  ### Added
3
11
  - **MCP Type Coercion** - Automatic type conversion for MCP tool arguments based on JSON schema
data/Gemfile.lock CHANGED
@@ -1,10 +1,11 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- raix (0.9.1)
4
+ raix (0.9.2)
5
5
  activesupport (>= 6.0)
6
6
  faraday-retry (~> 2.0)
7
7
  open_router (~> 0.2)
8
+ ostruct
8
9
  ruby-openai (~> 7)
9
10
 
10
11
  GEM
@@ -97,6 +98,7 @@ GEM
97
98
  dotenv (>= 2)
98
99
  faraday (>= 1)
99
100
  faraday-multipart (>= 1)
101
+ ostruct (0.6.1)
100
102
  parallel (1.24.0)
101
103
  parser (3.3.0.5)
102
104
  ast (~> 2.4.1)
@@ -3,6 +3,7 @@ require "json"
3
3
  require "securerandom"
4
4
  require "faraday"
5
5
  require "uri"
6
+ require "digest"
6
7
 
7
8
  module Raix
8
9
  module MCP
@@ -84,7 +85,8 @@ module Raix
84
85
  end
85
86
 
86
87
  def unique_key
87
- @url.parameterize.underscore.gsub("https_", "")
88
+ parametrized_url = @url.parameterize.underscore.gsub("https_", "")
89
+ Digest::SHA256.hexdigest(parametrized_url)[0..2]
88
90
  end
89
91
 
90
92
  private
@@ -1,6 +1,7 @@
1
1
  require_relative "tool"
2
2
  require "json"
3
3
  require "securerandom"
4
+ require "digest"
4
5
 
5
6
  module Raix
6
7
  module MCP
@@ -57,7 +58,8 @@ module Raix
57
58
  end
58
59
 
59
60
  def unique_key
60
- @args.join(" ").parameterize.underscore
61
+ parametrized_args = @args.join(" ").parameterize.underscore
62
+ Digest::SHA256.hexdigest(parametrized_args)[0..2]
61
63
  end
62
64
 
63
65
  private
@@ -60,12 +60,12 @@ module Raix
60
60
  # @param params [Hash] The parameters for chat completion.
61
61
  # @option loop [Boolean] :loop (false) Whether to loop the chat completion after function calls.
62
62
  # @option params [Boolean] :json (false) Whether to return the parse the response as a JSON object. Will search for <json> tags in the response first, then fall back to the default JSON parsing of the entire response.
63
- # @option params [Boolean] :openai (false) Whether to use OpenAI's API instead of OpenRouter's.
63
+ # @option params [String] :openai (nil) If non-nil, use OpenAI with the model specified in this param.
64
64
  # @option params [Boolean] :raw (false) Whether to return the raw response or dig the text content.
65
65
  # @option params [Array] :messages (nil) An array of messages to use instead of the transcript.
66
66
  # @option tools [Array|false] :available_tools (nil) Tools to pass to the LLM. Ignored if nil (default). If false, no tools are passed. If an array, only declared tools in the array are passed.
67
67
  # @return [String|Hash] The completed chat response.
68
- def chat_completion(params: {}, loop: false, json: false, raw: false, openai: false, save_response: true, messages: nil, available_tools: nil)
68
+ def chat_completion(params: {}, loop: false, json: false, raw: false, openai: nil, save_response: true, messages: nil, available_tools: nil)
69
69
  # set params to default values if not provided
70
70
  params[:cache_at] ||= cache_at.presence
71
71
  params[:frequency_penalty] ||= frequency_penalty.presence
@@ -38,7 +38,7 @@ module Raix
38
38
 
39
39
  DEFAULT_MAX_TOKENS = 1000
40
40
  DEFAULT_MAX_COMPLETION_TOKENS = 16_384
41
- DEFAULT_MODEL = "meta-llama/llama-3-8b-instruct:free"
41
+ DEFAULT_MODEL = "meta-llama/llama-3.3-8b-instruct:free"
42
42
  DEFAULT_TEMPERATURE = 0.0
43
43
 
44
44
  # Initializes a new instance of the Configuration class with default values.
data/lib/raix/mcp.rb CHANGED
@@ -102,7 +102,7 @@ module Raix
102
102
  filtered_tools.each do |tool|
103
103
  remote_name = tool.name
104
104
  # TODO: Revisit later whether this much context is needed in the function name
105
- local_name = "#{client.unique_key}_#{remote_name}".to_sym
105
+ local_name = "#{remote_name}_#{client.unique_key}".to_sym
106
106
 
107
107
  description = tool.description
108
108
  input_schema = tool.input_schema || {}
@@ -140,7 +140,7 @@ module Raix
140
140
  id: call_id,
141
141
  type: "function",
142
142
  function: {
143
- name: remote_name,
143
+ name: local_name.to_s,
144
144
  arguments: arguments.to_json
145
145
  }
146
146
  }
@@ -149,7 +149,7 @@ module Raix
149
149
  {
150
150
  role: "tool",
151
151
  tool_call_id: call_id,
152
- name: remote_name,
152
+ name: local_name.to_s,
153
153
  content: content_text
154
154
  }
155
155
  ]
data/lib/raix/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Raix
4
- VERSION = "0.9.1"
4
+ VERSION = "0.9.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: raix
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Obie Fernandez
@@ -51,6 +51,20 @@ dependencies:
51
51
  - - "~>"
52
52
  - !ruby/object:Gem::Version
53
53
  version: '0.2'
54
+ - !ruby/object:Gem::Dependency
55
+ name: ostruct
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ type: :runtime
62
+ prerelease: false
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
54
68
  - !ruby/object:Gem::Dependency
55
69
  name: ruby-openai
56
70
  requirement: !ruby/object:Gem::Requirement
@@ -96,7 +110,6 @@ files:
96
110
  - lib/raix/prompt_declarations.rb
97
111
  - lib/raix/response_format.rb
98
112
  - lib/raix/version.rb
99
- - raix.gemspec
100
113
  - sig/raix.rbs
101
114
  homepage: https://github.com/OlympiaAI/raix
102
115
  licenses:
data/raix.gemspec DELETED
@@ -1,35 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "lib/raix/version"
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = "raix"
7
- spec.version = Raix::VERSION
8
- spec.authors = ["Obie Fernandez"]
9
- spec.email = ["obiefernandez@gmail.com"]
10
-
11
- spec.summary = "Ruby AI eXtensions"
12
- spec.homepage = "https://github.com/OlympiaAI/raix"
13
- spec.license = "MIT"
14
- spec.required_ruby_version = ">= 3.2.2"
15
-
16
- spec.metadata["homepage_uri"] = spec.homepage
17
- spec.metadata["source_code_uri"] = "https://github.com/OlympiaAI/raix"
18
- spec.metadata["changelog_uri"] = "https://github.com/OlympiaAI/raix/blob/main/CHANGELOG.md"
19
-
20
- # Specify which files should be added to the gem when it is released.
21
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
22
- spec.files = Dir.chdir(__dir__) do
23
- `git ls-files -z`.split("\x0").reject do |f|
24
- (File.expand_path(f) == __FILE__) || f.start_with?(*%w[bin/ test/ spec/ features/ .git .circleci appveyor])
25
- end
26
- end
27
- spec.bindir = "exe"
28
- spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
29
- spec.require_paths = ["lib"]
30
-
31
- spec.add_dependency "activesupport", ">= 6.0"
32
- spec.add_dependency "faraday-retry", "~> 2.0"
33
- spec.add_dependency "open_router", "~> 0.2"
34
- spec.add_dependency "ruby-openai", "~> 7"
35
- end