omniai 1.8.0 → 1.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/omniai/tool/parameters.rb +2 -2
- data/lib/omniai/tool/property.rb +2 -2
- data/lib/omniai/tool.rb +6 -3
- data/lib/omniai/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: cca8dd5cc19989ca0a3fc89d1e8f2c5a56611378a202ea8da2fd49528454ea6c
|
4
|
+
data.tar.gz: ee0abcf49b13df01ed5b63ed557de44d42d640fb966bcfb5c7592e19aff06f93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb48e8f76d7cd1836ad8dc0ceb577362a3f289026749e2cc49044e31d25758a625ff66fe8003be12dc09585d9ee571671dd4f6d0b8c355cc7962eb4c136ec9f0
|
7
|
+
data.tar.gz: 41cf6419a3cf3c1662e2f6c5925ae5a05e991f6f2e8f81bcf3d5dfb62ad029bf3d6c32565892ef81acc651a43533dc3a7e9efb2c75922bbdddf28bb29e18b3c2
|
data/README.md
CHANGED
@@ -179,12 +179,12 @@ tool = OmniAI::Tool.new(
|
|
179
179
|
parameters: OmniAI::Tool::Parameters.new(
|
180
180
|
properties: {
|
181
181
|
location: OmniAI::Tool::Property.string(description: 'e.g. Toronto'),
|
182
|
-
unit: OmniAI::Tool::Property.string(enum: %w[celcius
|
182
|
+
unit: OmniAI::Tool::Property.string(enum: %w[celcius fahrenheit]),
|
183
183
|
},
|
184
184
|
required: %i[location]
|
185
185
|
)
|
186
186
|
)
|
187
|
-
client.chat('What is the weather in "London" and "
|
187
|
+
client.chat('What is the weather in "London" in celcius and "Paris" in fahrenheit?', tools: [tool])
|
188
188
|
```
|
189
189
|
|
190
190
|
### Transcribe
|
@@ -24,10 +24,10 @@ module OmniAI
|
|
24
24
|
end
|
25
25
|
|
26
26
|
# @return [Hash]
|
27
|
-
def
|
27
|
+
def serialize
|
28
28
|
{
|
29
29
|
type: @type,
|
30
|
-
properties: @properties.transform_values(&:
|
30
|
+
properties: @properties.transform_values(&:serialize),
|
31
31
|
required: @required,
|
32
32
|
}.compact
|
33
33
|
end
|
data/lib/omniai/tool/property.rb
CHANGED
@@ -60,7 +60,7 @@ module OmniAI
|
|
60
60
|
end
|
61
61
|
|
62
62
|
# @example
|
63
|
-
# property.
|
63
|
+
# property.serialize
|
64
64
|
# # {
|
65
65
|
# # type: 'string',
|
66
66
|
# # description: 'The unit (e.g. "fahrenheit" or "celsius").'
|
@@ -68,7 +68,7 @@ module OmniAI
|
|
68
68
|
# # }
|
69
69
|
#
|
70
70
|
# @return [Hash]
|
71
|
-
def
|
71
|
+
def serialize
|
72
72
|
{
|
73
73
|
type: @type,
|
74
74
|
description: @description,
|
data/lib/omniai/tool.rb
CHANGED
@@ -53,7 +53,10 @@ module OmniAI
|
|
53
53
|
# # parameters: {
|
54
54
|
# # type: 'object',
|
55
55
|
# # properties: {
|
56
|
-
# # n:
|
56
|
+
# # n: {
|
57
|
+
# # description: 'The nth Fibonacci number to calculate')
|
58
|
+
# # type: 'integer'
|
59
|
+
# # }
|
57
60
|
# # },
|
58
61
|
# # required: ['n']
|
59
62
|
# # }
|
@@ -71,7 +74,7 @@ module OmniAI
|
|
71
74
|
function: {
|
72
75
|
name: @name,
|
73
76
|
description: @description,
|
74
|
-
parameters: @parameters
|
77
|
+
parameters: @parameters.is_a?(Tool::Parameters) ? @parameters.serialize : @parameters,
|
75
78
|
}.compact,
|
76
79
|
}
|
77
80
|
end
|
@@ -83,7 +86,7 @@ module OmniAI
|
|
83
86
|
# @param args [Hash]
|
84
87
|
# @return [String]
|
85
88
|
def call(args = {})
|
86
|
-
@function.call(**(@parameters ? @parameters.parse(args) : args))
|
89
|
+
@function.call(**(@parameters.is_a?(Tool::Parameters) ? @parameters.parse(args) : args))
|
87
90
|
end
|
88
91
|
end
|
89
92
|
end
|
data/lib/omniai/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniai
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.8.
|
4
|
+
version: 1.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Sylvestre
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-08-
|
11
|
+
date: 2024-08-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: event_stream_parser
|