instructor-rb 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/instructor/openai/patch.rb +12 -2
- data/lib/instructor/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: c5f3b630f135c5ab67b275814d8986b732a0deac2a8cb751189444d5774ab169
|
4
|
+
data.tar.gz: cc25330573de9056fdf7e6c5f14d4fb143777b9f26a7d085e00499df6610c8da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90ce22b6ca7bdc23a063b7fcee1329a194cc493b71803902d2455d0c22d105de7506c7387f6b0e7b682405493dc7eb9c7da68e6da68feedb89bdbcbea598cea2
|
7
|
+
data.tar.gz: f6ebf426c755b1d55cb809d75c56a38e5861515419e61e235097c2033729abf8e7e9df200146844c742fcc17fb8b984b4b6cd11d751927a1d93760db321f670c
|
data/CHANGELOG.md
CHANGED
@@ -118,19 +118,29 @@ module Instructor
|
|
118
118
|
{
|
119
119
|
type: 'function',
|
120
120
|
function: {
|
121
|
-
name: model
|
121
|
+
name: generate_function_name(model),
|
122
122
|
description: generate_description(model),
|
123
123
|
parameters: model.json_schema
|
124
124
|
}
|
125
125
|
}
|
126
126
|
end
|
127
127
|
|
128
|
+
def generate_function_name(model)
|
129
|
+
model.schema.fetch(:title, model.name)
|
130
|
+
end
|
131
|
+
|
128
132
|
# Generates the description for the function.
|
129
133
|
#
|
130
134
|
# @param model [Class] The response model class.
|
131
135
|
# @return [String] The generated description.
|
132
136
|
def generate_description(model)
|
133
|
-
|
137
|
+
if model.respond_to?(:instructions)
|
138
|
+
raise Instructor::Error, 'The instructions must be a string' unless model.instructions.is_a?(String)
|
139
|
+
|
140
|
+
model.instructions
|
141
|
+
else
|
142
|
+
"Correctly extracted `#{model.name}` with all the required parameters with correct types"
|
143
|
+
end
|
134
144
|
end
|
135
145
|
|
136
146
|
# Checks if the response is iterable.
|
data/lib/instructor/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: instructor-rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergio Bayona
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2024-05-
|
12
|
+
date: 2024-05-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|