vovk 3.0.0-draft.164 → 3.0.0-draft.166

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.
@@ -1,6 +1,7 @@
1
1
  import { KnownAny } from '../types';
2
2
  declare const defaultCallRPCMethod: ({ handler, body, query, params, }: {
3
- schema?: KnownAny;
3
+ toolCallId: string;
4
+ schema: KnownAny;
4
5
  handler: (options: {
5
6
  body?: KnownAny;
6
7
  query?: KnownAny;
@@ -12,6 +13,7 @@ declare const defaultCallRPCMethod: ({ handler, body, query, params, }: {
12
13
  params?: KnownAny;
13
14
  }) => Promise<any>;
14
15
  declare const defaultCallControllerMethod: ({ handler, body, query, params, }: {
16
+ toolCallId: string;
15
17
  schema?: KnownAny;
16
18
  handler: ((...args: KnownAny[]) => KnownAny) & {
17
19
  func: (req: KnownAny) => KnownAny;
@@ -30,7 +32,9 @@ export declare function createLLMFunctions({ modules, callRPCMethod, callControl
30
32
  body?: KnownAny;
31
33
  query?: KnownAny;
32
34
  params?: KnownAny;
33
- }]) => Promise<any>;
35
+ }], { toolCallId }: {
36
+ toolCallId: string;
37
+ }) => Promise<any>;
34
38
  name: string;
35
39
  description: string;
36
40
  parameters: {
@@ -42,6 +46,11 @@ export declare function createLLMFunctions({ modules, callRPCMethod, callControl
42
46
  };
43
47
  required: string[];
44
48
  additionalProperties: boolean;
49
+ } | {
50
+ type?: undefined;
51
+ properties?: undefined;
52
+ required?: undefined;
53
+ additionalProperties?: undefined;
45
54
  };
46
55
  }[];
47
56
  };
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createLLMFunctions = createLLMFunctions;
4
4
  const createLLMFunction = ({ rpcModuleName, handlerName, handler, callRPCMethod, callControllerMethod, modules, }) => {
5
5
  const { schema } = handler;
6
- const execute = (input) => {
6
+ const execute = (input, { toolCallId }) => {
7
7
  const { body, query, params } = input[0];
8
8
  const module = modules[rpcModuleName];
9
9
  if (!module) {
@@ -19,6 +19,7 @@ const createLLMFunction = ({ rpcModuleName, handlerName, handler, callRPCMethod,
19
19
  }
20
20
  if (isRPC) {
21
21
  return callRPCMethod({
22
+ toolCallId,
22
23
  schema,
23
24
  handler,
24
25
  body,
@@ -27,6 +28,7 @@ const createLLMFunction = ({ rpcModuleName, handlerName, handler, callRPCMethod,
27
28
  });
28
29
  }
29
30
  return callControllerMethod({
31
+ toolCallId,
30
32
  schema,
31
33
  handler,
32
34
  body,
@@ -34,36 +36,35 @@ const createLLMFunction = ({ rpcModuleName, handlerName, handler, callRPCMethod,
34
36
  params,
35
37
  });
36
38
  };
39
+ const parametersProperties = {
40
+ ...(schema?.validation?.body
41
+ ? {
42
+ body: schema.validation.body,
43
+ }
44
+ : {}),
45
+ ...(schema?.validation?.query
46
+ ? {
47
+ query: schema.validation.query,
48
+ }
49
+ : {}),
50
+ ...(schema?.validation?.params
51
+ ? {
52
+ params: schema.validation.params,
53
+ }
54
+ : {}),
55
+ };
37
56
  return {
38
57
  execute,
39
58
  name: `${rpcModuleName}.${handlerName}`,
40
59
  description: [schema.openapi?.summary ?? '', schema.openapi?.description ?? ''].filter(Boolean).join('\n') || handlerName,
41
- parameters: {
42
- type: 'object',
43
- properties: {
44
- ...(schema?.validation?.body
45
- ? {
46
- body: schema.validation.body,
47
- }
48
- : {}),
49
- ...(schema?.validation?.query
50
- ? {
51
- query: schema.validation.query,
52
- }
53
- : {}),
54
- ...(schema?.validation?.params
55
- ? {
56
- params: schema.validation.params,
57
- }
58
- : {}),
59
- },
60
- required: [
61
- ...(schema?.validation?.body ? ['body'] : []),
62
- ...(schema?.validation?.query ? ['query'] : []),
63
- ...(schema?.validation?.params ? ['params'] : []),
64
- ],
65
- additionalProperties: false,
66
- },
60
+ parameters: Object.keys(parametersProperties)
61
+ ? {
62
+ type: 'object',
63
+ properties: parametersProperties,
64
+ required: Object.keys(parametersProperties),
65
+ additionalProperties: false,
66
+ }
67
+ : {},
67
68
  };
68
69
  };
69
70
  const defaultCallRPCMethod = async ({ handler, body, query, params, }) => {
@@ -1,6 +1,7 @@
1
1
  import { KnownAny } from '../types';
2
2
  declare const defaultCallRPCMethod: ({ handler, body, query, params, }: {
3
- schema?: KnownAny;
3
+ toolCallId: string;
4
+ schema: KnownAny;
4
5
  handler: (options: {
5
6
  body?: KnownAny;
6
7
  query?: KnownAny;
@@ -12,6 +13,7 @@ declare const defaultCallRPCMethod: ({ handler, body, query, params, }: {
12
13
  params?: KnownAny;
13
14
  }) => Promise<any>;
14
15
  declare const defaultCallControllerMethod: ({ handler, body, query, params, }: {
16
+ toolCallId: string;
15
17
  schema?: KnownAny;
16
18
  handler: ((...args: KnownAny[]) => KnownAny) & {
17
19
  func: (req: KnownAny) => KnownAny;
@@ -30,7 +32,9 @@ export declare function createLLMFunctions({ modules, callRPCMethod, callControl
30
32
  body?: KnownAny;
31
33
  query?: KnownAny;
32
34
  params?: KnownAny;
33
- }]) => Promise<any>;
35
+ }], { toolCallId }: {
36
+ toolCallId: string;
37
+ }) => Promise<any>;
34
38
  name: string;
35
39
  description: string;
36
40
  parameters: {
@@ -42,6 +46,11 @@ export declare function createLLMFunctions({ modules, callRPCMethod, callControl
42
46
  };
43
47
  required: string[];
44
48
  additionalProperties: boolean;
49
+ } | {
50
+ type?: undefined;
51
+ properties?: undefined;
52
+ required?: undefined;
53
+ additionalProperties?: undefined;
45
54
  };
46
55
  }[];
47
56
  };
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createLLMFunctions = createLLMFunctions;
4
4
  const createLLMFunction = ({ rpcModuleName, handlerName, handler, callRPCMethod, callControllerMethod, modules, }) => {
5
5
  const { schema } = handler;
6
- const execute = (input) => {
6
+ const execute = (input, { toolCallId }) => {
7
7
  const { body, query, params } = input[0];
8
8
  const module = modules[rpcModuleName];
9
9
  if (!module) {
@@ -19,6 +19,7 @@ const createLLMFunction = ({ rpcModuleName, handlerName, handler, callRPCMethod,
19
19
  }
20
20
  if (isRPC) {
21
21
  return callRPCMethod({
22
+ toolCallId,
22
23
  schema,
23
24
  handler,
24
25
  body,
@@ -27,6 +28,7 @@ const createLLMFunction = ({ rpcModuleName, handlerName, handler, callRPCMethod,
27
28
  });
28
29
  }
29
30
  return callControllerMethod({
31
+ toolCallId,
30
32
  schema,
31
33
  handler,
32
34
  body,
@@ -34,36 +36,35 @@ const createLLMFunction = ({ rpcModuleName, handlerName, handler, callRPCMethod,
34
36
  params,
35
37
  });
36
38
  };
39
+ const parametersProperties = {
40
+ ...(schema?.validation?.body
41
+ ? {
42
+ body: schema.validation.body,
43
+ }
44
+ : {}),
45
+ ...(schema?.validation?.query
46
+ ? {
47
+ query: schema.validation.query,
48
+ }
49
+ : {}),
50
+ ...(schema?.validation?.params
51
+ ? {
52
+ params: schema.validation.params,
53
+ }
54
+ : {}),
55
+ };
37
56
  return {
38
57
  execute,
39
58
  name: `${rpcModuleName}.${handlerName}`,
40
59
  description: [schema.openapi?.summary ?? '', schema.openapi?.description ?? ''].filter(Boolean).join('\n') || handlerName,
41
- parameters: {
42
- type: 'object',
43
- properties: {
44
- ...(schema?.validation?.body
45
- ? {
46
- body: schema.validation.body,
47
- }
48
- : {}),
49
- ...(schema?.validation?.query
50
- ? {
51
- query: schema.validation.query,
52
- }
53
- : {}),
54
- ...(schema?.validation?.params
55
- ? {
56
- params: schema.validation.params,
57
- }
58
- : {}),
59
- },
60
- required: [
61
- ...(schema?.validation?.body ? ['body'] : []),
62
- ...(schema?.validation?.query ? ['query'] : []),
63
- ...(schema?.validation?.params ? ['params'] : []),
64
- ],
65
- additionalProperties: false,
66
- },
60
+ parameters: Object.keys(parametersProperties)
61
+ ? {
62
+ type: 'object',
63
+ properties: parametersProperties,
64
+ required: Object.keys(parametersProperties),
65
+ additionalProperties: false,
66
+ }
67
+ : {},
67
68
  };
68
69
  };
69
70
  const defaultCallRPCMethod = async ({ handler, body, query, params, }) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vovk",
3
- "version": "3.0.0-draft.164",
3
+ "version": "3.0.0-draft.166",
4
4
  "main": "./cjs/index.js",
5
5
  "module": "./mjs/index.js",
6
6
  "types": "./mjs/index.d.ts",