raix 0.7.2 → 0.7.3
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 +4 -4
- data/CHANGELOG.md +35 -26
- data/Gemfile.lock +2 -1
- data/README.md +6 -0
- data/lib/raix/function_dispatch.rb +22 -18
- data/lib/raix/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90b0072e3af33e82ccfb040554e9645920e34b4477457ba79335582c9325a7bd
|
4
|
+
data.tar.gz: beeb6e0b98b473597d2191b5005fc89cb57fe69633cfe1e8927a6c1c0f61048f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cbc28460d07263899c0e45be8ccfd3fa522b3162ad2a53d640c1ff0cccb6c7d96f7ab4bef2afa809d47733a98a4a502602b78a6c53918e676955da9d88220f69
|
7
|
+
data.tar.gz: d5e4f7dedaeb3ab2de64168f17a9de920a18894d5acfff22c0e00b870bdf96c77478130a61d47f82f7cc01a566b1cbc95f41fb43241cb3ece24c743b80993fed
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,14 @@
|
|
1
|
-
## [0.7] -
|
1
|
+
## [0.7.3] - 2025-04-23
|
2
|
+
|
3
|
+
## [0.7.2] - 2025-04-19
|
4
|
+
- adds support for `messages` parameter in `chat_completion` to override the transcript
|
5
|
+
- fixes potential race conditions in parallel chat completion calls by duplicating transcript
|
6
|
+
|
7
|
+
## [0.7.1] - 2025-04-10
|
8
|
+
- adds support for JSON response format with automatic parsing
|
9
|
+
- improves error handling for JSON parsing failures
|
10
|
+
|
11
|
+
## [0.7] - 2025-04-02
|
2
12
|
- adds support for `until` condition in `PromptDeclarations` to control prompt looping
|
3
13
|
- adds support for `if` and `unless` conditions in `PromptDeclarations` to control prompt execution
|
4
14
|
- adds support for `success` callback in `PromptDeclarations` to handle prompt responses
|
@@ -22,39 +32,38 @@
|
|
22
32
|
- adds `save_response` option to `chat_completion` to control transcript updates
|
23
33
|
- fixes potential race conditions in transcript handling
|
24
34
|
|
25
|
-
## [0.
|
35
|
+
## [0.4.8] - 2024-11-12
|
36
|
+
- adds documentation for `Predicate` maybe handler
|
37
|
+
- logs to stdout when a response is unhandled by `Predicate`
|
26
38
|
|
27
|
-
|
39
|
+
## [0.4.7] - 2024-11-12
|
40
|
+
- adds missing requires `raix/predicate` so that it can be used in a Rails app automatically
|
41
|
+
- adds missing openai support for `Predicate`
|
28
42
|
|
29
|
-
## [0.
|
30
|
-
- adds `
|
31
|
-
-
|
32
|
-
- adds `FunctionDispatch` module
|
43
|
+
## [0.4.5] - 2024-11-11
|
44
|
+
- adds support for `ResponseFormat`
|
45
|
+
- added some missing requires to support String#squish
|
33
46
|
|
34
|
-
## [0.
|
35
|
-
- adds support for
|
47
|
+
## [0.4.4] - 2024-11-11
|
48
|
+
- adds support for multiple tool calls in a single response
|
36
49
|
|
37
|
-
## [0.4.
|
38
|
-
- adds support for
|
39
|
-
- defaults to `max_completion_tokens` when using OpenAI directly
|
50
|
+
## [0.4.3] - 2024-11-11
|
51
|
+
- adds support for `Predicate` module
|
40
52
|
|
41
53
|
## [0.4.2] - 2024-11-05
|
42
54
|
- adds support for [Predicted Outputs](https://platform.openai.com/docs/guides/latency-optimization#use-predicted-outputs) with the `prediction` option for OpenAI
|
43
55
|
|
44
|
-
## [0.4.
|
45
|
-
- adds support for
|
46
|
-
|
47
|
-
## [0.4.4] - 2024-11-11
|
48
|
-
- adds support for multiple tool calls in a single response
|
56
|
+
## [0.4.0] - 2024-10-18
|
57
|
+
- adds support for Anthropic-style prompt caching
|
58
|
+
- defaults to `max_completion_tokens` when using OpenAI directly
|
49
59
|
|
50
|
-
## [0.
|
51
|
-
- adds support for
|
52
|
-
- added some missing requires to support String#squish
|
60
|
+
## [0.3.2] - 2024-06-29
|
61
|
+
- adds support for streaming
|
53
62
|
|
54
|
-
## [0.
|
55
|
-
- adds
|
56
|
-
- adds
|
63
|
+
## [0.2.0] - tbd
|
64
|
+
- adds `ChatCompletion` module
|
65
|
+
- adds `PromptDeclarations` module
|
66
|
+
- adds `FunctionDispatch` module
|
57
67
|
|
58
|
-
## [0.
|
59
|
-
-
|
60
|
-
- logs to stdout when a response is unhandled by `Predicate`
|
68
|
+
## [0.1.0] - 2024-04-03
|
69
|
+
- Initial release, placeholder gem
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
raix (0.7.
|
4
|
+
raix (0.7.3)
|
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-23
|
214
215
|
arm64-darwin-24
|
215
216
|
x86_64-linux
|
216
217
|
|
data/README.md
CHANGED
@@ -47,6 +47,12 @@ transcript << { role: "user", content: "What is the meaning of life?" }
|
|
47
47
|
|
48
48
|
One of the advantages of OpenRouter and the reason that it is used by default by this library is that it handles mapping message formats from the OpenAI standard to whatever other model you're wanting to use (Anthropic, Cohere, etc.)
|
49
49
|
|
50
|
+
Note that it's possible to override the current object's transcript by passing a `messages` array to `chat_completion`. This allows for multiple threads to share a single conversation context in parallel, by deferring when they write their responses back to the transcript.
|
51
|
+
|
52
|
+
```
|
53
|
+
chat_completion(openai: "gpt-4.1-nano", messages: [{ user: "What is the meaning of life?" }])
|
54
|
+
```
|
55
|
+
|
50
56
|
### Predicted Outputs
|
51
57
|
|
52
58
|
Raix supports [Predicted Outputs](https://platform.openai.com/docs/guides/latency-optimization#use-predicted-outputs) with the `prediction` parameter for OpenAI.
|
@@ -56,27 +56,31 @@ module Raix
|
|
56
56
|
|
57
57
|
define_method(name) do |arguments|
|
58
58
|
id = SecureRandom.uuid[0, 23]
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
59
|
+
instance_exec(arguments, &block).tap do |content|
|
60
|
+
# add in one operation to prevent race condition and potential wrong
|
61
|
+
# interleaving of tool calls in multi-threaded environments
|
62
|
+
transcript << [
|
63
|
+
{
|
64
|
+
role: "assistant",
|
65
|
+
content: nil,
|
66
|
+
tool_calls: [
|
67
|
+
{
|
68
|
+
id:,
|
69
|
+
type: "function",
|
70
|
+
function: {
|
71
|
+
name:,
|
72
|
+
arguments: arguments.to_json
|
73
|
+
}
|
74
|
+
}
|
75
|
+
]
|
76
|
+
},
|
63
77
|
{
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
arguments: arguments.to_json
|
69
|
-
}
|
78
|
+
role: "tool",
|
79
|
+
tool_call_id: id,
|
80
|
+
name:,
|
81
|
+
content: content.to_s
|
70
82
|
}
|
71
83
|
]
|
72
|
-
}
|
73
|
-
instance_exec(arguments, &block).tap do |content|
|
74
|
-
transcript << {
|
75
|
-
role: "tool",
|
76
|
-
tool_call_id: id,
|
77
|
-
name:,
|
78
|
-
content: content.to_s
|
79
|
-
}
|
80
84
|
# TODO: add on_error handler as optional parameter to function
|
81
85
|
end
|
82
86
|
|
data/lib/raix/version.rb
CHANGED
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.7.
|
4
|
+
version: 0.7.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Obie Fernandez
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-04-
|
11
|
+
date: 2025-04-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|