@tstdl/base 0.92.18 → 0.92.19

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.
@@ -7,10 +7,10 @@ export type SpecializedGenerationResult<T> = {
7
7
  result: T;
8
8
  raw: GenerationResult;
9
9
  };
10
- export type AiServiceOptions = {
10
+ export declare class AiServiceOptions {
11
11
  apiKey: string;
12
12
  defaultModel?: AiModel;
13
- };
13
+ }
14
14
  export type AiServiceArgument = AiServiceOptions;
15
15
  export type ClassificationResult<T extends EnumerationType> = {
16
16
  types: {
package/ai/ai.service.js CHANGED
@@ -16,13 +16,18 @@ import { assertDefinedPass, assertNotNullPass, isDefined } from '../utils/type-g
16
16
  import { AiFileService } from './ai-file.service.js';
17
17
  import { AiSession } from './ai-session.js';
18
18
  import { isSchemaFunctionDeclarationWithHandler } from './types.js';
19
+ export class AiServiceOptions {
20
+ apiKey;
21
+ defaultModel;
22
+ }
23
+ ;
19
24
  const functionCallingModeMap = {
20
25
  auto: GoogleFunctionCallingMode.AUTO,
21
26
  force: GoogleFunctionCallingMode.ANY,
22
27
  none: GoogleFunctionCallingMode.NONE
23
28
  };
24
29
  let AiService = class AiService {
25
- #options = injectArgument(this);
30
+ #options = injectArgument(this, { optional: true }) ?? inject(AiServiceOptions);
26
31
  #fileService = inject(AiFileService, this.#options);
27
32
  #genAI = new GoogleGenerativeAI(this.#options.apiKey);
28
33
  defaultModel = this.#options.defaultModel ?? 'gemini-2.0-flash-exp';
package/ai/index.d.ts CHANGED
@@ -2,4 +2,5 @@ export * from './ai-file.service.js';
2
2
  export * from './ai-session.js';
3
3
  export * from './ai.service.js';
4
4
  export * from './functions.js';
5
+ export * from './module.js';
5
6
  export * from './types.js';
package/ai/index.js CHANGED
@@ -2,4 +2,5 @@ export * from './ai-file.service.js';
2
2
  export * from './ai-session.js';
3
3
  export * from './ai.service.js';
4
4
  export * from './functions.js';
5
+ export * from './module.js';
5
6
  export * from './types.js';
package/ai/module.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ import { AiServiceOptions } from './ai.service.js';
2
+ export type ApiModuleOptions = AiServiceOptions;
3
+ export declare function configureAiService(options: ApiModuleOptions): void;
package/ai/module.js ADDED
@@ -0,0 +1,5 @@
1
+ import { Injector } from '../injector/injector.js';
2
+ import { AiServiceOptions } from './ai.service.js';
3
+ export function configureAiService(options) {
4
+ Injector.register(AiServiceOptions, { useValue: options });
5
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tstdl/base",
3
- "version": "0.92.18",
3
+ "version": "0.92.19",
4
4
  "author": "Patrick Hein",
5
5
  "publishConfig": {
6
6
  "access": "public"