@decocms/bindings 1.0.5 → 1.0.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decocms/bindings",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "check": "tsc --noEmit",
@@ -53,6 +53,19 @@ const TextPartSchema = z.object({
53
53
  providerOptions: ProviderOptionsSchema,
54
54
  });
55
55
 
56
+ /**
57
+ * Text Output Part Schema
58
+ * Text content generated by the model (uses providerMetadata instead of providerOptions)
59
+ */
60
+ const TextOutputPartSchema = z.object({
61
+ type: z.literal("text"),
62
+ text: z.string().describe("The text content"),
63
+ providerMetadata: z
64
+ .any()
65
+ .optional()
66
+ .describe("Additional provider-specific metadata"),
67
+ });
68
+
56
69
  /**
57
70
  * Data Content Schema
58
71
  * File data can be a URL string or a base64 encoded string
@@ -73,6 +86,18 @@ const FilePartSchema = z.object({
73
86
  providerOptions: ProviderOptionsSchema,
74
87
  });
75
88
 
89
+ /**
90
+ * File Output Part Schema
91
+ * File content generated by the model
92
+ */
93
+ const FileOutputPartSchema = z.object({
94
+ type: z.literal("file"),
95
+ mediaType: z
96
+ .string()
97
+ .describe("IANA media type of the file (e.g., image/png, audio/mp3)"),
98
+ data: z.string().describe("Generated file data as base64 encoded string"),
99
+ });
100
+
76
101
  /**
77
102
  * Reasoning Part Schema
78
103
  * Reasoning content part of a prompt
@@ -83,6 +108,19 @@ const ReasoningPartSchema = z.object({
83
108
  providerOptions: ProviderOptionsSchema,
84
109
  });
85
110
 
111
+ /**
112
+ * Reasoning Output Part Schema
113
+ * Reasoning content generated by the model
114
+ */
115
+ const ReasoningOutputPartSchema = z.object({
116
+ type: z.literal("reasoning"),
117
+ text: z.string().describe("The reasoning text"),
118
+ providerMetadata: z
119
+ .any()
120
+ .optional()
121
+ .describe("Additional provider-specific metadata"),
122
+ });
123
+
86
124
  /**
87
125
  * Tool Call Part Schema
88
126
  * Tool call content part of a prompt (usually generated by the AI model)
@@ -105,6 +143,27 @@ const ToolCallPartSchema = z.object({
105
143
  providerOptions: ProviderOptionsSchema,
106
144
  });
107
145
 
146
+ /**
147
+ * Tool Call Output Part Schema
148
+ * Tool call content generated by the model
149
+ */
150
+ const ToolCallOutputPartSchema = z.object({
151
+ type: z.literal("tool-call"),
152
+ toolCallId: z.string().describe("ID of the tool call"),
153
+ toolName: z.string().describe("Name of the tool being called"),
154
+ input: z
155
+ .string()
156
+ .describe("Stringified JSON object with the tool call arguments"),
157
+ providerExecuted: z
158
+ .boolean()
159
+ .optional()
160
+ .describe("Whether the tool call will be executed by the provider"),
161
+ providerMetadata: z
162
+ .any()
163
+ .optional()
164
+ .describe("Additional provider-specific metadata"),
165
+ });
166
+
108
167
  /**
109
168
  * Tool Result Output Schema
110
169
  * The output of a tool result
@@ -159,6 +218,66 @@ const ToolResultPartSchema = z.object({
159
218
  providerOptions: ProviderOptionsSchema,
160
219
  });
161
220
 
221
+ /**
222
+ * Tool Result Output Part Schema
223
+ * Tool result content generated by the model (provider-executed tools)
224
+ */
225
+ const ToolResultOutputPartSchema = z.object({
226
+ type: z.literal("tool-result"),
227
+ toolCallId: z
228
+ .string()
229
+ .describe("ID of the tool call that this result is associated with"),
230
+ toolName: z.string().describe("Name of the tool that generated this result"),
231
+ result: z.any().describe("Result of the tool call (JSON-serializable)"),
232
+ isError: z
233
+ .boolean()
234
+ .optional()
235
+ .describe("Whether the result is an error or error message"),
236
+ providerExecuted: z
237
+ .boolean()
238
+ .optional()
239
+ .describe("Whether the tool result was generated by the provider"),
240
+ providerMetadata: z
241
+ .any()
242
+ .optional()
243
+ .describe("Additional provider-specific metadata"),
244
+ });
245
+
246
+ /**
247
+ * Source Part Schema
248
+ * Source content generated by the model (references to web or document sources)
249
+ */
250
+ const SourcePartSchema = z.union([
251
+ z.object({
252
+ type: z.literal("source"),
253
+ sourceType: z.literal("url"),
254
+ id: z.string().describe("The ID of the source"),
255
+ url: z.string().describe("The URL of the source"),
256
+ title: z.string().optional().describe("The title of the source"),
257
+ providerMetadata: z
258
+ .any()
259
+ .optional()
260
+ .describe("Additional provider-specific metadata"),
261
+ }),
262
+ z.object({
263
+ type: z.literal("source"),
264
+ sourceType: z.literal("document"),
265
+ id: z.string().describe("The ID of the source"),
266
+ mediaType: z
267
+ .string()
268
+ .describe("IANA media type of the document (e.g., application/pdf)"),
269
+ title: z.string().describe("The title of the document"),
270
+ filename: z
271
+ .string()
272
+ .optional()
273
+ .describe("Optional filename of the document"),
274
+ providerMetadata: z
275
+ .any()
276
+ .optional()
277
+ .describe("Additional provider-specific metadata"),
278
+ }),
279
+ ]);
280
+
162
281
  /**
163
282
  * System Message Schema
164
283
  */
@@ -353,11 +472,12 @@ export const LanguageModelGenerateOutputSchema = z.object({
353
472
  content: z
354
473
  .array(
355
474
  z.union([
356
- TextPartSchema,
357
- FilePartSchema,
358
- ReasoningPartSchema,
359
- ToolCallPartSchema,
360
- ToolResultPartSchema,
475
+ TextOutputPartSchema,
476
+ FileOutputPartSchema,
477
+ ReasoningOutputPartSchema,
478
+ ToolCallOutputPartSchema,
479
+ ToolResultOutputPartSchema,
480
+ SourcePartSchema,
361
481
  ]),
362
482
  )
363
483
  .describe(