@tstdl/base 0.92.32 → 0.92.33
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.d.ts
CHANGED
|
@@ -12,6 +12,10 @@ export type SpecializedGenerationResultGenerator<T> = AsyncGenerator<T> & {
|
|
|
12
12
|
};
|
|
13
13
|
export declare class AiServiceOptions {
|
|
14
14
|
apiKey: string;
|
|
15
|
+
vertex?: {
|
|
16
|
+
project: string;
|
|
17
|
+
location: string;
|
|
18
|
+
};
|
|
15
19
|
defaultModel?: AiModel;
|
|
16
20
|
}
|
|
17
21
|
export type AiServiceArgument = AiServiceOptions;
|
package/ai/ai.service.js
CHANGED
|
@@ -4,7 +4,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { FinishReason, FunctionCallingMode as GoogleFunctionCallingMode,
|
|
7
|
+
import { FinishReason, FunctionCallingMode as GoogleFunctionCallingMode, VertexAI } from '@google-cloud/vertexai';
|
|
8
|
+
import { GoogleGenerativeAI } from '@google/generative-ai';
|
|
8
9
|
import { NotSupportedError } from '../errors/not-supported.error.js';
|
|
9
10
|
import { Singleton } from '../injector/decorators.js';
|
|
10
11
|
import { inject, injectArgument } from '../injector/inject.js';
|
|
@@ -23,6 +24,7 @@ import { AiSession } from './ai-session.js';
|
|
|
23
24
|
import { isSchemaFunctionDeclarationWithHandler } from './types.js';
|
|
24
25
|
export class AiServiceOptions {
|
|
25
26
|
apiKey;
|
|
27
|
+
vertex;
|
|
26
28
|
defaultModel;
|
|
27
29
|
}
|
|
28
30
|
;
|
|
@@ -34,7 +36,9 @@ const functionCallingModeMap = {
|
|
|
34
36
|
let AiService = class AiService {
|
|
35
37
|
#options = injectArgument(this, { optional: true }) ?? inject(AiServiceOptions);
|
|
36
38
|
#fileService = inject(AiFileService, this.#options);
|
|
37
|
-
#genAI =
|
|
39
|
+
#genAI = (isDefined(this.#options.vertex)
|
|
40
|
+
? new VertexAI({ project: this.#options.vertex.project, location: this.#options.vertex.location, googleAuthOptions: { apiKey: this.#options.apiKey } })
|
|
41
|
+
: new GoogleGenerativeAI(this.#options.apiKey));
|
|
38
42
|
defaultModel = this.#options.defaultModel ?? 'gemini-2.0-flash-exp';
|
|
39
43
|
createSession() {
|
|
40
44
|
return new AiSession(this);
|
|
@@ -195,7 +199,6 @@ Always output the content and tags in ${options?.targetLanguage ?? 'the same lan
|
|
|
195
199
|
topK: request.generationOptions?.topK,
|
|
196
200
|
responseMimeType: isDefined(request.generationSchema) ? 'application/json' : undefined,
|
|
197
201
|
responseSchema: isDefined(request.generationSchema) ? convertToOpenApiSchema(request.generationSchema) : undefined,
|
|
198
|
-
presencePenalty: request.generationOptions?.presencePenalty,
|
|
199
202
|
frequencyPenalty: request.generationOptions?.frequencyPenalty
|
|
200
203
|
};
|
|
201
204
|
const inputContent = this.convertContents(request.contents);
|
package/ai/types.d.ts
CHANGED
|
@@ -32,8 +32,8 @@ export declare const documentManagementApiDefinition: {
|
|
|
32
32
|
resource: string;
|
|
33
33
|
method: "GET";
|
|
34
34
|
parameters: import("../../schema/index.js").ObjectSchema<{
|
|
35
|
-
readonly id: string;
|
|
36
35
|
readonly title: string | null;
|
|
36
|
+
readonly id: string;
|
|
37
37
|
readonly download?: boolean | undefined;
|
|
38
38
|
}>;
|
|
39
39
|
result: Uint8ArrayConstructor;
|
|
@@ -43,8 +43,8 @@ export declare const documentManagementApiDefinition: {
|
|
|
43
43
|
resource: string;
|
|
44
44
|
method: "GET";
|
|
45
45
|
parameters: import("../../schema/index.js").ObjectSchema<{
|
|
46
|
-
readonly id: string;
|
|
47
46
|
readonly title: string | null;
|
|
47
|
+
readonly id: string;
|
|
48
48
|
readonly download?: boolean | undefined;
|
|
49
49
|
}>;
|
|
50
50
|
result: import("../../schema/index.js").StringSchema;
|
|
@@ -406,8 +406,8 @@ declare const _DocumentManagementApi: import("../../api/index.js").ApiClient<{
|
|
|
406
406
|
resource: string;
|
|
407
407
|
method: "GET";
|
|
408
408
|
parameters: import("../../schema/index.js").ObjectSchema<{
|
|
409
|
-
readonly id: string;
|
|
410
409
|
readonly title: string | null;
|
|
410
|
+
readonly id: string;
|
|
411
411
|
readonly download?: boolean | undefined;
|
|
412
412
|
}>;
|
|
413
413
|
result: Uint8ArrayConstructor;
|
|
@@ -417,8 +417,8 @@ declare const _DocumentManagementApi: import("../../api/index.js").ApiClient<{
|
|
|
417
417
|
resource: string;
|
|
418
418
|
method: "GET";
|
|
419
419
|
parameters: import("../../schema/index.js").ObjectSchema<{
|
|
420
|
-
readonly id: string;
|
|
421
420
|
readonly title: string | null;
|
|
421
|
+
readonly id: string;
|
|
422
422
|
readonly download?: boolean | undefined;
|
|
423
423
|
}>;
|
|
424
424
|
result: import("../../schema/index.js").StringSchema;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tstdl/base",
|
|
3
|
-
"version": "0.92.
|
|
3
|
+
"version": "0.92.33",
|
|
4
4
|
"author": "Patrick Hein",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -118,6 +118,7 @@
|
|
|
118
118
|
"./utils/string": "./utils/string/index.js"
|
|
119
119
|
},
|
|
120
120
|
"dependencies": {
|
|
121
|
+
"@google-cloud/vertexai": "^1.9.2",
|
|
121
122
|
"disposablestack": "1.1",
|
|
122
123
|
"luxon": "^3.5",
|
|
123
124
|
"reflect-metadata": "^0.2",
|