@tstdl/base 0.92.106 → 0.92.107

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/ai/ai.service.js CHANGED
@@ -177,7 +177,7 @@ Always output the content and tags in ${options?.targetLanguage ?? 'the same lan
177
177
  for (const call of generation.functionCalls) {
178
178
  const fn = assertDefinedPass(options.functions[call.name], 'Function in response not declared.');
179
179
  const parametersSchema = await resolveValueOrAsyncProvider(fn.parameters);
180
- const parameters = parametersSchema.parse(call.parameters);
180
+ const parameters = isDefined(parametersSchema) ? parametersSchema.parse(call.parameters) : call.parameters;
181
181
  const handlerResult = isSchemaFunctionDeclarationWithHandler(fn) ? await fn.handler(parameters) : undefined;
182
182
  result.push({ functionName: call.name, parameters: parameters, handlerResult: handlerResult });
183
183
  }
@@ -317,7 +317,7 @@ Always output the content and tags in ${options?.targetLanguage ?? 'the same lan
317
317
  for (const call of generation.functionCalls) {
318
318
  const fn = assertDefinedPass(options.functions[call.name], 'Function in response not declared.');
319
319
  const parametersSchema = await resolveValueOrAsyncProvider(fn.parameters);
320
- const parameters = parametersSchema.parse(call.parameters);
320
+ const parameters = isDefined(parametersSchema) ? parametersSchema.parse(call.parameters) : call.parameters;
321
321
  const handlerResult = isSchemaFunctionDeclarationWithHandler(fn) ? await fn.handler(parameters) : undefined;
322
322
  yield { functionName: call.name, parameters: parameters, handlerResult: handlerResult };
323
323
  }
@@ -358,7 +358,7 @@ Always output the content and tags in ${options?.targetLanguage ?? 'the same lan
358
358
  return {
359
359
  name,
360
360
  description: declaration.description,
361
- parameters: convertToOpenApiSchema(parametersSchema)
361
+ parameters: isDefined(parametersSchema) ? convertToOpenApiSchema(parametersSchema) : undefined
362
362
  };
363
363
  });
364
364
  const functionsArray = await toArrayAsync(mapped);
package/ai/types.d.ts CHANGED
@@ -9,7 +9,7 @@ export type FileInput = {
9
9
  export type SchemaFunctionDeclarations = Record<string, SchemaFunctionDeclaration<any>>;
10
10
  export type SchemaFunctionDeclarationWithoutHandler<T extends Record = Record> = {
11
11
  description: string;
12
- parameters: ValueOrAsyncProvider<ObjectSchema<T>>;
12
+ parameters?: ValueOrAsyncProvider<ObjectSchema<T>>;
13
13
  enabled?: ValueOrAsyncProvider<boolean>;
14
14
  };
15
15
  export type SchemaFunctionDeclarationWithHandler<T extends Record = Record, R = unknown> = SchemaFunctionDeclarationWithoutHandler<T> & {
@@ -20,7 +20,7 @@ export type SchemaFunctionDeclarationHandlerResult<T extends SchemaFunctionDecla
20
20
  export type SchemaFunctionDeclarationsResult<T extends SchemaFunctionDeclarations = SchemaFunctionDeclarations> = {
21
21
  [P in keyof T]: {
22
22
  functionName: P;
23
- parameters: SchemaOutput<ResolvedValueOrProvider<T[P]['parameters']>>;
23
+ parameters: SchemaOutput<NonNullable<ResolvedValueOrProvider<T[P]['parameters']>>>;
24
24
  handlerResult: SchemaFunctionDeclarationHandlerResult<T[P]>;
25
25
  };
26
26
  }[keyof T];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tstdl/base",
3
- "version": "0.92.106",
3
+ "version": "0.92.107",
4
4
  "author": "Patrick Hein",
5
5
  "publishConfig": {
6
6
  "access": "public"