raix 0.4.7 → 0.4.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7db1d4210aef051f8e283697776698a60e5eea60be78e05710cade1749e42181
4
- data.tar.gz: d23d58866d655f860731bbb396fadf7b3ed54bfbc64e7d08cea1c5420e538367
3
+ metadata.gz: 205dfe2efa97dd596884ca2063e33e0c76da34ae052f98e18e8c75c423752b3a
4
+ data.tar.gz: 24bfe7d9b6d20a701d70a96366937bf96c4999ea26469c8cc645e4ae874ce5c8
5
5
  SHA512:
6
- metadata.gz: 708045d59a97f42b918ff7749b183195ba02c58853dd54a7ce87e112c9905e7e404e8aec5e541fd9cd62ef2e932fae00f7106379a637e8380e6b0147496e8edb
7
- data.tar.gz: aa6a4e463adba935d83cfaab186a8aa132db9967fb2420ee5821519a5253de176efbdcc1a0fd7460ec2bd4980f2c4f54146dc790dd1d37f8b48eba473b9f946d
6
+ metadata.gz: ea57058bb1e8614decd24d295a641b4e2e6d90ac2d5b2d744b3531561f13304e4e8e41a679c9e0f80b16fdcf0477c8c61262ed9b4fbb451d507db24469540037
7
+ data.tar.gz: f6c255abef3c7d2e7440075d4114f564050ffcf95e431dc5301ea6a516cd89f1baf3d96346e86614192d85330e4f234673b89eb9d19930043f0882c8ee2451eb
data/CHANGELOG.md CHANGED
@@ -32,3 +32,7 @@
32
32
  ## [0.4.7] - 2024-11-12
33
33
  - adds missing requires `raix/predicate` so that it can be used in a Rails app automatically
34
34
  - adds missing openai support for `Predicate`
35
+
36
+ ## [0.4.8] - 2024-11-12
37
+ - adds documentation for `Predicate` maybe handler
38
+ - logs to stdout when a response is unhandled by `Predicate`
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- raix (0.4.7)
4
+ raix (0.4.8)
5
5
  activesupport (>= 6.0)
6
6
  open_router (~> 0.2)
7
7
  ruby-openai (~> 7.0)
@@ -211,6 +211,7 @@ GEM
211
211
  PLATFORMS
212
212
  arm64-darwin-21
213
213
  arm64-darwin-22
214
+ arm64-darwin-24
214
215
  x86_64-linux
215
216
 
216
217
  DEPENDENCIES
@@ -3,19 +3,24 @@
3
3
  module Raix
4
4
  # A module for handling yes/no questions using AI chat completion.
5
5
  # When included in a class, it provides methods to define handlers for
6
- # yes and no responses.
6
+ # yes and no responses. All handlers are optional. Any response that
7
+ # does not begin with "yes, " or "no, " will be considered a maybe.
7
8
  #
8
9
  # @example
9
10
  # class Question
10
11
  # include Raix::Predicate
11
12
  #
12
- # yes do |explanation|
13
+ # yes? do |explanation|
13
14
  # puts "Yes: #{explanation}"
14
15
  # end
15
16
  #
16
- # no do |explanation|
17
+ # no? do |explanation|
17
18
  # puts "No: #{explanation}"
18
19
  # end
20
+ #
21
+ # maybe? do |explanation|
22
+ # puts "Maybe: #{explanation}"
23
+ # end
19
24
  # end
20
25
  #
21
26
  # question = Question.new
@@ -38,8 +43,10 @@ module Raix
38
43
  instance_exec(response, &self.class.yes_block) if self.class.yes_block
39
44
  elsif response.downcase.start_with?("no,")
40
45
  instance_exec(response, &self.class.no_block) if self.class.no_block
41
- elsif response.downcase.start_with?("maybe,")
42
- instance_exec(response, &self.class.maybe_block) if self.class.maybe_block
46
+ elsif self.class.maybe_block
47
+ instance_exec(response, &self.class.maybe_block)
48
+ else
49
+ puts "[Raix::Predicate] Unhandled response: #{response}"
43
50
  end
44
51
  end
45
52
  end
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.4.7"
4
+ VERSION = "0.4.8"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: raix
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.7
4
+ version: 0.4.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Obie Fernandez
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-12-03 00:00:00.000000000 Z
11
+ date: 2024-12-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport