ask-core 0.11.3 → 0.11.4
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/lib/ask/tool_def.rb +16 -1
- data/lib/ask/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fe6fd73be561e63544265ffe4065905c432680e925c9df5d2e8b5e5f3e2b7896
|
|
4
|
+
data.tar.gz: 59389ca6fb4726cf9d921eff7cc35598c95c619154f97c7cfb85a844e8e9cc02
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b944d00f3194ab931e56e3d39ace11c6bb0b058c288dd147574c68a1369a10627d1982d75a4669d5a1eed9d225b2930082684e68086f54b10947503cfb90ae80
|
|
7
|
+
data.tar.gz: b83e78248a0a843718850c5333f339dae78b0c63881184da0902847fd360454fb58cebb1b6269dc2d94869968820d937a1e570473f3e5de96811f22221603ac8
|
data/lib/ask/tool_def.rb
CHANGED
|
@@ -16,6 +16,21 @@ module Ask
|
|
|
16
16
|
# )
|
|
17
17
|
#
|
|
18
18
|
class ToolDef
|
|
19
|
+
# What a tool with no parameters advertises.
|
|
20
|
+
#
|
|
21
|
+
# Present rather than nil, because a nil schema is not "no arguments" to
|
|
22
|
+
# a strict OpenAI-compatible gateway — it is an invalid function. One
|
|
23
|
+
# (commandcode) answers the whole request with "Invalid input: expected
|
|
24
|
+
# record, received null" and names only `tools.0.function.parameters`,
|
|
25
|
+
# so a single parameterless tool breaks a session that never calls it.
|
|
26
|
+
# An empty object schema says the true thing.
|
|
27
|
+
EMPTY_SCHEMA = {
|
|
28
|
+
"type" => "object",
|
|
29
|
+
"properties" => {},
|
|
30
|
+
"required" => [],
|
|
31
|
+
"additionalProperties" => false
|
|
32
|
+
}.freeze
|
|
33
|
+
|
|
19
34
|
class << self
|
|
20
35
|
# Build a ToolDef from an object that responds to #name, #description,
|
|
21
36
|
# #params_schema, and #provider_params.
|
|
@@ -26,7 +41,7 @@ module Ask
|
|
|
26
41
|
new(
|
|
27
42
|
name: tool.name,
|
|
28
43
|
description: tool.description,
|
|
29
|
-
parameters: schema,
|
|
44
|
+
parameters: schema.nil? || schema.empty? ? EMPTY_SCHEMA : schema,
|
|
30
45
|
provider_params: tool.provider_params
|
|
31
46
|
)
|
|
32
47
|
end
|
data/lib/ask/version.rb
CHANGED