@agentica/core 0.30.1 → 0.30.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.
- package/lib/factory/events.js +2 -0
- package/lib/factory/events.js.map +1 -1
- package/lib/index.mjs +34 -112
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/call.js +22 -20
- package/lib/orchestrate/call.js.map +1 -1
- package/lib/orchestrate/cancel.js +0 -3
- package/lib/orchestrate/cancel.js.map +1 -1
- package/lib/orchestrate/initialize.js +0 -92
- package/lib/orchestrate/initialize.js.map +1 -1
- package/lib/orchestrate/internal/completeValidationError.d.ts +2 -0
- package/lib/orchestrate/internal/completeValidationError.js +22 -0
- package/lib/orchestrate/internal/completeValidationError.js.map +1 -0
- package/lib/orchestrate/select.js +0 -3
- package/lib/orchestrate/select.js.map +1 -1
- package/package.json +5 -5
- package/src/factory/events.ts +3 -0
- package/src/orchestrate/call.ts +29 -24
- package/src/orchestrate/internal/completeValidationError.ts +22 -0
package/lib/index.mjs
CHANGED
|
@@ -279,6 +279,20 @@ const AgenticaOperationComposer = {
|
|
|
279
279
|
compose
|
|
280
280
|
};
|
|
281
281
|
|
|
282
|
+
function complementValidationError(check) {
|
|
283
|
+
for (const error of check.errors) {
|
|
284
|
+
if (error.value !== undefined) {
|
|
285
|
+
continue;
|
|
286
|
+
}
|
|
287
|
+
const description = [ "> You AI have not defined the value (`undefined`).", ">", `> Please fill the \`${error.expected}\` typed value at the next time.` ].join("\n");
|
|
288
|
+
if (error.description === undefined || error.description.length === 0) {
|
|
289
|
+
error.description = description;
|
|
290
|
+
} else {
|
|
291
|
+
error.description += `\n\n${description}`;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
282
296
|
function decodeHistory(history) {
|
|
283
297
|
if (history.type === "describe") {
|
|
284
298
|
return [];
|
|
@@ -588,6 +602,7 @@ function createJsonParseErrorEvent(props) {
|
|
|
588
602
|
}
|
|
589
603
|
|
|
590
604
|
function createValidateEvent(props) {
|
|
605
|
+
complementValidationError(props.result);
|
|
591
606
|
const created_at = (new Date).toISOString();
|
|
592
607
|
return {
|
|
593
608
|
type: "validate",
|
|
@@ -1118,6 +1133,7 @@ async function call(ctx, operations) {
|
|
|
1118
1133
|
const chunks = await StreamUtil.readAll(stream);
|
|
1119
1134
|
const completion = ChatGptCompletionMessageUtil.merge(chunks);
|
|
1120
1135
|
const executes = [];
|
|
1136
|
+
const retry = ctx.config?.retry ?? AgenticaConstant.RETRY;
|
|
1121
1137
|
for (const choice of completion.choices) {
|
|
1122
1138
|
for (const tc of choice.message.tool_calls ?? []) {
|
|
1123
1139
|
if (tc.type === "function") {
|
|
@@ -1125,7 +1141,7 @@ async function call(ctx, operations) {
|
|
|
1125
1141
|
if (operation === undefined) {
|
|
1126
1142
|
continue;
|
|
1127
1143
|
}
|
|
1128
|
-
const event = await predicate(ctx, operation, tc, [],
|
|
1144
|
+
const event = await predicate(ctx, operation, tc, [], retry);
|
|
1129
1145
|
ctx.dispatch(event);
|
|
1130
1146
|
executes.push(event);
|
|
1131
1147
|
if (isAgenticaContext(ctx)) {
|
|
@@ -1166,9 +1182,7 @@ async function predicate(ctx, operation, toolCall, previousValidationErrors, lif
|
|
|
1166
1182
|
ctx.dispatch(event);
|
|
1167
1183
|
return correctTypeError(ctx, call, event, [ ...previousValidationErrors, event ], life - 1);
|
|
1168
1184
|
}
|
|
1169
|
-
|
|
1170
|
-
ctx.dispatch(execute);
|
|
1171
|
-
return execute;
|
|
1185
|
+
return executeFunction(call, operation);
|
|
1172
1186
|
}
|
|
1173
1187
|
|
|
1174
1188
|
async function correctTypeError(ctx, callEvent, validateEvent, previousValidationErrors, life) {
|
|
@@ -1183,11 +1197,10 @@ async function correctTypeError(ctx, callEvent, validateEvent, previousValidatio
|
|
|
1183
1197
|
}
|
|
1184
1198
|
}),
|
|
1185
1199
|
operation: callEvent.operation,
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
tool_call_id: callEvent.id
|
|
1200
|
+
toolCall: {
|
|
1201
|
+
id: callEvent.id,
|
|
1202
|
+
arguments: JSON.stringify(callEvent.arguments),
|
|
1203
|
+
result: JSON.stringify(validateEvent.result.errors)
|
|
1191
1204
|
},
|
|
1192
1205
|
systemPrompt: ctx.config?.systemPrompt?.validate?.(previousValidationErrors.slice(0, -1)) ?? [ AgenticaSystemPrompt.VALIDATE, ...previousValidationErrors.length > 1 ? [ "", AgenticaSystemPrompt.VALIDATE_REPEATED.replace("${{HISTORICAL_ERRORS}}", JSON.stringify(previousValidationErrors.slice(0, -1).map((e => e.result.errors)))) ] : [] ].join("\n"),
|
|
1193
1206
|
life,
|
|
@@ -1208,8 +1221,11 @@ async function correctJsonError(ctx, parseErrorEvent, previousValidationErrors,
|
|
|
1208
1221
|
}
|
|
1209
1222
|
}),
|
|
1210
1223
|
operation: parseErrorEvent.operation,
|
|
1211
|
-
|
|
1212
|
-
|
|
1224
|
+
toolCall: {
|
|
1225
|
+
id: parseErrorEvent.id,
|
|
1226
|
+
arguments: parseErrorEvent.arguments,
|
|
1227
|
+
result: parseErrorEvent.errorMessage
|
|
1228
|
+
},
|
|
1213
1229
|
systemPrompt: ctx.config?.systemPrompt?.jsonParseError?.(parseErrorEvent) ?? AgenticaSystemPrompt.JSON_PARSE_ERROR.replace("${{ERROR_MESSAGE}}", parseErrorEvent.errorMessage),
|
|
1214
1230
|
life,
|
|
1215
1231
|
previousValidationErrors
|
|
@@ -1252,13 +1268,17 @@ async function correctError(ctx, props) {
|
|
|
1252
1268
|
role: "assistant",
|
|
1253
1269
|
tool_calls: [ {
|
|
1254
1270
|
type: "function",
|
|
1255
|
-
id:
|
|
1271
|
+
id: props.toolCall.id,
|
|
1256
1272
|
function: {
|
|
1257
1273
|
name: props.operation.name,
|
|
1258
|
-
arguments: props.
|
|
1274
|
+
arguments: props.toolCall.arguments
|
|
1259
1275
|
}
|
|
1260
1276
|
} ]
|
|
1261
|
-
},
|
|
1277
|
+
}, {
|
|
1278
|
+
role: "tool",
|
|
1279
|
+
content: props.toolCall.result,
|
|
1280
|
+
tool_call_id: props.toolCall.id
|
|
1281
|
+
}, {
|
|
1262
1282
|
role: "system",
|
|
1263
1283
|
content: props.systemPrompt
|
|
1264
1284
|
} ],
|
|
@@ -1367,7 +1387,6 @@ const CONTAINER$1 = {
|
|
|
1367
1387
|
type: "object",
|
|
1368
1388
|
properties: {
|
|
1369
1389
|
functions: {
|
|
1370
|
-
title: "List of target functions",
|
|
1371
1390
|
description: "List of target functions.",
|
|
1372
1391
|
type: "array",
|
|
1373
1392
|
items: {
|
|
@@ -1382,12 +1401,10 @@ const CONTAINER$1 = {
|
|
|
1382
1401
|
type: "object",
|
|
1383
1402
|
properties: {
|
|
1384
1403
|
reason: {
|
|
1385
|
-
title: "The reason of the function selection",
|
|
1386
1404
|
description: "The reason of the function selection.\n\nJust write the reason why you've determined to select this function.",
|
|
1387
1405
|
type: "string"
|
|
1388
1406
|
},
|
|
1389
1407
|
name: {
|
|
1390
|
-
title: "Name of the target function to call",
|
|
1391
1408
|
description: "Name of the target function to call.",
|
|
1392
1409
|
type: "string"
|
|
1393
1410
|
}
|
|
@@ -1863,31 +1880,25 @@ const FUNCTION = {
|
|
|
1863
1880
|
type: "object",
|
|
1864
1881
|
properties: {
|
|
1865
1882
|
method: {
|
|
1866
|
-
title: "HTTP method of the endpoint",
|
|
1867
1883
|
description: "HTTP method of the endpoint.",
|
|
1868
1884
|
type: "string",
|
|
1869
1885
|
enum: [ "get", "post", "patch", "put", "delete" ]
|
|
1870
1886
|
},
|
|
1871
1887
|
path: {
|
|
1872
|
-
title: "Path of the endpoint",
|
|
1873
1888
|
description: "Path of the endpoint.",
|
|
1874
1889
|
type: "string"
|
|
1875
1890
|
},
|
|
1876
1891
|
name: {
|
|
1877
|
-
title: "Representative name of the function",
|
|
1878
1892
|
description: "Representative name of the function.\n\nThe `name` is a repsentative name identifying the function in the\n{@link IHttpLlmApplication}. The `name` value is just composed by joining\nthe {@link IHttpMigrateRoute.accessor} by underscore `_` character.\n\nHere is the composition rule of the {@link IHttpMigrateRoute.accessor}:\n\n> The `accessor` is composed with the following rules. At first, namespaces\n> are composed by static directory names in the {@link path}. Parametric\n> symbols represented by `:param` or `{param}` cannot be a part of the\n> namespace.\n\n> Instead, they would be a part of the function name. The function name is\n> composed with the {@link method HTTP method} and parametric symbols like\n> `getByParam` or `postByParam`. If there are multiple path parameters, they\n> would be concatenated by `And` like `getByParam1AndParam2`.\n\n> For refefence, if the {@link operation}'s {@link method} is `delete`, the\n> function name would be replaced to `erase` instead of `delete`. It is the\n> reason why the `delete` is a reserved keyword in many programming\n> languages.\n\n> - Example 1\n\n> - Path: `POST /shopping/sellers/sales`\n> - Accessor: `shopping.sellers.sales.post`\n> - Example 2\n\n> - Endpoint: `GET\n> /shoppings/sellers/sales/:saleId/reviews/:reviewId/comments/:id\n> - Accessor:\n> `shoppings.sellers.sales.reviews.getBySaleIdAndReviewIdAndCommentId`\n\n\n@maxLength 64",
|
|
1879
1893
|
type: "string"
|
|
1880
1894
|
},
|
|
1881
1895
|
parameters: {
|
|
1882
|
-
title: "List of parameter types",
|
|
1883
1896
|
$ref: "#/$defs/IChatGptSchema.IParameters"
|
|
1884
1897
|
},
|
|
1885
1898
|
separated: {
|
|
1886
|
-
title: "Collection of separated parameters",
|
|
1887
1899
|
$ref: "#/$defs/IHttpLlmFunction.ISeparatedchatgpt"
|
|
1888
1900
|
},
|
|
1889
1901
|
output: {
|
|
1890
|
-
title: "Expected return type",
|
|
1891
1902
|
description: "Expected return type.\n\nIf the target operation returns nothing (`void`), the `output` would be\n`undefined`.",
|
|
1892
1903
|
anyOf: [ {
|
|
1893
1904
|
$ref: "#/$defs/IChatGptSchema.IString"
|
|
@@ -1912,17 +1923,14 @@ const FUNCTION = {
|
|
|
1912
1923
|
} ]
|
|
1913
1924
|
},
|
|
1914
1925
|
description: {
|
|
1915
|
-
title: "Description of the function",
|
|
1916
1926
|
description: "Description of the function.\n\n`IHttpLlmFunction.description` is composed by below rule:\n\n1. Starts from the {@link OpenApi.IOperation.summary} paragraph.\n2. The next paragraphs are filled with the\n {@link OpenApi.IOperation.description}. By the way, if the first\n paragraph of {@link OpenApi.IOperation.description} is same with the\n {@link OpenApi.IOperation.summary}, it would not be duplicated.\n3. Parameters' descriptions are added with `@param` tag.\n4. {@link OpenApi.IOperation.security Security requirements} are added with\n `@security` tag.\n5. Tag names are added with `@tag` tag.\n6. If {@link OpenApi.IOperation.deprecated}, `@deprecated` tag is added.\n\nFor reference, the `description` is very important property to teach the\npurpose of the function to the LLM (Language Large Model), and LLM actually\ndetermines which function to call by the description.\n\nAlso, when the LLM conversates with the user, the `description` is used to\nexplain the function to the user. Therefore, the `description` property has\nthe highest priority, and you have to consider it.",
|
|
1917
1927
|
type: "string"
|
|
1918
1928
|
},
|
|
1919
1929
|
deprecated: {
|
|
1920
|
-
title: "Whether the function is deprecated or not",
|
|
1921
1930
|
description: "Whether the function is deprecated or not.\n\nIf the `deprecated` is `true`, the function is not recommended to use.\n\nLLM (Large Language Model) may not use the deprecated function.",
|
|
1922
1931
|
type: "boolean"
|
|
1923
1932
|
},
|
|
1924
1933
|
tags: {
|
|
1925
|
-
title: "Category tags for the function",
|
|
1926
1934
|
description: "Category tags for the function.\n\nSame with {@link OpenApi.IOperation.tags} indicating the category of the\nfunction.",
|
|
1927
1935
|
type: "array",
|
|
1928
1936
|
items: {
|
|
@@ -1937,27 +1945,22 @@ const FUNCTION = {
|
|
|
1937
1945
|
type: "object",
|
|
1938
1946
|
properties: {
|
|
1939
1947
|
$defs: {
|
|
1940
|
-
title: "Collection of the named types",
|
|
1941
1948
|
$ref: "#/$defs/RecordstringIChatGptSchema"
|
|
1942
1949
|
},
|
|
1943
1950
|
additionalProperties: {
|
|
1944
|
-
title: "Additional properties' info",
|
|
1945
1951
|
description: "Additional properties' info.\n\nThe `additionalProperties` means the type schema info of the additional\nproperties that are not listed in the {@link properties}.\n\nBy the way, it is not allowed in the parameters level.",
|
|
1946
1952
|
type: "boolean",
|
|
1947
1953
|
enum: [ false ]
|
|
1948
1954
|
},
|
|
1949
1955
|
type: {
|
|
1950
|
-
title: "Discriminator value of the type",
|
|
1951
1956
|
description: "Discriminator value of the type.",
|
|
1952
1957
|
type: "string",
|
|
1953
1958
|
enum: [ "object" ]
|
|
1954
1959
|
},
|
|
1955
1960
|
properties: {
|
|
1956
|
-
title: "Properties of the object",
|
|
1957
1961
|
$ref: "#/$defs/RecordstringIChatGptSchema"
|
|
1958
1962
|
},
|
|
1959
1963
|
required: {
|
|
1960
|
-
title: "List of key values of the required properties",
|
|
1961
1964
|
description: 'List of key values of the required properties.\n\nThe `required` means a list of the key values of the required\n{@link properties}. If some property key is not listed in the `required`\nlist, it means that property is optional. Otherwise some property key\nexists in the `required` list, it means that the property must be\nfilled.\n\nBelow is an example of the {@link properties} and `required`.\n\n```typescript\ninterface SomeObject {\n id: string;\n email: string;\n name?: string;\n}\n```\n\nAs you can see, `id` and `email` {@link properties} are {@link required},\nso that they are listed in the `required` list.\n\n```json\n{\n "type": "object",\n "properties": {\n "id": { "type": "string" },\n "email": { "type": "string" },\n "name": { "type": "string" }\n },\n "required": ["id", "email"]\n}\n```',
|
|
1962
1965
|
type: "array",
|
|
1963
1966
|
items: {
|
|
@@ -1965,26 +1968,21 @@ const FUNCTION = {
|
|
|
1965
1968
|
}
|
|
1966
1969
|
},
|
|
1967
1970
|
title: {
|
|
1968
|
-
title: "Title of the schema",
|
|
1969
1971
|
description: "Title of the schema.",
|
|
1970
1972
|
type: "string"
|
|
1971
1973
|
},
|
|
1972
1974
|
description: {
|
|
1973
|
-
title: "Detailed description of the schema",
|
|
1974
1975
|
description: "Detailed description of the schema.",
|
|
1975
1976
|
type: "string"
|
|
1976
1977
|
},
|
|
1977
1978
|
deprecated: {
|
|
1978
|
-
title: "Whether the type is deprecated or not",
|
|
1979
1979
|
description: "Whether the type is deprecated or not.",
|
|
1980
1980
|
type: "boolean"
|
|
1981
1981
|
},
|
|
1982
1982
|
example: {
|
|
1983
|
-
title: "Example value",
|
|
1984
1983
|
description: "Example value."
|
|
1985
1984
|
},
|
|
1986
1985
|
examples: {
|
|
1987
|
-
title: "List of example values as key-value pairs",
|
|
1988
1986
|
$ref: "#/$defs/Recordstringany"
|
|
1989
1987
|
}
|
|
1990
1988
|
},
|
|
@@ -2000,7 +1998,6 @@ const FUNCTION = {
|
|
|
2000
1998
|
}
|
|
2001
1999
|
},
|
|
2002
2000
|
IChatGptSchema: {
|
|
2003
|
-
title: "Type schema info of the ChatGPT",
|
|
2004
2001
|
description: 'Type schema info of the ChatGPT.\n\n`IChatGptSchema` is a type schema info of the ChatGPT function calling.\n\n`IChatGptSchema` basically follows the JSON schema definition of the OpenAPI\nv3.1 speciifcation; {@link OpenApiV3_1.IJsonSchema}.\n\nHowever, the `IChatGptSchema` does not follow the entire specification of the\nOpenAPI v3.1. It has own specific restrictions and definitions. Here is the\nlist of how `IChatGptSchema` is different with the OpenAPI v3.1 JSON schema.\n\n- Decompose mixed type: {@link OpenApiV3_1.IJsonSchema.IMixed}\n- Resolve nullable property:\n {@link OpenApiV3_1.IJsonSchema.__ISignificant.nullable}\n- Tuple type is banned: {@link OpenApiV3_1.IJsonSchema.ITuple.prefixItems}\n- Constant type is banned: {@link OpenApiV3_1.IJsonSchema.IConstant}\n- Merge {@link OpenApiV3_1.IJsonSchema.IOneOf} to {@link IChatGptSchema.IAnOf}\n- Merge {@link OpenApiV3_1.IJsonSchema.IAllOf} to {@link IChatGptSchema.IObject}\n- Merge {@link OpenApiV3_1.IJsonSchema.IRecursiveReference} to\n {@link IChatGptSchema.IReference}\n- When {@link IChatGptSchema.IConfig.strict} mode\n\n - Every object properties must be required\n - Do not allow {@link IChatGptSchema.IObject.additionalProperties}\n\nIf compare with the {@link OpenApi.IJsonSchema}, the emended JSON schema\nspecification,\n\n- {@link IChatGptSchema.IAnyOf} instead of the {@link OpenApi.IJsonSchema.IOneOf}\n- {@link IChatGptSchema.IParameters.$defs} instead of the\n {@link OpenApi.IJsonSchema.IComponents.schemas}\n- {@link IChatGptSchema.IString.enum} instead of the\n {@link OpenApi.IJsonSchema.IConstant}\n- {@link IChatGptSchema.additionalProperties} is fixed to `false`\n- No tuple type {@link OpenApi.IJsonSchema.ITuple} support\n- When {@link IChatGptSchema.IConfig.strict} mode\n\n - Every object properties must be required\n - Do not allow {@link IChatGptSchema.IObject.additionalProperties}\n\nFor reference, if you\'ve composed the `IChatGptSchema` type with the\n{@link IChatGptSchema.IConfig.reference} `false` option (default is `false`),\nonly the recursived named types would be archived into the\n{@link IChatGptSchema.IParameters.$defs}, and the others would be ecaped from\nthe {@link IChatGptSchema.IReference} type.\n\nAlso, OpenAI has banned below constraint properties. Instead,\n`IChatGptSchema` fills the {@link IChatGptSchema.__IAttribute.description}\nproperty with the comment text like `"@format uuid"`.\n\n- {@link OpenApi.IJsonSchema.INumber.minimum}\n- {@link OpenApi.IJsonSchema.INumber.maximum}\n- {@link OpenApi.IJsonSchema.INumber.multipleOf}\n- {@link OpenApi.IJsonSchema.IString.minLength}\n- {@link OpenApi.IJsonSchema.IString.maxLength}\n- {@link OpenApi.IJsonSchema.IString.format}\n- {@link OpenApi.IJsonSchema.IString.pattern}\n- {@link OpenApi.IJsonSchema.IString.contentMediaType}\n- {@link OpenApi.IJsonSchema.IString.default}\n- {@link OpenApi.IJsonSchema.IArray.minItems}\n- {@link OpenApi.IJsonSchema.IArray.maxItems}\n- {@link OpenApi.IJsonSchema.IArray.unique}\n\nAdditionally, OpenAI cannot define the `description` property to the\n{@link IChatGptSchema.IReference} type, and even does not understand the\ncapsulization to the {@link IChatGptSchema.IAnyOf} type. Therefore, the\n`description` is written to the parent object type, not the reference type.\n\n```json\n{\n "type": "object",\n "description": "### Description of {@link something} property.\\n\\n> Hello?",\n "properties": {\n "something": {\n "$ref": "#/$defs/SomeObject"\n }\n }\n}\n```',
|
|
2005
2002
|
anyOf: [ {
|
|
2006
2003
|
$ref: "#/$defs/IChatGptSchema.IBoolean"
|
|
@@ -2029,7 +2026,6 @@ const FUNCTION = {
|
|
|
2029
2026
|
type: "object",
|
|
2030
2027
|
properties: {
|
|
2031
2028
|
enum: {
|
|
2032
|
-
title: "Enumeration values",
|
|
2033
2029
|
description: "Enumeration values.",
|
|
2034
2030
|
type: "array",
|
|
2035
2031
|
items: {
|
|
@@ -2037,32 +2033,26 @@ const FUNCTION = {
|
|
|
2037
2033
|
}
|
|
2038
2034
|
},
|
|
2039
2035
|
type: {
|
|
2040
|
-
title: "Discriminator value of the type",
|
|
2041
2036
|
description: "Discriminator value of the type.",
|
|
2042
2037
|
type: "string",
|
|
2043
2038
|
enum: [ "boolean" ]
|
|
2044
2039
|
},
|
|
2045
2040
|
title: {
|
|
2046
|
-
title: "Title of the schema",
|
|
2047
2041
|
description: "Title of the schema.",
|
|
2048
2042
|
type: "string"
|
|
2049
2043
|
},
|
|
2050
2044
|
description: {
|
|
2051
|
-
title: "Detailed description of the schema",
|
|
2052
2045
|
description: "Detailed description of the schema.",
|
|
2053
2046
|
type: "string"
|
|
2054
2047
|
},
|
|
2055
2048
|
deprecated: {
|
|
2056
|
-
title: "Whether the type is deprecated or not",
|
|
2057
2049
|
description: "Whether the type is deprecated or not.",
|
|
2058
2050
|
type: "boolean"
|
|
2059
2051
|
},
|
|
2060
2052
|
example: {
|
|
2061
|
-
title: "Example value",
|
|
2062
2053
|
description: "Example value."
|
|
2063
2054
|
},
|
|
2064
2055
|
examples: {
|
|
2065
|
-
title: "List of example values as key-value pairs",
|
|
2066
2056
|
$ref: "#/$defs/Recordstringany"
|
|
2067
2057
|
}
|
|
2068
2058
|
},
|
|
@@ -2080,7 +2070,6 @@ const FUNCTION = {
|
|
|
2080
2070
|
type: "object",
|
|
2081
2071
|
properties: {
|
|
2082
2072
|
enum: {
|
|
2083
|
-
title: "Enumeration values",
|
|
2084
2073
|
description: "Enumeration values.",
|
|
2085
2074
|
type: "array",
|
|
2086
2075
|
items: {
|
|
@@ -2088,32 +2077,26 @@ const FUNCTION = {
|
|
|
2088
2077
|
}
|
|
2089
2078
|
},
|
|
2090
2079
|
type: {
|
|
2091
|
-
title: "Discriminator value of the type",
|
|
2092
2080
|
description: "Discriminator value of the type.",
|
|
2093
2081
|
type: "string",
|
|
2094
2082
|
enum: [ "integer" ]
|
|
2095
2083
|
},
|
|
2096
2084
|
title: {
|
|
2097
|
-
title: "Title of the schema",
|
|
2098
2085
|
description: "Title of the schema.",
|
|
2099
2086
|
type: "string"
|
|
2100
2087
|
},
|
|
2101
2088
|
description: {
|
|
2102
|
-
title: "Detailed description of the schema",
|
|
2103
2089
|
description: "Detailed description of the schema.",
|
|
2104
2090
|
type: "string"
|
|
2105
2091
|
},
|
|
2106
2092
|
deprecated: {
|
|
2107
|
-
title: "Whether the type is deprecated or not",
|
|
2108
2093
|
description: "Whether the type is deprecated or not.",
|
|
2109
2094
|
type: "boolean"
|
|
2110
2095
|
},
|
|
2111
2096
|
example: {
|
|
2112
|
-
title: "Example value",
|
|
2113
2097
|
description: "Example value."
|
|
2114
2098
|
},
|
|
2115
2099
|
examples: {
|
|
2116
|
-
title: "List of example values as key-value pairs",
|
|
2117
2100
|
$ref: "#/$defs/Recordstringany"
|
|
2118
2101
|
}
|
|
2119
2102
|
},
|
|
@@ -2124,7 +2107,6 @@ const FUNCTION = {
|
|
|
2124
2107
|
type: "object",
|
|
2125
2108
|
properties: {
|
|
2126
2109
|
enum: {
|
|
2127
|
-
title: "Enumeration values",
|
|
2128
2110
|
description: "Enumeration values.",
|
|
2129
2111
|
type: "array",
|
|
2130
2112
|
items: {
|
|
@@ -2132,32 +2114,26 @@ const FUNCTION = {
|
|
|
2132
2114
|
}
|
|
2133
2115
|
},
|
|
2134
2116
|
type: {
|
|
2135
|
-
title: "Discriminator value of the type",
|
|
2136
2117
|
description: "Discriminator value of the type.",
|
|
2137
2118
|
type: "string",
|
|
2138
2119
|
enum: [ "number" ]
|
|
2139
2120
|
},
|
|
2140
2121
|
title: {
|
|
2141
|
-
title: "Title of the schema",
|
|
2142
2122
|
description: "Title of the schema.",
|
|
2143
2123
|
type: "string"
|
|
2144
2124
|
},
|
|
2145
2125
|
description: {
|
|
2146
|
-
title: "Detailed description of the schema",
|
|
2147
2126
|
description: "Detailed description of the schema.",
|
|
2148
2127
|
type: "string"
|
|
2149
2128
|
},
|
|
2150
2129
|
deprecated: {
|
|
2151
|
-
title: "Whether the type is deprecated or not",
|
|
2152
2130
|
description: "Whether the type is deprecated or not.",
|
|
2153
2131
|
type: "boolean"
|
|
2154
2132
|
},
|
|
2155
2133
|
example: {
|
|
2156
|
-
title: "Example value",
|
|
2157
2134
|
description: "Example value."
|
|
2158
2135
|
},
|
|
2159
2136
|
examples: {
|
|
2160
|
-
title: "List of example values as key-value pairs",
|
|
2161
2137
|
$ref: "#/$defs/Recordstringany"
|
|
2162
2138
|
}
|
|
2163
2139
|
},
|
|
@@ -2168,7 +2144,6 @@ const FUNCTION = {
|
|
|
2168
2144
|
type: "object",
|
|
2169
2145
|
properties: {
|
|
2170
2146
|
enum: {
|
|
2171
|
-
title: "Enumeration values",
|
|
2172
2147
|
description: "Enumeration values.",
|
|
2173
2148
|
type: "array",
|
|
2174
2149
|
items: {
|
|
@@ -2176,32 +2151,26 @@ const FUNCTION = {
|
|
|
2176
2151
|
}
|
|
2177
2152
|
},
|
|
2178
2153
|
type: {
|
|
2179
|
-
title: "Discriminator value of the type",
|
|
2180
2154
|
description: "Discriminator value of the type.",
|
|
2181
2155
|
type: "string",
|
|
2182
2156
|
enum: [ "string" ]
|
|
2183
2157
|
},
|
|
2184
2158
|
title: {
|
|
2185
|
-
title: "Title of the schema",
|
|
2186
2159
|
description: "Title of the schema.",
|
|
2187
2160
|
type: "string"
|
|
2188
2161
|
},
|
|
2189
2162
|
description: {
|
|
2190
|
-
title: "Detailed description of the schema",
|
|
2191
2163
|
description: "Detailed description of the schema.",
|
|
2192
2164
|
type: "string"
|
|
2193
2165
|
},
|
|
2194
2166
|
deprecated: {
|
|
2195
|
-
title: "Whether the type is deprecated or not",
|
|
2196
2167
|
description: "Whether the type is deprecated or not.",
|
|
2197
2168
|
type: "boolean"
|
|
2198
2169
|
},
|
|
2199
2170
|
example: {
|
|
2200
|
-
title: "Example value",
|
|
2201
2171
|
description: "Example value."
|
|
2202
2172
|
},
|
|
2203
2173
|
examples: {
|
|
2204
|
-
title: "List of example values as key-value pairs",
|
|
2205
2174
|
$ref: "#/$defs/Recordstringany"
|
|
2206
2175
|
}
|
|
2207
2176
|
},
|
|
@@ -2212,36 +2181,29 @@ const FUNCTION = {
|
|
|
2212
2181
|
type: "object",
|
|
2213
2182
|
properties: {
|
|
2214
2183
|
items: {
|
|
2215
|
-
title: "Items type info",
|
|
2216
2184
|
$ref: "#/$defs/IChatGptSchema"
|
|
2217
2185
|
},
|
|
2218
2186
|
type: {
|
|
2219
|
-
title: "Discriminator value of the type",
|
|
2220
2187
|
description: "Discriminator value of the type.",
|
|
2221
2188
|
type: "string",
|
|
2222
2189
|
enum: [ "array" ]
|
|
2223
2190
|
},
|
|
2224
2191
|
title: {
|
|
2225
|
-
title: "Title of the schema",
|
|
2226
2192
|
description: "Title of the schema.",
|
|
2227
2193
|
type: "string"
|
|
2228
2194
|
},
|
|
2229
2195
|
description: {
|
|
2230
|
-
title: "Detailed description of the schema",
|
|
2231
2196
|
description: "Detailed description of the schema.",
|
|
2232
2197
|
type: "string"
|
|
2233
2198
|
},
|
|
2234
2199
|
deprecated: {
|
|
2235
|
-
title: "Whether the type is deprecated or not",
|
|
2236
2200
|
description: "Whether the type is deprecated or not.",
|
|
2237
2201
|
type: "boolean"
|
|
2238
2202
|
},
|
|
2239
2203
|
example: {
|
|
2240
|
-
title: "Example value",
|
|
2241
2204
|
description: "Example value."
|
|
2242
2205
|
},
|
|
2243
2206
|
examples: {
|
|
2244
|
-
title: "List of example values as key-value pairs",
|
|
2245
2207
|
$ref: "#/$defs/Recordstringany"
|
|
2246
2208
|
}
|
|
2247
2209
|
},
|
|
@@ -2252,11 +2214,9 @@ const FUNCTION = {
|
|
|
2252
2214
|
type: "object",
|
|
2253
2215
|
properties: {
|
|
2254
2216
|
properties: {
|
|
2255
|
-
title: "Properties of the object",
|
|
2256
2217
|
$ref: "#/$defs/RecordstringIChatGptSchema"
|
|
2257
2218
|
},
|
|
2258
2219
|
additionalProperties: {
|
|
2259
|
-
title: "Additional properties' info",
|
|
2260
2220
|
description: "Additional properties' info.\n\nThe `additionalProperties` means the type schema info of the additional\nproperties that are not listed in the {@link properties}.\n\nBy the way, if you've configured {@link IChatGptSchema.IConfig.strict} as\n`true`, ChatGPT function calling does not support such dynamic key typed\nproperties, so the `additionalProperties` becomes always `false`.",
|
|
2261
2221
|
anyOf: [ {
|
|
2262
2222
|
type: "boolean"
|
|
@@ -2283,7 +2243,6 @@ const FUNCTION = {
|
|
|
2283
2243
|
} ]
|
|
2284
2244
|
},
|
|
2285
2245
|
required: {
|
|
2286
|
-
title: "List of key values of the required properties",
|
|
2287
2246
|
description: 'List of key values of the required properties.\n\nThe `required` means a list of the key values of the required\n{@link properties}. If some property key is not listed in the `required`\nlist, it means that property is optional. Otherwise some property key\nexists in the `required` list, it means that the property must be\nfilled.\n\nBelow is an example of the {@link properties} and `required`.\n\n```typescript\ninterface SomeObject {\n id: string;\n email: string;\n name?: string;\n}\n```\n\nAs you can see, `id` and `email` {@link properties} are {@link required},\nso that they are listed in the `required` list.\n\n```json\n{\n "type": "object",\n "properties": {\n "id": { "type": "string" },\n "email": { "type": "string" },\n "name": { "type": "string" }\n },\n "required": ["id", "email"]\n}\n```',
|
|
2288
2247
|
type: "array",
|
|
2289
2248
|
items: {
|
|
@@ -2291,32 +2250,26 @@ const FUNCTION = {
|
|
|
2291
2250
|
}
|
|
2292
2251
|
},
|
|
2293
2252
|
type: {
|
|
2294
|
-
title: "Discriminator value of the type",
|
|
2295
2253
|
description: "Discriminator value of the type.",
|
|
2296
2254
|
type: "string",
|
|
2297
2255
|
enum: [ "object" ]
|
|
2298
2256
|
},
|
|
2299
2257
|
title: {
|
|
2300
|
-
title: "Title of the schema",
|
|
2301
2258
|
description: "Title of the schema.",
|
|
2302
2259
|
type: "string"
|
|
2303
2260
|
},
|
|
2304
2261
|
description: {
|
|
2305
|
-
title: "Detailed description of the schema",
|
|
2306
2262
|
description: "Detailed description of the schema.",
|
|
2307
2263
|
type: "string"
|
|
2308
2264
|
},
|
|
2309
2265
|
deprecated: {
|
|
2310
|
-
title: "Whether the type is deprecated or not",
|
|
2311
2266
|
description: "Whether the type is deprecated or not.",
|
|
2312
2267
|
type: "boolean"
|
|
2313
2268
|
},
|
|
2314
2269
|
example: {
|
|
2315
|
-
title: "Example value",
|
|
2316
2270
|
description: "Example value."
|
|
2317
2271
|
},
|
|
2318
2272
|
examples: {
|
|
2319
|
-
title: "List of example values as key-value pairs",
|
|
2320
2273
|
$ref: "#/$defs/Recordstringany"
|
|
2321
2274
|
}
|
|
2322
2275
|
},
|
|
@@ -2327,31 +2280,25 @@ const FUNCTION = {
|
|
|
2327
2280
|
type: "object",
|
|
2328
2281
|
properties: {
|
|
2329
2282
|
$ref: {
|
|
2330
|
-
title: "Reference to the named schema",
|
|
2331
2283
|
description: "Reference to the named schema.\n\nThe `ref` is a reference to the named schema. Format of the `$ref` is\nfollowing the JSON Pointer specification. In the OpenAPI, the `$ref`\nstarts with `#/$defs/` which means the type is stored in the\n{@link IChatGptSchema.IParameters.$defs} object.\n\n- `#/$defs/SomeObject`\n- `#/$defs/AnotherObject`",
|
|
2332
2284
|
type: "string"
|
|
2333
2285
|
},
|
|
2334
2286
|
title: {
|
|
2335
|
-
title: "Title of the schema",
|
|
2336
2287
|
description: "Title of the schema.",
|
|
2337
2288
|
type: "string"
|
|
2338
2289
|
},
|
|
2339
2290
|
description: {
|
|
2340
|
-
title: "Detailed description of the schema",
|
|
2341
2291
|
description: "Detailed description of the schema.",
|
|
2342
2292
|
type: "string"
|
|
2343
2293
|
},
|
|
2344
2294
|
deprecated: {
|
|
2345
|
-
title: "Whether the type is deprecated or not",
|
|
2346
2295
|
description: "Whether the type is deprecated or not.",
|
|
2347
2296
|
type: "boolean"
|
|
2348
2297
|
},
|
|
2349
2298
|
example: {
|
|
2350
|
-
title: "Example value",
|
|
2351
2299
|
description: "Example value."
|
|
2352
2300
|
},
|
|
2353
2301
|
examples: {
|
|
2354
|
-
title: "List of example values as key-value pairs",
|
|
2355
2302
|
$ref: "#/$defs/Recordstringany"
|
|
2356
2303
|
}
|
|
2357
2304
|
},
|
|
@@ -2362,7 +2309,6 @@ const FUNCTION = {
|
|
|
2362
2309
|
type: "object",
|
|
2363
2310
|
properties: {
|
|
2364
2311
|
anyOf: {
|
|
2365
|
-
title: "List of the union types",
|
|
2366
2312
|
description: "List of the union types.",
|
|
2367
2313
|
type: "array",
|
|
2368
2314
|
items: {
|
|
@@ -2388,30 +2334,24 @@ const FUNCTION = {
|
|
|
2388
2334
|
}
|
|
2389
2335
|
},
|
|
2390
2336
|
"x-discriminator": {
|
|
2391
|
-
title: "Discriminator info of the union type",
|
|
2392
2337
|
$ref: "#/$defs/IChatGptSchema.IAnyOf.IDiscriminator"
|
|
2393
2338
|
},
|
|
2394
2339
|
title: {
|
|
2395
|
-
title: "Title of the schema",
|
|
2396
2340
|
description: "Title of the schema.",
|
|
2397
2341
|
type: "string"
|
|
2398
2342
|
},
|
|
2399
2343
|
description: {
|
|
2400
|
-
title: "Detailed description of the schema",
|
|
2401
2344
|
description: "Detailed description of the schema.",
|
|
2402
2345
|
type: "string"
|
|
2403
2346
|
},
|
|
2404
2347
|
deprecated: {
|
|
2405
|
-
title: "Whether the type is deprecated or not",
|
|
2406
2348
|
description: "Whether the type is deprecated or not.",
|
|
2407
2349
|
type: "boolean"
|
|
2408
2350
|
},
|
|
2409
2351
|
example: {
|
|
2410
|
-
title: "Example value",
|
|
2411
2352
|
description: "Example value."
|
|
2412
2353
|
},
|
|
2413
2354
|
examples: {
|
|
2414
|
-
title: "List of example values as key-value pairs",
|
|
2415
2355
|
$ref: "#/$defs/Recordstringany"
|
|
2416
2356
|
}
|
|
2417
2357
|
},
|
|
@@ -2422,26 +2362,21 @@ const FUNCTION = {
|
|
|
2422
2362
|
type: "object",
|
|
2423
2363
|
properties: {
|
|
2424
2364
|
title: {
|
|
2425
|
-
title: "Title of the schema",
|
|
2426
2365
|
description: "Title of the schema.",
|
|
2427
2366
|
type: "string"
|
|
2428
2367
|
},
|
|
2429
2368
|
description: {
|
|
2430
|
-
title: "Detailed description of the schema",
|
|
2431
2369
|
description: "Detailed description of the schema.",
|
|
2432
2370
|
type: "string"
|
|
2433
2371
|
},
|
|
2434
2372
|
deprecated: {
|
|
2435
|
-
title: "Whether the type is deprecated or not",
|
|
2436
2373
|
description: "Whether the type is deprecated or not.",
|
|
2437
2374
|
type: "boolean"
|
|
2438
2375
|
},
|
|
2439
2376
|
example: {
|
|
2440
|
-
title: "Example value",
|
|
2441
2377
|
description: "Example value."
|
|
2442
2378
|
},
|
|
2443
2379
|
examples: {
|
|
2444
|
-
title: "List of example values as key-value pairs",
|
|
2445
2380
|
$ref: "#/$defs/Recordstringany"
|
|
2446
2381
|
}
|
|
2447
2382
|
},
|
|
@@ -2452,32 +2387,26 @@ const FUNCTION = {
|
|
|
2452
2387
|
type: "object",
|
|
2453
2388
|
properties: {
|
|
2454
2389
|
type: {
|
|
2455
|
-
title: "Discriminator value of the type",
|
|
2456
2390
|
description: "Discriminator value of the type.",
|
|
2457
2391
|
type: "string",
|
|
2458
2392
|
enum: [ "null" ]
|
|
2459
2393
|
},
|
|
2460
2394
|
title: {
|
|
2461
|
-
title: "Title of the schema",
|
|
2462
2395
|
description: "Title of the schema.",
|
|
2463
2396
|
type: "string"
|
|
2464
2397
|
},
|
|
2465
2398
|
description: {
|
|
2466
|
-
title: "Detailed description of the schema",
|
|
2467
2399
|
description: "Detailed description of the schema.",
|
|
2468
2400
|
type: "string"
|
|
2469
2401
|
},
|
|
2470
2402
|
deprecated: {
|
|
2471
|
-
title: "Whether the type is deprecated or not",
|
|
2472
2403
|
description: "Whether the type is deprecated or not.",
|
|
2473
2404
|
type: "boolean"
|
|
2474
2405
|
},
|
|
2475
2406
|
example: {
|
|
2476
|
-
title: "Example value",
|
|
2477
2407
|
description: "Example value."
|
|
2478
2408
|
},
|
|
2479
2409
|
examples: {
|
|
2480
|
-
title: "List of example values as key-value pairs",
|
|
2481
2410
|
$ref: "#/$defs/Recordstringany"
|
|
2482
2411
|
}
|
|
2483
2412
|
},
|
|
@@ -2488,12 +2417,10 @@ const FUNCTION = {
|
|
|
2488
2417
|
type: "object",
|
|
2489
2418
|
properties: {
|
|
2490
2419
|
propertyName: {
|
|
2491
|
-
title: "Property name for the discriminator",
|
|
2492
2420
|
description: "Property name for the discriminator.",
|
|
2493
2421
|
type: "string"
|
|
2494
2422
|
},
|
|
2495
2423
|
mapping: {
|
|
2496
|
-
title: "Mapping of the discriminator value to the schema name",
|
|
2497
2424
|
$ref: "#/$defs/Recordstringstring"
|
|
2498
2425
|
}
|
|
2499
2426
|
},
|
|
@@ -2513,11 +2440,9 @@ const FUNCTION = {
|
|
|
2513
2440
|
type: "object",
|
|
2514
2441
|
properties: {
|
|
2515
2442
|
llm: {
|
|
2516
|
-
title: "Parameters that would be composed by the LLM",
|
|
2517
2443
|
$ref: "#/$defs/IChatGptSchema.IParameters"
|
|
2518
2444
|
},
|
|
2519
2445
|
human: {
|
|
2520
|
-
title: "Parameters that would be composed by the human",
|
|
2521
2446
|
description: "Parameters that would be composed by the human.",
|
|
2522
2447
|
anyOf: [ {
|
|
2523
2448
|
type: "null"
|
|
@@ -2671,7 +2596,6 @@ const CONTAINER = {
|
|
|
2671
2596
|
type: "object",
|
|
2672
2597
|
properties: {
|
|
2673
2598
|
functions: {
|
|
2674
|
-
title: "List of target functions",
|
|
2675
2599
|
description: "List of target functions.",
|
|
2676
2600
|
type: "array",
|
|
2677
2601
|
items: {
|
|
@@ -2686,12 +2610,10 @@ const CONTAINER = {
|
|
|
2686
2610
|
type: "object",
|
|
2687
2611
|
properties: {
|
|
2688
2612
|
reason: {
|
|
2689
|
-
title: "The reason of the function selection",
|
|
2690
2613
|
description: "The reason of the function selection.\n\nJust write the reason why you've determined to select this function.",
|
|
2691
2614
|
type: "string"
|
|
2692
2615
|
},
|
|
2693
2616
|
name: {
|
|
2694
|
-
title: "Name of the target function to call",
|
|
2695
2617
|
description: "Name of the target function to call.",
|
|
2696
2618
|
type: "string"
|
|
2697
2619
|
}
|