@agentica/core 0.30.2 → 0.30.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.
- package/lib/MicroAgentica.js +4 -1
- package/lib/MicroAgentica.js.map +1 -1
- package/lib/factory/events.js +2 -0
- package/lib/factory/events.js.map +1 -1
- package/lib/index.mjs +16 -99
- package/lib/index.mjs.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/MicroAgentica.ts +3 -1
- package/src/factory/events.ts +3 -0
- 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",
|
|
@@ -1372,7 +1387,6 @@ const CONTAINER$1 = {
|
|
|
1372
1387
|
type: "object",
|
|
1373
1388
|
properties: {
|
|
1374
1389
|
functions: {
|
|
1375
|
-
title: "List of target functions",
|
|
1376
1390
|
description: "List of target functions.",
|
|
1377
1391
|
type: "array",
|
|
1378
1392
|
items: {
|
|
@@ -1387,12 +1401,10 @@ const CONTAINER$1 = {
|
|
|
1387
1401
|
type: "object",
|
|
1388
1402
|
properties: {
|
|
1389
1403
|
reason: {
|
|
1390
|
-
title: "The reason of the function selection",
|
|
1391
1404
|
description: "The reason of the function selection.\n\nJust write the reason why you've determined to select this function.",
|
|
1392
1405
|
type: "string"
|
|
1393
1406
|
},
|
|
1394
1407
|
name: {
|
|
1395
|
-
title: "Name of the target function to call",
|
|
1396
1408
|
description: "Name of the target function to call.",
|
|
1397
1409
|
type: "string"
|
|
1398
1410
|
}
|
|
@@ -1868,31 +1880,25 @@ const FUNCTION = {
|
|
|
1868
1880
|
type: "object",
|
|
1869
1881
|
properties: {
|
|
1870
1882
|
method: {
|
|
1871
|
-
title: "HTTP method of the endpoint",
|
|
1872
1883
|
description: "HTTP method of the endpoint.",
|
|
1873
1884
|
type: "string",
|
|
1874
1885
|
enum: [ "get", "post", "patch", "put", "delete" ]
|
|
1875
1886
|
},
|
|
1876
1887
|
path: {
|
|
1877
|
-
title: "Path of the endpoint",
|
|
1878
1888
|
description: "Path of the endpoint.",
|
|
1879
1889
|
type: "string"
|
|
1880
1890
|
},
|
|
1881
1891
|
name: {
|
|
1882
|
-
title: "Representative name of the function",
|
|
1883
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",
|
|
1884
1893
|
type: "string"
|
|
1885
1894
|
},
|
|
1886
1895
|
parameters: {
|
|
1887
|
-
title: "List of parameter types",
|
|
1888
1896
|
$ref: "#/$defs/IChatGptSchema.IParameters"
|
|
1889
1897
|
},
|
|
1890
1898
|
separated: {
|
|
1891
|
-
title: "Collection of separated parameters",
|
|
1892
1899
|
$ref: "#/$defs/IHttpLlmFunction.ISeparatedchatgpt"
|
|
1893
1900
|
},
|
|
1894
1901
|
output: {
|
|
1895
|
-
title: "Expected return type",
|
|
1896
1902
|
description: "Expected return type.\n\nIf the target operation returns nothing (`void`), the `output` would be\n`undefined`.",
|
|
1897
1903
|
anyOf: [ {
|
|
1898
1904
|
$ref: "#/$defs/IChatGptSchema.IString"
|
|
@@ -1917,17 +1923,14 @@ const FUNCTION = {
|
|
|
1917
1923
|
} ]
|
|
1918
1924
|
},
|
|
1919
1925
|
description: {
|
|
1920
|
-
title: "Description of the function",
|
|
1921
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.",
|
|
1922
1927
|
type: "string"
|
|
1923
1928
|
},
|
|
1924
1929
|
deprecated: {
|
|
1925
|
-
title: "Whether the function is deprecated or not",
|
|
1926
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.",
|
|
1927
1931
|
type: "boolean"
|
|
1928
1932
|
},
|
|
1929
1933
|
tags: {
|
|
1930
|
-
title: "Category tags for the function",
|
|
1931
1934
|
description: "Category tags for the function.\n\nSame with {@link OpenApi.IOperation.tags} indicating the category of the\nfunction.",
|
|
1932
1935
|
type: "array",
|
|
1933
1936
|
items: {
|
|
@@ -1942,27 +1945,22 @@ const FUNCTION = {
|
|
|
1942
1945
|
type: "object",
|
|
1943
1946
|
properties: {
|
|
1944
1947
|
$defs: {
|
|
1945
|
-
title: "Collection of the named types",
|
|
1946
1948
|
$ref: "#/$defs/RecordstringIChatGptSchema"
|
|
1947
1949
|
},
|
|
1948
1950
|
additionalProperties: {
|
|
1949
|
-
title: "Additional properties' info",
|
|
1950
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.",
|
|
1951
1952
|
type: "boolean",
|
|
1952
1953
|
enum: [ false ]
|
|
1953
1954
|
},
|
|
1954
1955
|
type: {
|
|
1955
|
-
title: "Discriminator value of the type",
|
|
1956
1956
|
description: "Discriminator value of the type.",
|
|
1957
1957
|
type: "string",
|
|
1958
1958
|
enum: [ "object" ]
|
|
1959
1959
|
},
|
|
1960
1960
|
properties: {
|
|
1961
|
-
title: "Properties of the object",
|
|
1962
1961
|
$ref: "#/$defs/RecordstringIChatGptSchema"
|
|
1963
1962
|
},
|
|
1964
1963
|
required: {
|
|
1965
|
-
title: "List of key values of the required properties",
|
|
1966
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```',
|
|
1967
1965
|
type: "array",
|
|
1968
1966
|
items: {
|
|
@@ -1970,26 +1968,21 @@ const FUNCTION = {
|
|
|
1970
1968
|
}
|
|
1971
1969
|
},
|
|
1972
1970
|
title: {
|
|
1973
|
-
title: "Title of the schema",
|
|
1974
1971
|
description: "Title of the schema.",
|
|
1975
1972
|
type: "string"
|
|
1976
1973
|
},
|
|
1977
1974
|
description: {
|
|
1978
|
-
title: "Detailed description of the schema",
|
|
1979
1975
|
description: "Detailed description of the schema.",
|
|
1980
1976
|
type: "string"
|
|
1981
1977
|
},
|
|
1982
1978
|
deprecated: {
|
|
1983
|
-
title: "Whether the type is deprecated or not",
|
|
1984
1979
|
description: "Whether the type is deprecated or not.",
|
|
1985
1980
|
type: "boolean"
|
|
1986
1981
|
},
|
|
1987
1982
|
example: {
|
|
1988
|
-
title: "Example value",
|
|
1989
1983
|
description: "Example value."
|
|
1990
1984
|
},
|
|
1991
1985
|
examples: {
|
|
1992
|
-
title: "List of example values as key-value pairs",
|
|
1993
1986
|
$ref: "#/$defs/Recordstringany"
|
|
1994
1987
|
}
|
|
1995
1988
|
},
|
|
@@ -2005,7 +1998,6 @@ const FUNCTION = {
|
|
|
2005
1998
|
}
|
|
2006
1999
|
},
|
|
2007
2000
|
IChatGptSchema: {
|
|
2008
|
-
title: "Type schema info of the ChatGPT",
|
|
2009
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```',
|
|
2010
2002
|
anyOf: [ {
|
|
2011
2003
|
$ref: "#/$defs/IChatGptSchema.IBoolean"
|
|
@@ -2034,7 +2026,6 @@ const FUNCTION = {
|
|
|
2034
2026
|
type: "object",
|
|
2035
2027
|
properties: {
|
|
2036
2028
|
enum: {
|
|
2037
|
-
title: "Enumeration values",
|
|
2038
2029
|
description: "Enumeration values.",
|
|
2039
2030
|
type: "array",
|
|
2040
2031
|
items: {
|
|
@@ -2042,32 +2033,26 @@ const FUNCTION = {
|
|
|
2042
2033
|
}
|
|
2043
2034
|
},
|
|
2044
2035
|
type: {
|
|
2045
|
-
title: "Discriminator value of the type",
|
|
2046
2036
|
description: "Discriminator value of the type.",
|
|
2047
2037
|
type: "string",
|
|
2048
2038
|
enum: [ "boolean" ]
|
|
2049
2039
|
},
|
|
2050
2040
|
title: {
|
|
2051
|
-
title: "Title of the schema",
|
|
2052
2041
|
description: "Title of the schema.",
|
|
2053
2042
|
type: "string"
|
|
2054
2043
|
},
|
|
2055
2044
|
description: {
|
|
2056
|
-
title: "Detailed description of the schema",
|
|
2057
2045
|
description: "Detailed description of the schema.",
|
|
2058
2046
|
type: "string"
|
|
2059
2047
|
},
|
|
2060
2048
|
deprecated: {
|
|
2061
|
-
title: "Whether the type is deprecated or not",
|
|
2062
2049
|
description: "Whether the type is deprecated or not.",
|
|
2063
2050
|
type: "boolean"
|
|
2064
2051
|
},
|
|
2065
2052
|
example: {
|
|
2066
|
-
title: "Example value",
|
|
2067
2053
|
description: "Example value."
|
|
2068
2054
|
},
|
|
2069
2055
|
examples: {
|
|
2070
|
-
title: "List of example values as key-value pairs",
|
|
2071
2056
|
$ref: "#/$defs/Recordstringany"
|
|
2072
2057
|
}
|
|
2073
2058
|
},
|
|
@@ -2085,7 +2070,6 @@ const FUNCTION = {
|
|
|
2085
2070
|
type: "object",
|
|
2086
2071
|
properties: {
|
|
2087
2072
|
enum: {
|
|
2088
|
-
title: "Enumeration values",
|
|
2089
2073
|
description: "Enumeration values.",
|
|
2090
2074
|
type: "array",
|
|
2091
2075
|
items: {
|
|
@@ -2093,32 +2077,26 @@ const FUNCTION = {
|
|
|
2093
2077
|
}
|
|
2094
2078
|
},
|
|
2095
2079
|
type: {
|
|
2096
|
-
title: "Discriminator value of the type",
|
|
2097
2080
|
description: "Discriminator value of the type.",
|
|
2098
2081
|
type: "string",
|
|
2099
2082
|
enum: [ "integer" ]
|
|
2100
2083
|
},
|
|
2101
2084
|
title: {
|
|
2102
|
-
title: "Title of the schema",
|
|
2103
2085
|
description: "Title of the schema.",
|
|
2104
2086
|
type: "string"
|
|
2105
2087
|
},
|
|
2106
2088
|
description: {
|
|
2107
|
-
title: "Detailed description of the schema",
|
|
2108
2089
|
description: "Detailed description of the schema.",
|
|
2109
2090
|
type: "string"
|
|
2110
2091
|
},
|
|
2111
2092
|
deprecated: {
|
|
2112
|
-
title: "Whether the type is deprecated or not",
|
|
2113
2093
|
description: "Whether the type is deprecated or not.",
|
|
2114
2094
|
type: "boolean"
|
|
2115
2095
|
},
|
|
2116
2096
|
example: {
|
|
2117
|
-
title: "Example value",
|
|
2118
2097
|
description: "Example value."
|
|
2119
2098
|
},
|
|
2120
2099
|
examples: {
|
|
2121
|
-
title: "List of example values as key-value pairs",
|
|
2122
2100
|
$ref: "#/$defs/Recordstringany"
|
|
2123
2101
|
}
|
|
2124
2102
|
},
|
|
@@ -2129,7 +2107,6 @@ const FUNCTION = {
|
|
|
2129
2107
|
type: "object",
|
|
2130
2108
|
properties: {
|
|
2131
2109
|
enum: {
|
|
2132
|
-
title: "Enumeration values",
|
|
2133
2110
|
description: "Enumeration values.",
|
|
2134
2111
|
type: "array",
|
|
2135
2112
|
items: {
|
|
@@ -2137,32 +2114,26 @@ const FUNCTION = {
|
|
|
2137
2114
|
}
|
|
2138
2115
|
},
|
|
2139
2116
|
type: {
|
|
2140
|
-
title: "Discriminator value of the type",
|
|
2141
2117
|
description: "Discriminator value of the type.",
|
|
2142
2118
|
type: "string",
|
|
2143
2119
|
enum: [ "number" ]
|
|
2144
2120
|
},
|
|
2145
2121
|
title: {
|
|
2146
|
-
title: "Title of the schema",
|
|
2147
2122
|
description: "Title of the schema.",
|
|
2148
2123
|
type: "string"
|
|
2149
2124
|
},
|
|
2150
2125
|
description: {
|
|
2151
|
-
title: "Detailed description of the schema",
|
|
2152
2126
|
description: "Detailed description of the schema.",
|
|
2153
2127
|
type: "string"
|
|
2154
2128
|
},
|
|
2155
2129
|
deprecated: {
|
|
2156
|
-
title: "Whether the type is deprecated or not",
|
|
2157
2130
|
description: "Whether the type is deprecated or not.",
|
|
2158
2131
|
type: "boolean"
|
|
2159
2132
|
},
|
|
2160
2133
|
example: {
|
|
2161
|
-
title: "Example value",
|
|
2162
2134
|
description: "Example value."
|
|
2163
2135
|
},
|
|
2164
2136
|
examples: {
|
|
2165
|
-
title: "List of example values as key-value pairs",
|
|
2166
2137
|
$ref: "#/$defs/Recordstringany"
|
|
2167
2138
|
}
|
|
2168
2139
|
},
|
|
@@ -2173,7 +2144,6 @@ const FUNCTION = {
|
|
|
2173
2144
|
type: "object",
|
|
2174
2145
|
properties: {
|
|
2175
2146
|
enum: {
|
|
2176
|
-
title: "Enumeration values",
|
|
2177
2147
|
description: "Enumeration values.",
|
|
2178
2148
|
type: "array",
|
|
2179
2149
|
items: {
|
|
@@ -2181,32 +2151,26 @@ const FUNCTION = {
|
|
|
2181
2151
|
}
|
|
2182
2152
|
},
|
|
2183
2153
|
type: {
|
|
2184
|
-
title: "Discriminator value of the type",
|
|
2185
2154
|
description: "Discriminator value of the type.",
|
|
2186
2155
|
type: "string",
|
|
2187
2156
|
enum: [ "string" ]
|
|
2188
2157
|
},
|
|
2189
2158
|
title: {
|
|
2190
|
-
title: "Title of the schema",
|
|
2191
2159
|
description: "Title of the schema.",
|
|
2192
2160
|
type: "string"
|
|
2193
2161
|
},
|
|
2194
2162
|
description: {
|
|
2195
|
-
title: "Detailed description of the schema",
|
|
2196
2163
|
description: "Detailed description of the schema.",
|
|
2197
2164
|
type: "string"
|
|
2198
2165
|
},
|
|
2199
2166
|
deprecated: {
|
|
2200
|
-
title: "Whether the type is deprecated or not",
|
|
2201
2167
|
description: "Whether the type is deprecated or not.",
|
|
2202
2168
|
type: "boolean"
|
|
2203
2169
|
},
|
|
2204
2170
|
example: {
|
|
2205
|
-
title: "Example value",
|
|
2206
2171
|
description: "Example value."
|
|
2207
2172
|
},
|
|
2208
2173
|
examples: {
|
|
2209
|
-
title: "List of example values as key-value pairs",
|
|
2210
2174
|
$ref: "#/$defs/Recordstringany"
|
|
2211
2175
|
}
|
|
2212
2176
|
},
|
|
@@ -2217,36 +2181,29 @@ const FUNCTION = {
|
|
|
2217
2181
|
type: "object",
|
|
2218
2182
|
properties: {
|
|
2219
2183
|
items: {
|
|
2220
|
-
title: "Items type info",
|
|
2221
2184
|
$ref: "#/$defs/IChatGptSchema"
|
|
2222
2185
|
},
|
|
2223
2186
|
type: {
|
|
2224
|
-
title: "Discriminator value of the type",
|
|
2225
2187
|
description: "Discriminator value of the type.",
|
|
2226
2188
|
type: "string",
|
|
2227
2189
|
enum: [ "array" ]
|
|
2228
2190
|
},
|
|
2229
2191
|
title: {
|
|
2230
|
-
title: "Title of the schema",
|
|
2231
2192
|
description: "Title of the schema.",
|
|
2232
2193
|
type: "string"
|
|
2233
2194
|
},
|
|
2234
2195
|
description: {
|
|
2235
|
-
title: "Detailed description of the schema",
|
|
2236
2196
|
description: "Detailed description of the schema.",
|
|
2237
2197
|
type: "string"
|
|
2238
2198
|
},
|
|
2239
2199
|
deprecated: {
|
|
2240
|
-
title: "Whether the type is deprecated or not",
|
|
2241
2200
|
description: "Whether the type is deprecated or not.",
|
|
2242
2201
|
type: "boolean"
|
|
2243
2202
|
},
|
|
2244
2203
|
example: {
|
|
2245
|
-
title: "Example value",
|
|
2246
2204
|
description: "Example value."
|
|
2247
2205
|
},
|
|
2248
2206
|
examples: {
|
|
2249
|
-
title: "List of example values as key-value pairs",
|
|
2250
2207
|
$ref: "#/$defs/Recordstringany"
|
|
2251
2208
|
}
|
|
2252
2209
|
},
|
|
@@ -2257,11 +2214,9 @@ const FUNCTION = {
|
|
|
2257
2214
|
type: "object",
|
|
2258
2215
|
properties: {
|
|
2259
2216
|
properties: {
|
|
2260
|
-
title: "Properties of the object",
|
|
2261
2217
|
$ref: "#/$defs/RecordstringIChatGptSchema"
|
|
2262
2218
|
},
|
|
2263
2219
|
additionalProperties: {
|
|
2264
|
-
title: "Additional properties' info",
|
|
2265
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`.",
|
|
2266
2221
|
anyOf: [ {
|
|
2267
2222
|
type: "boolean"
|
|
@@ -2288,7 +2243,6 @@ const FUNCTION = {
|
|
|
2288
2243
|
} ]
|
|
2289
2244
|
},
|
|
2290
2245
|
required: {
|
|
2291
|
-
title: "List of key values of the required properties",
|
|
2292
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```',
|
|
2293
2247
|
type: "array",
|
|
2294
2248
|
items: {
|
|
@@ -2296,32 +2250,26 @@ const FUNCTION = {
|
|
|
2296
2250
|
}
|
|
2297
2251
|
},
|
|
2298
2252
|
type: {
|
|
2299
|
-
title: "Discriminator value of the type",
|
|
2300
2253
|
description: "Discriminator value of the type.",
|
|
2301
2254
|
type: "string",
|
|
2302
2255
|
enum: [ "object" ]
|
|
2303
2256
|
},
|
|
2304
2257
|
title: {
|
|
2305
|
-
title: "Title of the schema",
|
|
2306
2258
|
description: "Title of the schema.",
|
|
2307
2259
|
type: "string"
|
|
2308
2260
|
},
|
|
2309
2261
|
description: {
|
|
2310
|
-
title: "Detailed description of the schema",
|
|
2311
2262
|
description: "Detailed description of the schema.",
|
|
2312
2263
|
type: "string"
|
|
2313
2264
|
},
|
|
2314
2265
|
deprecated: {
|
|
2315
|
-
title: "Whether the type is deprecated or not",
|
|
2316
2266
|
description: "Whether the type is deprecated or not.",
|
|
2317
2267
|
type: "boolean"
|
|
2318
2268
|
},
|
|
2319
2269
|
example: {
|
|
2320
|
-
title: "Example value",
|
|
2321
2270
|
description: "Example value."
|
|
2322
2271
|
},
|
|
2323
2272
|
examples: {
|
|
2324
|
-
title: "List of example values as key-value pairs",
|
|
2325
2273
|
$ref: "#/$defs/Recordstringany"
|
|
2326
2274
|
}
|
|
2327
2275
|
},
|
|
@@ -2332,31 +2280,25 @@ const FUNCTION = {
|
|
|
2332
2280
|
type: "object",
|
|
2333
2281
|
properties: {
|
|
2334
2282
|
$ref: {
|
|
2335
|
-
title: "Reference to the named schema",
|
|
2336
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`",
|
|
2337
2284
|
type: "string"
|
|
2338
2285
|
},
|
|
2339
2286
|
title: {
|
|
2340
|
-
title: "Title of the schema",
|
|
2341
2287
|
description: "Title of the schema.",
|
|
2342
2288
|
type: "string"
|
|
2343
2289
|
},
|
|
2344
2290
|
description: {
|
|
2345
|
-
title: "Detailed description of the schema",
|
|
2346
2291
|
description: "Detailed description of the schema.",
|
|
2347
2292
|
type: "string"
|
|
2348
2293
|
},
|
|
2349
2294
|
deprecated: {
|
|
2350
|
-
title: "Whether the type is deprecated or not",
|
|
2351
2295
|
description: "Whether the type is deprecated or not.",
|
|
2352
2296
|
type: "boolean"
|
|
2353
2297
|
},
|
|
2354
2298
|
example: {
|
|
2355
|
-
title: "Example value",
|
|
2356
2299
|
description: "Example value."
|
|
2357
2300
|
},
|
|
2358
2301
|
examples: {
|
|
2359
|
-
title: "List of example values as key-value pairs",
|
|
2360
2302
|
$ref: "#/$defs/Recordstringany"
|
|
2361
2303
|
}
|
|
2362
2304
|
},
|
|
@@ -2367,7 +2309,6 @@ const FUNCTION = {
|
|
|
2367
2309
|
type: "object",
|
|
2368
2310
|
properties: {
|
|
2369
2311
|
anyOf: {
|
|
2370
|
-
title: "List of the union types",
|
|
2371
2312
|
description: "List of the union types.",
|
|
2372
2313
|
type: "array",
|
|
2373
2314
|
items: {
|
|
@@ -2393,30 +2334,24 @@ const FUNCTION = {
|
|
|
2393
2334
|
}
|
|
2394
2335
|
},
|
|
2395
2336
|
"x-discriminator": {
|
|
2396
|
-
title: "Discriminator info of the union type",
|
|
2397
2337
|
$ref: "#/$defs/IChatGptSchema.IAnyOf.IDiscriminator"
|
|
2398
2338
|
},
|
|
2399
2339
|
title: {
|
|
2400
|
-
title: "Title of the schema",
|
|
2401
2340
|
description: "Title of the schema.",
|
|
2402
2341
|
type: "string"
|
|
2403
2342
|
},
|
|
2404
2343
|
description: {
|
|
2405
|
-
title: "Detailed description of the schema",
|
|
2406
2344
|
description: "Detailed description of the schema.",
|
|
2407
2345
|
type: "string"
|
|
2408
2346
|
},
|
|
2409
2347
|
deprecated: {
|
|
2410
|
-
title: "Whether the type is deprecated or not",
|
|
2411
2348
|
description: "Whether the type is deprecated or not.",
|
|
2412
2349
|
type: "boolean"
|
|
2413
2350
|
},
|
|
2414
2351
|
example: {
|
|
2415
|
-
title: "Example value",
|
|
2416
2352
|
description: "Example value."
|
|
2417
2353
|
},
|
|
2418
2354
|
examples: {
|
|
2419
|
-
title: "List of example values as key-value pairs",
|
|
2420
2355
|
$ref: "#/$defs/Recordstringany"
|
|
2421
2356
|
}
|
|
2422
2357
|
},
|
|
@@ -2427,26 +2362,21 @@ const FUNCTION = {
|
|
|
2427
2362
|
type: "object",
|
|
2428
2363
|
properties: {
|
|
2429
2364
|
title: {
|
|
2430
|
-
title: "Title of the schema",
|
|
2431
2365
|
description: "Title of the schema.",
|
|
2432
2366
|
type: "string"
|
|
2433
2367
|
},
|
|
2434
2368
|
description: {
|
|
2435
|
-
title: "Detailed description of the schema",
|
|
2436
2369
|
description: "Detailed description of the schema.",
|
|
2437
2370
|
type: "string"
|
|
2438
2371
|
},
|
|
2439
2372
|
deprecated: {
|
|
2440
|
-
title: "Whether the type is deprecated or not",
|
|
2441
2373
|
description: "Whether the type is deprecated or not.",
|
|
2442
2374
|
type: "boolean"
|
|
2443
2375
|
},
|
|
2444
2376
|
example: {
|
|
2445
|
-
title: "Example value",
|
|
2446
2377
|
description: "Example value."
|
|
2447
2378
|
},
|
|
2448
2379
|
examples: {
|
|
2449
|
-
title: "List of example values as key-value pairs",
|
|
2450
2380
|
$ref: "#/$defs/Recordstringany"
|
|
2451
2381
|
}
|
|
2452
2382
|
},
|
|
@@ -2457,32 +2387,26 @@ const FUNCTION = {
|
|
|
2457
2387
|
type: "object",
|
|
2458
2388
|
properties: {
|
|
2459
2389
|
type: {
|
|
2460
|
-
title: "Discriminator value of the type",
|
|
2461
2390
|
description: "Discriminator value of the type.",
|
|
2462
2391
|
type: "string",
|
|
2463
2392
|
enum: [ "null" ]
|
|
2464
2393
|
},
|
|
2465
2394
|
title: {
|
|
2466
|
-
title: "Title of the schema",
|
|
2467
2395
|
description: "Title of the schema.",
|
|
2468
2396
|
type: "string"
|
|
2469
2397
|
},
|
|
2470
2398
|
description: {
|
|
2471
|
-
title: "Detailed description of the schema",
|
|
2472
2399
|
description: "Detailed description of the schema.",
|
|
2473
2400
|
type: "string"
|
|
2474
2401
|
},
|
|
2475
2402
|
deprecated: {
|
|
2476
|
-
title: "Whether the type is deprecated or not",
|
|
2477
2403
|
description: "Whether the type is deprecated or not.",
|
|
2478
2404
|
type: "boolean"
|
|
2479
2405
|
},
|
|
2480
2406
|
example: {
|
|
2481
|
-
title: "Example value",
|
|
2482
2407
|
description: "Example value."
|
|
2483
2408
|
},
|
|
2484
2409
|
examples: {
|
|
2485
|
-
title: "List of example values as key-value pairs",
|
|
2486
2410
|
$ref: "#/$defs/Recordstringany"
|
|
2487
2411
|
}
|
|
2488
2412
|
},
|
|
@@ -2493,12 +2417,10 @@ const FUNCTION = {
|
|
|
2493
2417
|
type: "object",
|
|
2494
2418
|
properties: {
|
|
2495
2419
|
propertyName: {
|
|
2496
|
-
title: "Property name for the discriminator",
|
|
2497
2420
|
description: "Property name for the discriminator.",
|
|
2498
2421
|
type: "string"
|
|
2499
2422
|
},
|
|
2500
2423
|
mapping: {
|
|
2501
|
-
title: "Mapping of the discriminator value to the schema name",
|
|
2502
2424
|
$ref: "#/$defs/Recordstringstring"
|
|
2503
2425
|
}
|
|
2504
2426
|
},
|
|
@@ -2518,11 +2440,9 @@ const FUNCTION = {
|
|
|
2518
2440
|
type: "object",
|
|
2519
2441
|
properties: {
|
|
2520
2442
|
llm: {
|
|
2521
|
-
title: "Parameters that would be composed by the LLM",
|
|
2522
2443
|
$ref: "#/$defs/IChatGptSchema.IParameters"
|
|
2523
2444
|
},
|
|
2524
2445
|
human: {
|
|
2525
|
-
title: "Parameters that would be composed by the human",
|
|
2526
2446
|
description: "Parameters that would be composed by the human.",
|
|
2527
2447
|
anyOf: [ {
|
|
2528
2448
|
type: "null"
|
|
@@ -2676,7 +2596,6 @@ const CONTAINER = {
|
|
|
2676
2596
|
type: "object",
|
|
2677
2597
|
properties: {
|
|
2678
2598
|
functions: {
|
|
2679
|
-
title: "List of target functions",
|
|
2680
2599
|
description: "List of target functions.",
|
|
2681
2600
|
type: "array",
|
|
2682
2601
|
items: {
|
|
@@ -2691,12 +2610,10 @@ const CONTAINER = {
|
|
|
2691
2610
|
type: "object",
|
|
2692
2611
|
properties: {
|
|
2693
2612
|
reason: {
|
|
2694
|
-
title: "The reason of the function selection",
|
|
2695
2613
|
description: "The reason of the function selection.\n\nJust write the reason why you've determined to select this function.",
|
|
2696
2614
|
type: "string"
|
|
2697
2615
|
},
|
|
2698
2616
|
name: {
|
|
2699
|
-
title: "Name of the target function to call",
|
|
2700
2617
|
description: "Name of the target function to call.",
|
|
2701
2618
|
type: "string"
|
|
2702
2619
|
}
|
|
@@ -42053,7 +41970,7 @@ class MicroAgentica {
|
|
|
42053
41970
|
usage: this.token_usage_
|
|
42054
41971
|
});
|
|
42055
41972
|
const executes = await call(ctx, this.operations_.array);
|
|
42056
|
-
if (executes.length) {
|
|
41973
|
+
if (executes.length && this.props.config?.executor?.describe !== null && this.props.config?.executor?.describe !== false) {
|
|
42057
41974
|
await describe(ctx, executes);
|
|
42058
41975
|
}
|
|
42059
41976
|
const completed = await Promise.all(histories.map((async h => h())));
|