@tstdl/base 0.92.33 → 0.92.35

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,10 +1,8 @@
1
1
  import '../polyfills.js';
2
2
  import { Resolvable, type resolveArgumentType } from '../injector/interfaces.js';
3
- import { FileContentPart, FileInput, AiModel } from './types.js';
4
- export type AiFileServiceOptions = {
5
- apiKey: string;
6
- defaultModel?: AiModel;
7
- };
3
+ import { AiServiceOptions } from './ai.service.js';
4
+ import { FileContentPart, FileInput } from './types.js';
5
+ export type AiFileServiceOptions = Pick<AiServiceOptions, 'apiKey' | 'vertex'>;
8
6
  export type AiFileServiceArgument = AiFileServiceOptions;
9
7
  type File = {
10
8
  id: string;
package/ai/ai.service.js CHANGED
@@ -214,7 +214,7 @@ Always output the content and tags in ${options?.targetLanguage ?? 'the same lan
214
214
  maxOutputTokens: Math.min(8192, maxTotalOutputTokens - totalOutputTokens)
215
215
  },
216
216
  systemInstruction: request.systemInstruction,
217
- tools: isDefined(googleFunctionDeclarations) ? [{ functionDeclarations: googleFunctionDeclarations }] : undefined,
217
+ tools: (isDefined(googleFunctionDeclarations) && (googleFunctionDeclarations.length > 0)) ? [{ functionDeclarations: googleFunctionDeclarations }] : undefined,
218
218
  toolConfig: isDefined(request.functionCallingMode)
219
219
  ? { functionCallingConfig: { mode: functionCallingModeMap[request.functionCallingMode] } }
220
220
  : undefined,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tstdl/base",
3
- "version": "0.92.33",
3
+ "version": "0.92.35",
4
4
  "author": "Patrick Hein",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -4,5 +4,5 @@ export declare function compareByValueSelectionOrdered<T>(...selectors: (readonl
4
4
  export declare function compareByValueToOrder<T>(order: T[]): (a: T, b: T) => number;
5
5
  export declare const orderRest: unique symbol;
6
6
  export declare function compareByValueSelectionToOrder<T, TSelect>(order: (TSelect | typeof orderRest)[], selector: (item: T) => TSelect): (a: T, b: T) => number;
7
- export declare function compareByValue<T>(a: T, b: T): number;
8
- export declare function compareByValueDescending<T>(a: T, b: T): number;
7
+ export declare function compareByValue<T>(a: T, b: T, strict?: boolean): number;
8
+ export declare function compareByValueDescending<T>(a: T, b: T, strict?: boolean): number;
@@ -58,7 +58,7 @@ export function compareByValueSelectionToOrder(order, selector) {
58
58
  return compareByValue(indexA, indexB);
59
59
  };
60
60
  }
61
- export function compareByValue(a, b) {
61
+ export function compareByValue(a, b, strict = true) {
62
62
  if (a === b) {
63
63
  return 0;
64
64
  }
@@ -68,9 +68,12 @@ export function compareByValue(a, b) {
68
68
  else if (b > a) {
69
69
  return -1;
70
70
  }
71
- throw new Error('objects not comparable');
71
+ if (!strict) {
72
+ return 0;
73
+ }
74
+ throw new Error('Objects not comparable');
72
75
  }
73
- export function compareByValueDescending(a, b) {
76
+ export function compareByValueDescending(a, b, strict = true) {
74
77
  if (a === b) {
75
78
  return 0;
76
79
  }
@@ -80,5 +83,8 @@ export function compareByValueDescending(a, b) {
80
83
  else if (b > a) {
81
84
  return 1;
82
85
  }
83
- throw new Error('objects not comparable');
86
+ if (!strict) {
87
+ return 0;
88
+ }
89
+ throw new Error('Objects not comparable');
84
90
  }