syllable-sdk 0.0.9 → 0.1.0-alpha

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.
Files changed (130) hide show
  1. package/README.md +4 -4
  2. package/docs/sdks/agents/README.md +1 -1
  3. package/docs/sdks/channels/README.md +1 -1
  4. package/docs/sdks/prompts/README.md +25 -5
  5. package/docs/sdks/tools/README.md +1 -1
  6. package/funcs/agentsDelete.d.ts +0 -3
  7. package/funcs/agentsDelete.d.ts.map +1 -1
  8. package/funcs/agentsDelete.js +0 -3
  9. package/funcs/agentsDelete.js.map +1 -1
  10. package/funcs/channelsDelete.d.ts +0 -3
  11. package/funcs/channelsDelete.d.ts.map +1 -1
  12. package/funcs/channelsDelete.js +0 -3
  13. package/funcs/channelsDelete.js.map +1 -1
  14. package/funcs/promptsDelete.d.ts +0 -3
  15. package/funcs/promptsDelete.d.ts.map +1 -1
  16. package/funcs/promptsDelete.js +0 -3
  17. package/funcs/promptsDelete.js.map +1 -1
  18. package/funcs/toolsList.d.ts +1 -1
  19. package/funcs/toolsList.d.ts.map +1 -1
  20. package/funcs/toolsList.js +1 -1
  21. package/funcs/toolsList.js.map +1 -1
  22. package/lib/config.d.ts +2 -2
  23. package/lib/config.js +2 -2
  24. package/lib/config.js.map +1 -1
  25. package/models/components/availabletarget.d.ts +2 -0
  26. package/models/components/availabletarget.d.ts.map +1 -1
  27. package/models/components/availabletarget.js +4 -0
  28. package/models/components/availabletarget.js.map +1 -1
  29. package/models/components/custommessagecreate.d.ts +2 -0
  30. package/models/components/custommessagecreate.d.ts.map +1 -1
  31. package/models/components/custommessagecreate.js +2 -0
  32. package/models/components/custommessagecreate.js.map +1 -1
  33. package/models/components/function.d.ts +6 -1
  34. package/models/components/function.d.ts.map +1 -1
  35. package/models/components/function.js.map +1 -1
  36. package/models/components/httpendpoint.d.ts +71 -2
  37. package/models/components/httpendpoint.d.ts.map +1 -1
  38. package/models/components/httpendpoint.js +52 -5
  39. package/models/components/httpendpoint.js.map +1 -1
  40. package/models/components/index.d.ts +1 -3
  41. package/models/components/index.d.ts.map +1 -1
  42. package/models/components/index.js +1 -3
  43. package/models/components/index.js.map +1 -1
  44. package/models/components/listresponsetool.d.ts +34 -0
  45. package/models/components/listresponsetool.d.ts.map +1 -0
  46. package/models/components/{listresponseschemasbubblegumv2toolstool.js → listresponsetool.js} +11 -11
  47. package/models/components/listresponsetool.js.map +1 -0
  48. package/models/components/llmconfig.d.ts +40 -6
  49. package/models/components/llmconfig.d.ts.map +1 -1
  50. package/models/components/llmconfig.js +28 -6
  51. package/models/components/llmconfig.js.map +1 -1
  52. package/models/components/prompt.d.ts +8 -5
  53. package/models/components/prompt.d.ts.map +1 -1
  54. package/models/components/prompt.js +2 -2
  55. package/models/components/prompt.js.map +1 -1
  56. package/models/components/promptcreate.d.ts +5 -5
  57. package/models/components/promptcreate.d.ts.map +1 -1
  58. package/models/components/promptcreate.js +2 -2
  59. package/models/components/promptcreate.js.map +1 -1
  60. package/models/components/schemasbubblegumv2toolstool.d.ts +5 -5
  61. package/models/components/schemasbubblegumv2toolstool.d.ts.map +1 -1
  62. package/models/components/schemasbubblegumv2toolstool.js +2 -2
  63. package/models/components/schemasbubblegumv2toolstool.js.map +1 -1
  64. package/models/components/schemascortexv1toolstool.d.ts +31 -2
  65. package/models/components/schemascortexv1toolstool.d.ts.map +1 -1
  66. package/models/components/schemascortexv1toolstool.js +24 -3
  67. package/models/components/schemascortexv1toolstool.js.map +1 -1
  68. package/models/components/tooldefinition.d.ts +176 -5
  69. package/models/components/tooldefinition.d.ts.map +1 -1
  70. package/models/components/tooldefinition.js +70 -6
  71. package/models/components/tooldefinition.js.map +1 -1
  72. package/models/components/toolparametertransform.d.ts +43 -2
  73. package/models/components/toolparametertransform.d.ts.map +1 -1
  74. package/models/components/toolparametertransform.js +27 -3
  75. package/models/components/toolparametertransform.js.map +1 -1
  76. package/models/components/toolparametertransformcondition.d.ts +28 -2
  77. package/models/components/toolparametertransformcondition.d.ts.map +1 -1
  78. package/models/components/toolparametertransformcondition.js +22 -3
  79. package/models/components/toolparametertransformcondition.js.map +1 -1
  80. package/package.json +1 -4
  81. package/sdk/agents.d.ts +0 -3
  82. package/sdk/agents.d.ts.map +1 -1
  83. package/sdk/agents.js +0 -3
  84. package/sdk/agents.js.map +1 -1
  85. package/sdk/channels.d.ts +0 -3
  86. package/sdk/channels.d.ts.map +1 -1
  87. package/sdk/channels.js +0 -3
  88. package/sdk/channels.js.map +1 -1
  89. package/sdk/prompts.d.ts +0 -3
  90. package/sdk/prompts.d.ts.map +1 -1
  91. package/sdk/prompts.js +0 -3
  92. package/sdk/prompts.js.map +1 -1
  93. package/sdk/tools.d.ts +1 -1
  94. package/sdk/tools.d.ts.map +1 -1
  95. package/src/funcs/agentsDelete.ts +0 -3
  96. package/src/funcs/channelsDelete.ts +0 -3
  97. package/src/funcs/promptsDelete.ts +0 -3
  98. package/src/funcs/toolsList.ts +3 -6
  99. package/src/lib/config.ts +2 -2
  100. package/src/models/components/availabletarget.ts +6 -0
  101. package/src/models/components/custommessagecreate.ts +4 -0
  102. package/src/models/components/function.ts +6 -1
  103. package/src/models/components/httpendpoint.ts +73 -6
  104. package/src/models/components/index.ts +1 -3
  105. package/src/models/components/{listresponseschemasbubblegumv2toolstool.ts → listresponsetool.ts} +14 -16
  106. package/src/models/components/llmconfig.ts +44 -14
  107. package/src/models/components/prompt.ts +10 -7
  108. package/src/models/components/promptcreate.ts +7 -7
  109. package/src/models/components/schemasbubblegumv2toolstool.ts +7 -7
  110. package/src/models/components/schemascortexv1toolstool.ts +39 -4
  111. package/src/models/components/tooldefinition.ts +218 -14
  112. package/src/models/components/toolparametertransform.ts +43 -4
  113. package/src/models/components/toolparametertransformcondition.ts +32 -4
  114. package/src/sdk/agents.ts +0 -3
  115. package/src/sdk/channels.ts +0 -3
  116. package/src/sdk/prompts.ts +0 -3
  117. package/src/sdk/tools.ts +1 -1
  118. package/models/components/defaults.d.ts +0 -58
  119. package/models/components/defaults.d.ts.map +0 -1
  120. package/models/components/defaults.js +0 -87
  121. package/models/components/defaults.js.map +0 -1
  122. package/models/components/listresponseschemasbubblegumv2toolstool.d.ts +0 -34
  123. package/models/components/listresponseschemasbubblegumv2toolstool.d.ts.map +0 -1
  124. package/models/components/listresponseschemasbubblegumv2toolstool.js.map +0 -1
  125. package/models/components/provider.d.ts +0 -34
  126. package/models/components/provider.d.ts.map +0 -1
  127. package/models/components/provider.js +0 -54
  128. package/models/components/provider.js.map +0 -1
  129. package/src/models/components/defaults.ts +0 -127
  130. package/src/models/components/provider.ts +0 -37
@@ -11,9 +11,6 @@ import {
11
11
  LlmConfig$outboundSchema,
12
12
  } from "./llmconfig.js";
13
13
 
14
- /**
15
- * Prompt
16
- */
17
14
  export type Prompt = {
18
15
  /**
19
16
  * The Prompt name
@@ -23,11 +20,14 @@ export type Prompt = {
23
20
  * The type of the prompt
24
21
  */
25
22
  type: string;
23
+ /**
24
+ * The prompt text
25
+ */
26
26
  context?: string | null | undefined;
27
27
  /**
28
28
  * The tools for the prompt
29
29
  */
30
- tools?: Array<string> | null | undefined;
30
+ tools?: Array<string> | undefined;
31
31
  /**
32
32
  * The configuration for the language model used by the Cortex API.
33
33
  */
@@ -36,6 +36,9 @@ export type Prompt = {
36
36
  * The Prompt ID
37
37
  */
38
38
  id: number;
39
+ /**
40
+ * The last updated date of the prompt
41
+ */
39
42
  lastUpdated: string | null;
40
43
  };
41
44
 
@@ -45,7 +48,7 @@ export const Prompt$inboundSchema: z.ZodType<Prompt, z.ZodTypeDef, unknown> = z
45
48
  name: z.string(),
46
49
  type: z.string(),
47
50
  context: z.nullable(z.string()).optional(),
48
- tools: z.nullable(z.array(z.string())).optional(),
51
+ tools: z.array(z.string()).optional(),
49
52
  llm_config: LlmConfig$inboundSchema,
50
53
  id: z.number().int(),
51
54
  last_updated: z.nullable(z.string()),
@@ -61,7 +64,7 @@ export type Prompt$Outbound = {
61
64
  name: string;
62
65
  type: string;
63
66
  context?: string | null | undefined;
64
- tools?: Array<string> | null | undefined;
67
+ tools?: Array<string> | undefined;
65
68
  llm_config: LlmConfig$Outbound;
66
69
  id: number;
67
70
  last_updated: string | null;
@@ -76,7 +79,7 @@ export const Prompt$outboundSchema: z.ZodType<
76
79
  name: z.string(),
77
80
  type: z.string(),
78
81
  context: z.nullable(z.string()).optional(),
79
- tools: z.nullable(z.array(z.string())).optional(),
82
+ tools: z.array(z.string()).optional(),
80
83
  llmConfig: LlmConfig$outboundSchema,
81
84
  id: z.number().int(),
82
85
  lastUpdated: z.nullable(z.string()),
@@ -11,9 +11,6 @@ import {
11
11
  LlmConfig$outboundSchema,
12
12
  } from "./llmconfig.js";
13
13
 
14
- /**
15
- * PromptCreate
16
- */
17
14
  export type PromptCreate = {
18
15
  /**
19
16
  * The Prompt name
@@ -23,11 +20,14 @@ export type PromptCreate = {
23
20
  * The type of the prompt
24
21
  */
25
22
  type: string;
23
+ /**
24
+ * The prompt text
25
+ */
26
26
  context?: string | null | undefined;
27
27
  /**
28
28
  * The tools for the prompt
29
29
  */
30
- tools?: Array<string> | null | undefined;
30
+ tools?: Array<string> | undefined;
31
31
  /**
32
32
  * The configuration for the language model used by the Cortex API.
33
33
  */
@@ -43,7 +43,7 @@ export const PromptCreate$inboundSchema: z.ZodType<
43
43
  name: z.string(),
44
44
  type: z.string(),
45
45
  context: z.nullable(z.string()).optional(),
46
- tools: z.nullable(z.array(z.string())).optional(),
46
+ tools: z.array(z.string()).optional(),
47
47
  llm_config: LlmConfig$inboundSchema,
48
48
  }).transform((v) => {
49
49
  return remap$(v, {
@@ -56,7 +56,7 @@ export type PromptCreate$Outbound = {
56
56
  name: string;
57
57
  type: string;
58
58
  context?: string | null | undefined;
59
- tools?: Array<string> | null | undefined;
59
+ tools?: Array<string> | undefined;
60
60
  llm_config: LlmConfig$Outbound;
61
61
  };
62
62
 
@@ -69,7 +69,7 @@ export const PromptCreate$outboundSchema: z.ZodType<
69
69
  name: z.string(),
70
70
  type: z.string(),
71
71
  context: z.nullable(z.string()).optional(),
72
- tools: z.nullable(z.array(z.string())).optional(),
72
+ tools: z.array(z.string()).optional(),
73
73
  llmConfig: LlmConfig$outboundSchema,
74
74
  }).transform((v) => {
75
75
  return remap$(v, {
@@ -11,9 +11,6 @@ import {
11
11
  ToolDefinition$outboundSchema,
12
12
  } from "./tooldefinition.js";
13
13
 
14
- /**
15
- * SchemasBubblegumV2ToolsTool
16
- */
17
14
  export type SchemasBubblegumV2ToolsTool = {
18
15
  /**
19
16
  * The name of the tool
@@ -22,7 +19,7 @@ export type SchemasBubblegumV2ToolsTool = {
22
19
  /**
23
20
  * The definition of the tool
24
21
  */
25
- definition?: ToolDefinition | null | undefined;
22
+ definition?: ToolDefinition | undefined;
26
23
  /**
27
24
  * The service this tool belongs to
28
25
  */
@@ -31,6 +28,9 @@ export type SchemasBubblegumV2ToolsTool = {
31
28
  * The ID of the tool
32
29
  */
33
30
  id: number;
31
+ /**
32
+ * The name of the service this tool belongs to
33
+ */
34
34
  serviceName?: string | null | undefined;
35
35
  };
36
36
 
@@ -41,7 +41,7 @@ export const SchemasBubblegumV2ToolsTool$inboundSchema: z.ZodType<
41
41
  unknown
42
42
  > = z.object({
43
43
  name: z.string(),
44
- definition: z.nullable(ToolDefinition$inboundSchema).optional(),
44
+ definition: ToolDefinition$inboundSchema.optional(),
45
45
  service_id: z.number().int(),
46
46
  id: z.number().int(),
47
47
  service_name: z.nullable(z.string()).optional(),
@@ -55,7 +55,7 @@ export const SchemasBubblegumV2ToolsTool$inboundSchema: z.ZodType<
55
55
  /** @internal */
56
56
  export type SchemasBubblegumV2ToolsTool$Outbound = {
57
57
  name: string;
58
- definition?: ToolDefinition$Outbound | null | undefined;
58
+ definition?: ToolDefinition$Outbound | undefined;
59
59
  service_id: number;
60
60
  id: number;
61
61
  service_name?: string | null | undefined;
@@ -68,7 +68,7 @@ export const SchemasBubblegumV2ToolsTool$outboundSchema: z.ZodType<
68
68
  SchemasBubblegumV2ToolsTool
69
69
  > = z.object({
70
70
  name: z.string(),
71
- definition: z.nullable(ToolDefinition$outboundSchema).optional(),
71
+ definition: ToolDefinition$outboundSchema.optional(),
72
72
  serviceId: z.number().int(),
73
73
  id: z.number().int(),
74
74
  serviceName: z.nullable(z.string()).optional(),
@@ -3,6 +3,7 @@
3
3
  */
4
4
 
5
5
  import * as z from "zod";
6
+ import { ClosedEnum } from "../../types/enums.js";
6
7
  import {
7
8
  FunctionT,
8
9
  FunctionT$inboundSchema,
@@ -10,6 +11,19 @@ import {
10
11
  FunctionT$outboundSchema,
11
12
  } from "./function.js";
12
13
 
14
+ /**
15
+ * Always `function`.
16
+ */
17
+ export const SchemasCortexV1ToolsToolType = {
18
+ Function: "function",
19
+ } as const;
20
+ /**
21
+ * Always `function`.
22
+ */
23
+ export type SchemasCortexV1ToolsToolType = ClosedEnum<
24
+ typeof SchemasCortexV1ToolsToolType
25
+ >;
26
+
13
27
  /**
14
28
  * A tool definition to be used by the OpenAI API.
15
29
  */
@@ -17,26 +31,47 @@ export type SchemasCortexV1ToolsTool = {
17
31
  /**
18
32
  * Always `function`.
19
33
  */
20
- type?: string | null | undefined;
34
+ type?: "function" | undefined;
21
35
  /**
22
36
  * The tool definition including the JSON Schema of its parameters.
23
37
  */
24
38
  function: FunctionT;
25
39
  };
26
40
 
41
+ /** @internal */
42
+ export const SchemasCortexV1ToolsToolType$inboundSchema: z.ZodNativeEnum<
43
+ typeof SchemasCortexV1ToolsToolType
44
+ > = z.nativeEnum(SchemasCortexV1ToolsToolType);
45
+
46
+ /** @internal */
47
+ export const SchemasCortexV1ToolsToolType$outboundSchema: z.ZodNativeEnum<
48
+ typeof SchemasCortexV1ToolsToolType
49
+ > = SchemasCortexV1ToolsToolType$inboundSchema;
50
+
51
+ /**
52
+ * @internal
53
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
54
+ */
55
+ export namespace SchemasCortexV1ToolsToolType$ {
56
+ /** @deprecated use `SchemasCortexV1ToolsToolType$inboundSchema` instead. */
57
+ export const inboundSchema = SchemasCortexV1ToolsToolType$inboundSchema;
58
+ /** @deprecated use `SchemasCortexV1ToolsToolType$outboundSchema` instead. */
59
+ export const outboundSchema = SchemasCortexV1ToolsToolType$outboundSchema;
60
+ }
61
+
27
62
  /** @internal */
28
63
  export const SchemasCortexV1ToolsTool$inboundSchema: z.ZodType<
29
64
  SchemasCortexV1ToolsTool,
30
65
  z.ZodTypeDef,
31
66
  unknown
32
67
  > = z.object({
33
- type: z.nullable(z.string()).optional(),
68
+ type: z.literal("function").default("function"),
34
69
  function: FunctionT$inboundSchema,
35
70
  });
36
71
 
37
72
  /** @internal */
38
73
  export type SchemasCortexV1ToolsTool$Outbound = {
39
- type?: string | null | undefined;
74
+ type: "function";
40
75
  function: FunctionT$Outbound;
41
76
  };
42
77
 
@@ -46,7 +81,7 @@ export const SchemasCortexV1ToolsTool$outboundSchema: z.ZodType<
46
81
  z.ZodTypeDef,
47
82
  SchemasCortexV1ToolsTool
48
83
  > = z.object({
49
- type: z.nullable(z.string()).optional(),
84
+ type: z.literal("function").default("function"),
50
85
  function: FunctionT$outboundSchema,
51
86
  });
52
87
 
@@ -3,12 +3,7 @@
3
3
  */
4
4
 
5
5
  import * as z from "zod";
6
- import {
7
- Defaults,
8
- Defaults$inboundSchema,
9
- Defaults$Outbound,
10
- Defaults$outboundSchema,
11
- } from "./defaults.js";
6
+ import { ClosedEnum } from "../../types/enums.js";
12
7
  import {
13
8
  HttpEndpoint,
14
9
  HttpEndpoint$inboundSchema,
@@ -21,23 +16,218 @@ import {
21
16
  SchemasCortexV1ToolsTool$Outbound,
22
17
  SchemasCortexV1ToolsTool$outboundSchema,
23
18
  } from "./schemascortexv1toolstool.js";
19
+ import {
20
+ ToolParameterDefault,
21
+ ToolParameterDefault$inboundSchema,
22
+ ToolParameterDefault$Outbound,
23
+ ToolParameterDefault$outboundSchema,
24
+ } from "./toolparameterdefault.js";
25
+
26
+ export const Type = {
27
+ Action: "action",
28
+ Endpoint: "endpoint",
29
+ Context: "context",
30
+ } as const;
31
+ export type Type = ClosedEnum<typeof Type>;
32
+
33
+ export type One = {};
34
+
35
+ /**
36
+ * The default values for the parameters of the function/tool call.
37
+ */
38
+ export type Defaults = One | { [k: string]: ToolParameterDefault };
24
39
 
25
40
  export type Result = {};
26
41
 
27
42
  /**
28
- * A tool that can be called from GPT during the conversation. The tool can result in one of the following actions depending on the `type` field: - `action`: An `ActionRequest` to return to Bubblegum in `GetResponseResponse`. - `endpoint`: An HTTP API call to an external tool. Requires the `endpoint` field to be set too. - `context`: Sets context variables based on the tool arguments, e.g. to change the session language. Only `language` and `say` context vars are currently supported, but this will be made more generic. For example, to change the current session language: ``` { "type": "context", "tool": { "function": { "name": "set_language", "parameters": { "language": { "type": "string", "description": "The ISO 639 language code to set for the session e.g. 'en-US'." }, "message": { "type": "string", "description": "Inform the caller we're now speaking in the new language." } } } } } ``` If `defaults` is provided, it will be used as the default values for the parameters of the tool call, if GPT doesn't provide them: ``` "defaults": { "hospital": "Queens Hospital" } ``` Some special "transform" handling is supported if the value is a dict with a single `transform` key. The parameter value will be transformed by the given `action` before being used as the default value: Removing an unwanted parameter: ``` "defaults": { "hospital": { "transform": { "action": "remove" } } } ``` Add custom parameters from other parameters using Python's `format`: ``` "defaults": { "hello": { "transform": { "format": "Hello, {name}!" } } } Modify a value conditionally, e.g. change a `city` parameter with value "Bronx" to "The Bronx": ``` { "defaults": { "city": { "transform": { "when": {"operator": "eq", "key": "city", "value": "Bronx"}, "action": "override", "format": "The {city}" } } } } ```
43
+ * A tool that can be called from GPT during the conversation.
44
+ *
45
+ * @remarks
46
+ *
47
+ * The tool can result in one of the following actions depending on the `type` field:
48
+ * - `action`:
49
+ * An `ActionRequest` to return to Bubblegum in `GetResponseResponse`.
50
+ * - `endpoint`:
51
+ * An HTTP API call to an external tool. Requires the `endpoint` field to be set too.
52
+ * - `context`:
53
+ * Sets context variables based on the tool arguments, e.g. to change the session language. Only
54
+ * `language` and `say` context vars are currently supported, but this will be made more generic.
55
+ *
56
+ * For example, to change the current session language:
57
+ * ```
58
+ * {
59
+ * "type": "context",
60
+ * "tool": {
61
+ * "function": {
62
+ * "name": "set_language",
63
+ * "parameters": {
64
+ * "language": {
65
+ * "type": "string",
66
+ * "description": "The ISO 639 language code to set for the session e.g. 'en-US'."
67
+ * },
68
+ * "message": {
69
+ * "type": "string",
70
+ * "description": "Inform the caller we're now speaking in the new language."
71
+ * }
72
+ * }
73
+ * }
74
+ * }
75
+ * }
76
+ * ```
77
+ *
78
+ * If `defaults` is provided, it will be used as the default values for the parameters of the
79
+ * tool call, if GPT doesn't provide them:
80
+ * ```
81
+ * "defaults": {
82
+ * "hospital": "Queens Hospital"
83
+ * }
84
+ * ```
85
+ *
86
+ * Some special "transform" handling is supported if the value is a dict with a single `transform`
87
+ * key. The parameter value will be transformed by the given `action` before being used as the
88
+ * default value:
89
+ *
90
+ * Removing an unwanted parameter:
91
+ * ```
92
+ * "defaults": {
93
+ * "hospital": {
94
+ * "transform": {
95
+ * "action": "remove"
96
+ * }
97
+ * }
98
+ * }
99
+ * ```
100
+ *
101
+ * Add custom parameters from other parameters using Python's `format`:
102
+ * ```
103
+ * "defaults": {
104
+ * "hello": {
105
+ * "transform": {
106
+ * "format": "Hello, {name}!"
107
+ * }
108
+ * }
109
+ * }
110
+ *
111
+ * Modify a value conditionally, e.g. change a `city` parameter with value "Bronx" to "The Bronx":
112
+ * ```
113
+ * {
114
+ * "defaults": {
115
+ * "city": {
116
+ * "transform": {
117
+ * "when": {"operator": "eq", "key": "city", "value": "Bronx"},
118
+ * "action": "override",
119
+ * "format": "The {city}"
120
+ * }
121
+ * }
122
+ * }
123
+ * }
124
+ * ```
29
125
  */
30
126
  export type ToolDefinition = {
31
- type?: string | null | undefined;
127
+ /**
128
+ * The action to take when GPT calls the tool.
129
+ */
130
+ type?: Type | null | undefined;
32
131
  /**
33
132
  * The tool definition to be used by the OpenAI API.
34
133
  */
35
134
  tool: SchemasCortexV1ToolsTool;
135
+ /**
136
+ * The configuration for an HTTP API call.
137
+ */
36
138
  endpoint?: HttpEndpoint | null | undefined;
37
- defaults?: Defaults | null | undefined;
139
+ /**
140
+ * The default values for the parameters of the function/tool call.
141
+ */
142
+ defaults?: One | { [k: string]: ToolParameterDefault } | null | undefined;
143
+ /**
144
+ * The optional result of the tool call. Only used for `context` tools.
145
+ */
38
146
  result?: Result | null | undefined;
39
147
  };
40
148
 
149
+ /** @internal */
150
+ export const Type$inboundSchema: z.ZodNativeEnum<typeof Type> = z.nativeEnum(
151
+ Type,
152
+ );
153
+
154
+ /** @internal */
155
+ export const Type$outboundSchema: z.ZodNativeEnum<typeof Type> =
156
+ Type$inboundSchema;
157
+
158
+ /**
159
+ * @internal
160
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
161
+ */
162
+ export namespace Type$ {
163
+ /** @deprecated use `Type$inboundSchema` instead. */
164
+ export const inboundSchema = Type$inboundSchema;
165
+ /** @deprecated use `Type$outboundSchema` instead. */
166
+ export const outboundSchema = Type$outboundSchema;
167
+ }
168
+
169
+ /** @internal */
170
+ export const One$inboundSchema: z.ZodType<One, z.ZodTypeDef, unknown> = z
171
+ .object({});
172
+
173
+ /** @internal */
174
+ export type One$Outbound = {};
175
+
176
+ /** @internal */
177
+ export const One$outboundSchema: z.ZodType<One$Outbound, z.ZodTypeDef, One> = z
178
+ .object({});
179
+
180
+ /**
181
+ * @internal
182
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
183
+ */
184
+ export namespace One$ {
185
+ /** @deprecated use `One$inboundSchema` instead. */
186
+ export const inboundSchema = One$inboundSchema;
187
+ /** @deprecated use `One$outboundSchema` instead. */
188
+ export const outboundSchema = One$outboundSchema;
189
+ /** @deprecated use `One$Outbound` instead. */
190
+ export type Outbound = One$Outbound;
191
+ }
192
+
193
+ /** @internal */
194
+ export const Defaults$inboundSchema: z.ZodType<
195
+ Defaults,
196
+ z.ZodTypeDef,
197
+ unknown
198
+ > = z.union([
199
+ z.lazy(() => One$inboundSchema),
200
+ z.record(ToolParameterDefault$inboundSchema),
201
+ ]);
202
+
203
+ /** @internal */
204
+ export type Defaults$Outbound = One$Outbound | {
205
+ [k: string]: ToolParameterDefault$Outbound;
206
+ };
207
+
208
+ /** @internal */
209
+ export const Defaults$outboundSchema: z.ZodType<
210
+ Defaults$Outbound,
211
+ z.ZodTypeDef,
212
+ Defaults
213
+ > = z.union([
214
+ z.lazy(() => One$outboundSchema),
215
+ z.record(ToolParameterDefault$outboundSchema),
216
+ ]);
217
+
218
+ /**
219
+ * @internal
220
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
221
+ */
222
+ export namespace Defaults$ {
223
+ /** @deprecated use `Defaults$inboundSchema` instead. */
224
+ export const inboundSchema = Defaults$inboundSchema;
225
+ /** @deprecated use `Defaults$outboundSchema` instead. */
226
+ export const outboundSchema = Defaults$outboundSchema;
227
+ /** @deprecated use `Defaults$Outbound` instead. */
228
+ export type Outbound = Defaults$Outbound;
229
+ }
230
+
41
231
  /** @internal */
42
232
  export const Result$inboundSchema: z.ZodType<Result, z.ZodTypeDef, unknown> = z
43
233
  .object({});
@@ -71,10 +261,15 @@ export const ToolDefinition$inboundSchema: z.ZodType<
71
261
  z.ZodTypeDef,
72
262
  unknown
73
263
  > = z.object({
74
- type: z.nullable(z.string()).optional(),
264
+ type: z.nullable(Type$inboundSchema).optional(),
75
265
  tool: SchemasCortexV1ToolsTool$inboundSchema,
76
266
  endpoint: z.nullable(HttpEndpoint$inboundSchema).optional(),
77
- defaults: z.nullable(Defaults$inboundSchema).optional(),
267
+ defaults: z.nullable(
268
+ z.union([
269
+ z.lazy(() => One$inboundSchema),
270
+ z.record(ToolParameterDefault$inboundSchema),
271
+ ]),
272
+ ).optional(),
78
273
  result: z.nullable(z.lazy(() => Result$inboundSchema)).optional(),
79
274
  });
80
275
 
@@ -83,7 +278,11 @@ export type ToolDefinition$Outbound = {
83
278
  type?: string | null | undefined;
84
279
  tool: SchemasCortexV1ToolsTool$Outbound;
85
280
  endpoint?: HttpEndpoint$Outbound | null | undefined;
86
- defaults?: Defaults$Outbound | null | undefined;
281
+ defaults?:
282
+ | One$Outbound
283
+ | { [k: string]: ToolParameterDefault$Outbound }
284
+ | null
285
+ | undefined;
87
286
  result?: Result$Outbound | null | undefined;
88
287
  };
89
288
 
@@ -93,10 +292,15 @@ export const ToolDefinition$outboundSchema: z.ZodType<
93
292
  z.ZodTypeDef,
94
293
  ToolDefinition
95
294
  > = z.object({
96
- type: z.nullable(z.string()).optional(),
295
+ type: z.nullable(Type$outboundSchema).optional(),
97
296
  tool: SchemasCortexV1ToolsTool$outboundSchema,
98
297
  endpoint: z.nullable(HttpEndpoint$outboundSchema).optional(),
99
- defaults: z.nullable(Defaults$outboundSchema).optional(),
298
+ defaults: z.nullable(
299
+ z.union([
300
+ z.lazy(() => One$outboundSchema),
301
+ z.record(ToolParameterDefault$outboundSchema),
302
+ ]),
303
+ ).optional(),
100
304
  result: z.nullable(z.lazy(() => Result$outboundSchema)).optional(),
101
305
  });
102
306
 
@@ -3,6 +3,7 @@
3
3
  */
4
4
 
5
5
  import * as z from "zod";
6
+ import { ClosedEnum } from "../../types/enums.js";
6
7
  import {
7
8
  ToolParameterTransformCondition,
8
9
  ToolParameterTransformCondition$inboundSchema,
@@ -10,18 +11,56 @@ import {
10
11
  ToolParameterTransformCondition$outboundSchema,
11
12
  } from "./toolparametertransformcondition.js";
12
13
 
14
+ /**
15
+ * The action to perform on the value: `default` means only set the value (using the `format` field) if the parameter doesn't exist or is empty, `override` means always set the value, and `remove` means remove the parameter value.
16
+ */
17
+ export const Action = {
18
+ Default: "default",
19
+ Override: "override",
20
+ Remove: "remove",
21
+ } as const;
22
+ /**
23
+ * The action to perform on the value: `default` means only set the value (using the `format` field) if the parameter doesn't exist or is empty, `override` means always set the value, and `remove` means remove the parameter value.
24
+ */
25
+ export type Action = ClosedEnum<typeof Action>;
26
+
13
27
  /**
14
28
  * A transform to be applied to the value of a parameter.
15
29
  */
16
30
  export type ToolParameterTransform = {
31
+ /**
32
+ * Only apply the transform if the condition is met.
33
+ */
17
34
  when?: ToolParameterTransformCondition | null | undefined;
18
35
  /**
19
36
  * The action to perform on the value: `default` means only set the value (using the `format` field) if the parameter doesn't exist or is empty, `override` means always set the value, and `remove` means remove the parameter value.
20
37
  */
21
- action?: string | null | undefined;
38
+ action?: Action | undefined;
39
+ /**
40
+ * The string value to use for the parameter. The value will be evaluated with the Python `str.format` method, for example, `Hello, {name}!`
41
+ */
22
42
  format?: string | null | undefined;
23
43
  };
24
44
 
45
+ /** @internal */
46
+ export const Action$inboundSchema: z.ZodNativeEnum<typeof Action> = z
47
+ .nativeEnum(Action);
48
+
49
+ /** @internal */
50
+ export const Action$outboundSchema: z.ZodNativeEnum<typeof Action> =
51
+ Action$inboundSchema;
52
+
53
+ /**
54
+ * @internal
55
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
56
+ */
57
+ export namespace Action$ {
58
+ /** @deprecated use `Action$inboundSchema` instead. */
59
+ export const inboundSchema = Action$inboundSchema;
60
+ /** @deprecated use `Action$outboundSchema` instead. */
61
+ export const outboundSchema = Action$outboundSchema;
62
+ }
63
+
25
64
  /** @internal */
26
65
  export const ToolParameterTransform$inboundSchema: z.ZodType<
27
66
  ToolParameterTransform,
@@ -29,14 +68,14 @@ export const ToolParameterTransform$inboundSchema: z.ZodType<
29
68
  unknown
30
69
  > = z.object({
31
70
  when: z.nullable(ToolParameterTransformCondition$inboundSchema).optional(),
32
- action: z.nullable(z.string()).optional(),
71
+ action: Action$inboundSchema.default("default"),
33
72
  format: z.nullable(z.string()).optional(),
34
73
  });
35
74
 
36
75
  /** @internal */
37
76
  export type ToolParameterTransform$Outbound = {
38
77
  when?: ToolParameterTransformCondition$Outbound | null | undefined;
39
- action?: string | null | undefined;
78
+ action: string;
40
79
  format?: string | null | undefined;
41
80
  };
42
81
 
@@ -47,7 +86,7 @@ export const ToolParameterTransform$outboundSchema: z.ZodType<
47
86
  ToolParameterTransform
48
87
  > = z.object({
49
88
  when: z.nullable(ToolParameterTransformCondition$outboundSchema).optional(),
50
- action: z.nullable(z.string()).optional(),
89
+ action: Action$outboundSchema.default("default"),
51
90
  format: z.nullable(z.string()).optional(),
52
91
  });
53
92