@yourgpt/llm-sdk 2.5.1-beta.4 → 2.5.1-beta.5
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.
package/dist/adapters/index.js
CHANGED
|
@@ -213,6 +213,12 @@ function toGeminiSchema(rf) {
|
|
|
213
213
|
GEMINI_UNSUPPORTED_KEYS
|
|
214
214
|
);
|
|
215
215
|
}
|
|
216
|
+
function parameterToGeminiSchema(param) {
|
|
217
|
+
return stripSchemaKeys(
|
|
218
|
+
parameterToJsonSchema(param),
|
|
219
|
+
GEMINI_UNSUPPORTED_KEYS
|
|
220
|
+
);
|
|
221
|
+
}
|
|
216
222
|
function toOllamaFormat(rf) {
|
|
217
223
|
if (!rf) return void 0;
|
|
218
224
|
if (rf.type === "json_object") return "json";
|
|
@@ -1188,11 +1194,7 @@ var AnthropicAdapter = class {
|
|
|
1188
1194
|
properties: action.parameters ? Object.fromEntries(
|
|
1189
1195
|
Object.entries(action.parameters).map(([key, param]) => [
|
|
1190
1196
|
key,
|
|
1191
|
-
|
|
1192
|
-
type: param.type,
|
|
1193
|
-
description: param.description,
|
|
1194
|
-
enum: param.enum
|
|
1195
|
-
}
|
|
1197
|
+
parameterToJsonSchema(param)
|
|
1196
1198
|
])
|
|
1197
1199
|
) : {},
|
|
1198
1200
|
required: action.parameters ? Object.entries(action.parameters).filter(([, param]) => param.required).map(([key]) => key) : []
|
|
@@ -1828,11 +1830,7 @@ function formatToolsForGemini(actions) {
|
|
|
1828
1830
|
properties: Object.fromEntries(
|
|
1829
1831
|
Object.entries(action.parameters).map(([key, param]) => [
|
|
1830
1832
|
key,
|
|
1831
|
-
|
|
1832
|
-
type: param.type,
|
|
1833
|
-
description: param.description,
|
|
1834
|
-
enum: param.enum
|
|
1835
|
-
}
|
|
1833
|
+
parameterToGeminiSchema(param)
|
|
1836
1834
|
])
|
|
1837
1835
|
),
|
|
1838
1836
|
required: Object.entries(action.parameters).filter(([, param]) => param.required).map(([key]) => key)
|
package/dist/adapters/index.mjs
CHANGED
|
@@ -211,6 +211,12 @@ function toGeminiSchema(rf) {
|
|
|
211
211
|
GEMINI_UNSUPPORTED_KEYS
|
|
212
212
|
);
|
|
213
213
|
}
|
|
214
|
+
function parameterToGeminiSchema(param) {
|
|
215
|
+
return stripSchemaKeys(
|
|
216
|
+
parameterToJsonSchema(param),
|
|
217
|
+
GEMINI_UNSUPPORTED_KEYS
|
|
218
|
+
);
|
|
219
|
+
}
|
|
214
220
|
function toOllamaFormat(rf) {
|
|
215
221
|
if (!rf) return void 0;
|
|
216
222
|
if (rf.type === "json_object") return "json";
|
|
@@ -1186,11 +1192,7 @@ var AnthropicAdapter = class {
|
|
|
1186
1192
|
properties: action.parameters ? Object.fromEntries(
|
|
1187
1193
|
Object.entries(action.parameters).map(([key, param]) => [
|
|
1188
1194
|
key,
|
|
1189
|
-
|
|
1190
|
-
type: param.type,
|
|
1191
|
-
description: param.description,
|
|
1192
|
-
enum: param.enum
|
|
1193
|
-
}
|
|
1195
|
+
parameterToJsonSchema(param)
|
|
1194
1196
|
])
|
|
1195
1197
|
) : {},
|
|
1196
1198
|
required: action.parameters ? Object.entries(action.parameters).filter(([, param]) => param.required).map(([key]) => key) : []
|
|
@@ -1826,11 +1828,7 @@ function formatToolsForGemini(actions) {
|
|
|
1826
1828
|
properties: Object.fromEntries(
|
|
1827
1829
|
Object.entries(action.parameters).map(([key, param]) => [
|
|
1828
1830
|
key,
|
|
1829
|
-
|
|
1830
|
-
type: param.type,
|
|
1831
|
-
description: param.description,
|
|
1832
|
-
enum: param.enum
|
|
1833
|
-
}
|
|
1831
|
+
parameterToGeminiSchema(param)
|
|
1834
1832
|
])
|
|
1835
1833
|
),
|
|
1836
1834
|
required: Object.entries(action.parameters).filter(([, param]) => param.required).map(([key]) => key)
|
|
@@ -39,6 +39,34 @@ ${stringifyForDebug(payload)}`
|
|
|
39
39
|
);
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
+
function parameterToJsonSchema(param) {
|
|
43
|
+
const schema = {
|
|
44
|
+
type: param.type
|
|
45
|
+
};
|
|
46
|
+
if (param.description) {
|
|
47
|
+
schema.description = param.description;
|
|
48
|
+
}
|
|
49
|
+
if (param.enum) {
|
|
50
|
+
schema.enum = param.enum;
|
|
51
|
+
}
|
|
52
|
+
if (param.type === "array" && param.items) {
|
|
53
|
+
schema.items = parameterToJsonSchema(
|
|
54
|
+
param.items
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
if (param.type === "object" && param.properties) {
|
|
58
|
+
schema.properties = Object.fromEntries(
|
|
59
|
+
Object.entries(param.properties).map(([key, prop]) => [
|
|
60
|
+
key,
|
|
61
|
+
parameterToJsonSchema(
|
|
62
|
+
prop
|
|
63
|
+
)
|
|
64
|
+
])
|
|
65
|
+
);
|
|
66
|
+
schema.additionalProperties = false;
|
|
67
|
+
}
|
|
68
|
+
return schema;
|
|
69
|
+
}
|
|
42
70
|
function stripSchemaKeys(schema, keysToDrop, options = {}) {
|
|
43
71
|
if (Array.isArray(schema)) {
|
|
44
72
|
return schema.map((item) => stripSchemaKeys(item, keysToDrop, options));
|
|
@@ -863,11 +891,7 @@ var AnthropicAdapter = class {
|
|
|
863
891
|
properties: action.parameters ? Object.fromEntries(
|
|
864
892
|
Object.entries(action.parameters).map(([key, param]) => [
|
|
865
893
|
key,
|
|
866
|
-
|
|
867
|
-
type: param.type,
|
|
868
|
-
description: param.description,
|
|
869
|
-
enum: param.enum
|
|
870
|
-
}
|
|
894
|
+
parameterToJsonSchema(param)
|
|
871
895
|
])
|
|
872
896
|
) : {},
|
|
873
897
|
required: action.parameters ? Object.entries(action.parameters).filter(([, param]) => param.required).map(([key]) => key) : []
|
|
@@ -37,6 +37,34 @@ ${stringifyForDebug(payload)}`
|
|
|
37
37
|
);
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
+
function parameterToJsonSchema(param) {
|
|
41
|
+
const schema = {
|
|
42
|
+
type: param.type
|
|
43
|
+
};
|
|
44
|
+
if (param.description) {
|
|
45
|
+
schema.description = param.description;
|
|
46
|
+
}
|
|
47
|
+
if (param.enum) {
|
|
48
|
+
schema.enum = param.enum;
|
|
49
|
+
}
|
|
50
|
+
if (param.type === "array" && param.items) {
|
|
51
|
+
schema.items = parameterToJsonSchema(
|
|
52
|
+
param.items
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
if (param.type === "object" && param.properties) {
|
|
56
|
+
schema.properties = Object.fromEntries(
|
|
57
|
+
Object.entries(param.properties).map(([key, prop]) => [
|
|
58
|
+
key,
|
|
59
|
+
parameterToJsonSchema(
|
|
60
|
+
prop
|
|
61
|
+
)
|
|
62
|
+
])
|
|
63
|
+
);
|
|
64
|
+
schema.additionalProperties = false;
|
|
65
|
+
}
|
|
66
|
+
return schema;
|
|
67
|
+
}
|
|
40
68
|
function stripSchemaKeys(schema, keysToDrop, options = {}) {
|
|
41
69
|
if (Array.isArray(schema)) {
|
|
42
70
|
return schema.map((item) => stripSchemaKeys(item, keysToDrop, options));
|
|
@@ -861,11 +889,7 @@ var AnthropicAdapter = class {
|
|
|
861
889
|
properties: action.parameters ? Object.fromEntries(
|
|
862
890
|
Object.entries(action.parameters).map(([key, param]) => [
|
|
863
891
|
key,
|
|
864
|
-
|
|
865
|
-
type: param.type,
|
|
866
|
-
description: param.description,
|
|
867
|
-
enum: param.enum
|
|
868
|
-
}
|
|
892
|
+
parameterToJsonSchema(param)
|
|
869
893
|
])
|
|
870
894
|
) : {},
|
|
871
895
|
required: action.parameters ? Object.entries(action.parameters).filter(([, param]) => param.required).map(([key]) => key) : []
|