@decocms/bindings 1.0.4 → 1.0.5

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.4",
3
+ "version": "1.0.5",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "check": "tsc --noEmit",
@@ -55,11 +55,9 @@ const TextPartSchema = z.object({
55
55
 
56
56
  /**
57
57
  * Data Content Schema
58
- * File data can be Uint8Array (as base64 string), base64 encoded string, or URL string
58
+ * File data can be a URL string or a base64 encoded string
59
59
  */
60
- const DataContentSchema = z
61
- .union([z.string(), z.instanceof(Uint8Array)])
62
- .describe("File data as base64 encoded string, URL string, or Uint8Array");
60
+ const DataContentSchema = z.string().describe("File data as URL string");
63
61
 
64
62
  /**
65
63
  * File Part Schema
@@ -96,7 +94,7 @@ const ToolCallPartSchema = z.object({
96
94
  .describe("ID of the tool call, used to match with tool result"),
97
95
  toolName: z.string().describe("Name of the tool being called"),
98
96
  input: z
99
- .unknown()
97
+ .string()
100
98
  .describe(
101
99
  "Arguments of the tool call (JSON-serializable object matching tool input schema)",
102
100
  ),
@@ -157,6 +155,7 @@ const ToolResultPartSchema = z.object({
157
155
  .describe("ID of the tool call that this result is associated with"),
158
156
  toolName: z.string().describe("Name of the tool that generated this result"),
159
157
  output: ToolResultOutputSchema.describe("Result of the tool call"),
158
+ result: z.unknown().describe("Unknown result of the tool call"),
160
159
  providerOptions: ProviderOptionsSchema,
161
160
  });
162
161
 
@@ -335,10 +334,10 @@ export const LanguageModelCallOptionsSchema = z.object({
335
334
  .describe("Abort signal for cancelling the operation"),
336
335
 
337
336
  // Additional options
338
- headers: z
339
- .record(z.string(), z.union([z.string(), z.undefined()]))
340
- .optional()
341
- .describe("Additional HTTP headers to be sent with the request"),
337
+ // headers: z
338
+ // .record(z.string(), z.union([z.string(), z.undefined()]))
339
+ // .optional()
340
+ // .describe("Additional HTTP headers to be sent with the request"),
342
341
  providerOptions: z
343
342
  .any()
344
343
  .optional()
@@ -352,7 +351,15 @@ export const LanguageModelCallOptionsSchema = z.object({
352
351
  export const LanguageModelGenerateOutputSchema = z.object({
353
352
  // Ordered content that the model has generated
354
353
  content: z
355
- .array(z.any())
354
+ .array(
355
+ z.union([
356
+ TextPartSchema,
357
+ FilePartSchema,
358
+ ReasoningPartSchema,
359
+ ToolCallPartSchema,
360
+ ToolResultPartSchema,
361
+ ]),
362
+ )
356
363
  .describe(
357
364
  "Ordered content that the model has generated (text, tool-calls, reasoning, files, sources)",
358
365
  ),
@@ -372,20 +379,12 @@ export const LanguageModelGenerateOutputSchema = z.object({
372
379
 
373
380
  // Usage information (required)
374
381
  usage: z
375
- .object({
382
+ .looseObject({
376
383
  inputTokens: z.number().optional(),
377
384
  outputTokens: z.number().optional(),
378
385
  totalTokens: z.number().optional(),
379
386
  reasoningTokens: z.number().optional(),
380
387
  })
381
- .passthrough()
382
- .transform((val) => ({
383
- inputTokens: val.inputTokens,
384
- outputTokens: val.outputTokens,
385
- totalTokens: val.totalTokens,
386
- reasoningTokens: val.reasoningTokens,
387
- ...val,
388
- }))
389
388
  .describe("Usage information for the language model call"),
390
389
 
391
390
  // Provider metadata
@@ -409,8 +408,8 @@ export const LanguageModelGenerateOutputSchema = z.object({
409
408
  response: z
410
409
  .object({
411
410
  id: z.string().optional().describe("ID for the generated response"),
412
- timestamp: z
413
- .date()
411
+ timestamp: z.iso
412
+ .datetime()
414
413
  .optional()
415
414
  .describe("Timestamp for the start of the generated response"),
416
415
  modelId: z