@tstdl/base 0.93.110 → 0.93.111
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/genkit/index.d.ts +2 -0
- package/ai/genkit/index.js +2 -0
- package/ai/genkit/module.d.ts +6 -1
- package/ai/genkit/module.js +18 -0
- package/ai/genkit/multi-region.plugin.d.ts +424 -0
- package/ai/genkit/multi-region.plugin.js +70 -0
- package/ai/genkit/tests/multi-region.test.d.ts +1 -0
- package/ai/genkit/tests/multi-region.test.js +140 -0
- package/ai/genkit/types.d.ts +12 -0
- package/ai/genkit/types.js +1 -0
- package/authentication/tests/authentication.api-controller.test.js +9 -1
- package/authentication/tests/authentication.client-service.test.js +9 -1
- package/logger/formatters/pretty-print.js +1 -1
- package/orm/sqls/sqls.d.ts +5 -5
- package/orm/sqls/sqls.js +30 -13
- package/orm/tests/query-converter-complex.test.js +5 -5
- package/package.json +2 -2
- package/task-queue/task-queue.js +1 -1
- package/test1.js +49 -61
- package/typst/render.d.ts +1 -1
package/ai/genkit/index.d.ts
CHANGED
package/ai/genkit/index.js
CHANGED
package/ai/genkit/module.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { vertexAI } from '@genkit-ai/google-genai';
|
|
1
|
+
import { vertexAI, type GeminiConfig } from '@genkit-ai/google-genai';
|
|
2
2
|
import { type Genkit, type GenkitOptions } from 'genkit';
|
|
3
|
+
import { type GeminiModelReference } from './multi-region.plugin.js';
|
|
4
|
+
import type { VertexAiMultiLocationOptions } from './types.js';
|
|
3
5
|
/**
|
|
4
6
|
* Options for configuring the AI Module.
|
|
5
7
|
*/
|
|
@@ -20,6 +22,8 @@ export declare class GenkitModuleOptions {
|
|
|
20
22
|
/** Path to the Google Cloud credentials file */
|
|
21
23
|
keyFile?: string;
|
|
22
24
|
};
|
|
25
|
+
/** Multi-region configuration options. */
|
|
26
|
+
multiLocationVertex?: VertexAiMultiLocationOptions;
|
|
23
27
|
/** Plugins to register automatically */
|
|
24
28
|
plugins?: GenkitOptions['plugins'];
|
|
25
29
|
/** Default Genkit options */
|
|
@@ -32,4 +36,5 @@ export declare class GenkitModuleOptions {
|
|
|
32
36
|
export declare function configureGenkit(options: GenkitModuleOptions): void;
|
|
33
37
|
export declare function injectGenkit(options?: GenkitOptions): Genkit;
|
|
34
38
|
declare const _injectModel: typeof vertexAI.model;
|
|
39
|
+
export declare function injectMultiLocationModel(model: string, config?: GeminiConfig): GeminiModelReference;
|
|
35
40
|
export { _injectModel as injectModel };
|
package/ai/genkit/module.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { googleAI, vertexAI } from '@genkit-ai/google-genai';
|
|
2
2
|
import { genkit } from 'genkit';
|
|
3
|
+
import { CircuitBreakerProvider } from '../../circuit-breaker/provider.js';
|
|
3
4
|
import { inject } from '../../injector/inject.js';
|
|
4
5
|
import { Injector } from '../../injector/injector.js';
|
|
6
|
+
import { Logger } from '../../logger/logger.js';
|
|
5
7
|
import { isDefined, isNotNull } from '../../utils/type-guards.js';
|
|
8
|
+
import { vertexAiMultiLocation } from './multi-region.plugin.js';
|
|
6
9
|
/**
|
|
7
10
|
* Options for configuring the AI Module.
|
|
8
11
|
*/
|
|
@@ -11,6 +14,8 @@ export class GenkitModuleOptions {
|
|
|
11
14
|
gemini;
|
|
12
15
|
/** Vertex AI specific options. If provided, the service will use Vertex AI endpoints. */
|
|
13
16
|
vertex;
|
|
17
|
+
/** Multi-region configuration options. */
|
|
18
|
+
multiLocationVertex;
|
|
14
19
|
/** Plugins to register automatically */
|
|
15
20
|
plugins;
|
|
16
21
|
/** Default Genkit options */
|
|
@@ -36,12 +41,22 @@ export function injectGenkit(options) {
|
|
|
36
41
|
const geminiPlugin = isDefined(gemini)
|
|
37
42
|
? googleAI({ apiKey: gemini.apiKey })
|
|
38
43
|
: null;
|
|
44
|
+
const multiLocationVertexPlugin = isDefined(moduleOptions.multiLocationVertex)
|
|
45
|
+
? vertexAiMultiLocation({
|
|
46
|
+
modelNames: moduleOptions.multiLocationVertex.modelNames,
|
|
47
|
+
locations: moduleOptions.multiLocationVertex.locations,
|
|
48
|
+
circuitBreakerProvider: inject(CircuitBreakerProvider),
|
|
49
|
+
logger: inject(Logger, 'VertexAiMultiRegion'),
|
|
50
|
+
circuitBreakerConfig: moduleOptions.multiLocationVertex.circuitBreakerConfig,
|
|
51
|
+
})
|
|
52
|
+
: null;
|
|
39
53
|
return genkit({
|
|
40
54
|
...moduleOptions.options,
|
|
41
55
|
...options,
|
|
42
56
|
plugins: [
|
|
43
57
|
geminiPlugin,
|
|
44
58
|
vertexPlugin,
|
|
59
|
+
multiLocationVertexPlugin,
|
|
45
60
|
...(moduleOptions.plugins ?? []),
|
|
46
61
|
...(options?.plugins ?? []),
|
|
47
62
|
].filter(isNotNull),
|
|
@@ -53,4 +68,7 @@ function injectModel(...args) {
|
|
|
53
68
|
return provider.model(...args);
|
|
54
69
|
}
|
|
55
70
|
const _injectModel = injectModel;
|
|
71
|
+
export function injectMultiLocationModel(model, config) {
|
|
72
|
+
return vertexAiMultiLocation.model(_injectModel(model, config));
|
|
73
|
+
}
|
|
56
74
|
export { _injectModel as injectModel };
|
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
import type { CircuitBreakerProvider } from '../../circuit-breaker/provider.js';
|
|
2
|
+
import type { Logger } from '../../logger/logger.js';
|
|
3
|
+
import type { VertexAiMultiLocationOptions } from './types.js';
|
|
4
|
+
declare const geminiModelReference: import("genkit").ModelReference<import("zod").ZodObject<{
|
|
5
|
+
version: import("zod").ZodOptional<import("zod").ZodString>;
|
|
6
|
+
maxOutputTokens: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
7
|
+
topK: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
8
|
+
stopSequences: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
9
|
+
} & {
|
|
10
|
+
apiKey: import("zod").ZodOptional<import("zod").ZodString>;
|
|
11
|
+
labels: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
|
|
12
|
+
temperature: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
13
|
+
topP: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
14
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
15
|
+
safetySettings: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
16
|
+
category: import("zod").ZodEnum<["HARM_CATEGORY_UNSPECIFIED", "HARM_CATEGORY_HATE_SPEECH", "HARM_CATEGORY_DANGEROUS_CONTENT", "HARM_CATEGORY_HARASSMENT", "HARM_CATEGORY_SEXUALLY_EXPLICIT"]>;
|
|
17
|
+
threshold: import("zod").ZodEnum<["BLOCK_LOW_AND_ABOVE", "BLOCK_MEDIUM_AND_ABOVE", "BLOCK_ONLY_HIGH", "BLOCK_NONE"]>;
|
|
18
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
19
|
+
category: import("zod").ZodEnum<["HARM_CATEGORY_UNSPECIFIED", "HARM_CATEGORY_HATE_SPEECH", "HARM_CATEGORY_DANGEROUS_CONTENT", "HARM_CATEGORY_HARASSMENT", "HARM_CATEGORY_SEXUALLY_EXPLICIT"]>;
|
|
20
|
+
threshold: import("zod").ZodEnum<["BLOCK_LOW_AND_ABOVE", "BLOCK_MEDIUM_AND_ABOVE", "BLOCK_ONLY_HIGH", "BLOCK_NONE"]>;
|
|
21
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
22
|
+
category: import("zod").ZodEnum<["HARM_CATEGORY_UNSPECIFIED", "HARM_CATEGORY_HATE_SPEECH", "HARM_CATEGORY_DANGEROUS_CONTENT", "HARM_CATEGORY_HARASSMENT", "HARM_CATEGORY_SEXUALLY_EXPLICIT"]>;
|
|
23
|
+
threshold: import("zod").ZodEnum<["BLOCK_LOW_AND_ABOVE", "BLOCK_MEDIUM_AND_ABOVE", "BLOCK_ONLY_HIGH", "BLOCK_NONE"]>;
|
|
24
|
+
}, import("zod").ZodTypeAny, "passthrough">>, "many">>;
|
|
25
|
+
vertexRetrieval: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
26
|
+
datastore: import("zod").ZodObject<{
|
|
27
|
+
projectId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
28
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
29
|
+
dataStoreId: import("zod").ZodString;
|
|
30
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
31
|
+
projectId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
32
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
33
|
+
dataStoreId: import("zod").ZodString;
|
|
34
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
35
|
+
projectId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
36
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
37
|
+
dataStoreId: import("zod").ZodString;
|
|
38
|
+
}, import("zod").ZodTypeAny, "passthrough">>;
|
|
39
|
+
disableAttribution: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
40
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
41
|
+
datastore: import("zod").ZodObject<{
|
|
42
|
+
projectId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
43
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
44
|
+
dataStoreId: import("zod").ZodString;
|
|
45
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
46
|
+
projectId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
47
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
48
|
+
dataStoreId: import("zod").ZodString;
|
|
49
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
50
|
+
projectId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
51
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
52
|
+
dataStoreId: import("zod").ZodString;
|
|
53
|
+
}, import("zod").ZodTypeAny, "passthrough">>;
|
|
54
|
+
disableAttribution: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
55
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
56
|
+
datastore: import("zod").ZodObject<{
|
|
57
|
+
projectId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
58
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
59
|
+
dataStoreId: import("zod").ZodString;
|
|
60
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
61
|
+
projectId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
62
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
63
|
+
dataStoreId: import("zod").ZodString;
|
|
64
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
65
|
+
projectId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
66
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
67
|
+
dataStoreId: import("zod").ZodString;
|
|
68
|
+
}, import("zod").ZodTypeAny, "passthrough">>;
|
|
69
|
+
disableAttribution: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
70
|
+
}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
71
|
+
googleSearchRetrieval: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
72
|
+
disableAttribution: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
73
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
74
|
+
disableAttribution: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
75
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
76
|
+
disableAttribution: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
77
|
+
}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
78
|
+
functionCallingConfig: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
79
|
+
mode: import("zod").ZodOptional<import("zod").ZodEnum<["MODE_UNSPECIFIED", "AUTO", "ANY", "NONE"]>>;
|
|
80
|
+
allowedFunctionNames: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
81
|
+
streamFunctionCallArguments: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
82
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
83
|
+
mode: import("zod").ZodOptional<import("zod").ZodEnum<["MODE_UNSPECIFIED", "AUTO", "ANY", "NONE"]>>;
|
|
84
|
+
allowedFunctionNames: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
85
|
+
streamFunctionCallArguments: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
86
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
87
|
+
mode: import("zod").ZodOptional<import("zod").ZodEnum<["MODE_UNSPECIFIED", "AUTO", "ANY", "NONE"]>>;
|
|
88
|
+
allowedFunctionNames: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
89
|
+
streamFunctionCallArguments: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
90
|
+
}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
91
|
+
retrievalConfig: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
92
|
+
latLng: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
93
|
+
latitude: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
94
|
+
longitude: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
95
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
96
|
+
latitude?: number | undefined;
|
|
97
|
+
longitude?: number | undefined;
|
|
98
|
+
}, {
|
|
99
|
+
latitude?: number | undefined;
|
|
100
|
+
longitude?: number | undefined;
|
|
101
|
+
}>>;
|
|
102
|
+
languageCode: import("zod").ZodOptional<import("zod").ZodString>;
|
|
103
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
104
|
+
latLng: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
105
|
+
latitude: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
106
|
+
longitude: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
107
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
108
|
+
latitude?: number | undefined;
|
|
109
|
+
longitude?: number | undefined;
|
|
110
|
+
}, {
|
|
111
|
+
latitude?: number | undefined;
|
|
112
|
+
longitude?: number | undefined;
|
|
113
|
+
}>>;
|
|
114
|
+
languageCode: import("zod").ZodOptional<import("zod").ZodString>;
|
|
115
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
116
|
+
latLng: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
117
|
+
latitude: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
118
|
+
longitude: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
119
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
120
|
+
latitude?: number | undefined;
|
|
121
|
+
longitude?: number | undefined;
|
|
122
|
+
}, {
|
|
123
|
+
latitude?: number | undefined;
|
|
124
|
+
longitude?: number | undefined;
|
|
125
|
+
}>>;
|
|
126
|
+
languageCode: import("zod").ZodOptional<import("zod").ZodString>;
|
|
127
|
+
}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
128
|
+
thinkingConfig: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
129
|
+
includeThoughts: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
130
|
+
thinkingBudget: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
131
|
+
thinkingLevel: import("zod").ZodOptional<import("zod").ZodEnum<["MINIMAL", "LOW", "MEDIUM", "HIGH"]>>;
|
|
132
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
133
|
+
includeThoughts: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
134
|
+
thinkingBudget: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
135
|
+
thinkingLevel: import("zod").ZodOptional<import("zod").ZodEnum<["MINIMAL", "LOW", "MEDIUM", "HIGH"]>>;
|
|
136
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
137
|
+
includeThoughts: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
138
|
+
thinkingBudget: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
139
|
+
thinkingLevel: import("zod").ZodOptional<import("zod").ZodEnum<["MINIMAL", "LOW", "MEDIUM", "HIGH"]>>;
|
|
140
|
+
}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
141
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
142
|
+
version: import("zod").ZodOptional<import("zod").ZodString>;
|
|
143
|
+
maxOutputTokens: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
144
|
+
topK: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
145
|
+
stopSequences: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
146
|
+
} & {
|
|
147
|
+
apiKey: import("zod").ZodOptional<import("zod").ZodString>;
|
|
148
|
+
labels: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
|
|
149
|
+
temperature: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
150
|
+
topP: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
151
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
152
|
+
safetySettings: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
153
|
+
category: import("zod").ZodEnum<["HARM_CATEGORY_UNSPECIFIED", "HARM_CATEGORY_HATE_SPEECH", "HARM_CATEGORY_DANGEROUS_CONTENT", "HARM_CATEGORY_HARASSMENT", "HARM_CATEGORY_SEXUALLY_EXPLICIT"]>;
|
|
154
|
+
threshold: import("zod").ZodEnum<["BLOCK_LOW_AND_ABOVE", "BLOCK_MEDIUM_AND_ABOVE", "BLOCK_ONLY_HIGH", "BLOCK_NONE"]>;
|
|
155
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
156
|
+
category: import("zod").ZodEnum<["HARM_CATEGORY_UNSPECIFIED", "HARM_CATEGORY_HATE_SPEECH", "HARM_CATEGORY_DANGEROUS_CONTENT", "HARM_CATEGORY_HARASSMENT", "HARM_CATEGORY_SEXUALLY_EXPLICIT"]>;
|
|
157
|
+
threshold: import("zod").ZodEnum<["BLOCK_LOW_AND_ABOVE", "BLOCK_MEDIUM_AND_ABOVE", "BLOCK_ONLY_HIGH", "BLOCK_NONE"]>;
|
|
158
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
159
|
+
category: import("zod").ZodEnum<["HARM_CATEGORY_UNSPECIFIED", "HARM_CATEGORY_HATE_SPEECH", "HARM_CATEGORY_DANGEROUS_CONTENT", "HARM_CATEGORY_HARASSMENT", "HARM_CATEGORY_SEXUALLY_EXPLICIT"]>;
|
|
160
|
+
threshold: import("zod").ZodEnum<["BLOCK_LOW_AND_ABOVE", "BLOCK_MEDIUM_AND_ABOVE", "BLOCK_ONLY_HIGH", "BLOCK_NONE"]>;
|
|
161
|
+
}, import("zod").ZodTypeAny, "passthrough">>, "many">>;
|
|
162
|
+
vertexRetrieval: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
163
|
+
datastore: import("zod").ZodObject<{
|
|
164
|
+
projectId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
165
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
166
|
+
dataStoreId: import("zod").ZodString;
|
|
167
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
168
|
+
projectId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
169
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
170
|
+
dataStoreId: import("zod").ZodString;
|
|
171
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
172
|
+
projectId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
173
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
174
|
+
dataStoreId: import("zod").ZodString;
|
|
175
|
+
}, import("zod").ZodTypeAny, "passthrough">>;
|
|
176
|
+
disableAttribution: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
177
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
178
|
+
datastore: import("zod").ZodObject<{
|
|
179
|
+
projectId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
180
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
181
|
+
dataStoreId: import("zod").ZodString;
|
|
182
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
183
|
+
projectId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
184
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
185
|
+
dataStoreId: import("zod").ZodString;
|
|
186
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
187
|
+
projectId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
188
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
189
|
+
dataStoreId: import("zod").ZodString;
|
|
190
|
+
}, import("zod").ZodTypeAny, "passthrough">>;
|
|
191
|
+
disableAttribution: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
192
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
193
|
+
datastore: import("zod").ZodObject<{
|
|
194
|
+
projectId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
195
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
196
|
+
dataStoreId: import("zod").ZodString;
|
|
197
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
198
|
+
projectId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
199
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
200
|
+
dataStoreId: import("zod").ZodString;
|
|
201
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
202
|
+
projectId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
203
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
204
|
+
dataStoreId: import("zod").ZodString;
|
|
205
|
+
}, import("zod").ZodTypeAny, "passthrough">>;
|
|
206
|
+
disableAttribution: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
207
|
+
}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
208
|
+
googleSearchRetrieval: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
209
|
+
disableAttribution: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
210
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
211
|
+
disableAttribution: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
212
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
213
|
+
disableAttribution: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
214
|
+
}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
215
|
+
functionCallingConfig: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
216
|
+
mode: import("zod").ZodOptional<import("zod").ZodEnum<["MODE_UNSPECIFIED", "AUTO", "ANY", "NONE"]>>;
|
|
217
|
+
allowedFunctionNames: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
218
|
+
streamFunctionCallArguments: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
219
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
220
|
+
mode: import("zod").ZodOptional<import("zod").ZodEnum<["MODE_UNSPECIFIED", "AUTO", "ANY", "NONE"]>>;
|
|
221
|
+
allowedFunctionNames: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
222
|
+
streamFunctionCallArguments: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
223
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
224
|
+
mode: import("zod").ZodOptional<import("zod").ZodEnum<["MODE_UNSPECIFIED", "AUTO", "ANY", "NONE"]>>;
|
|
225
|
+
allowedFunctionNames: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
226
|
+
streamFunctionCallArguments: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
227
|
+
}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
228
|
+
retrievalConfig: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
229
|
+
latLng: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
230
|
+
latitude: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
231
|
+
longitude: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
232
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
233
|
+
latitude?: number | undefined;
|
|
234
|
+
longitude?: number | undefined;
|
|
235
|
+
}, {
|
|
236
|
+
latitude?: number | undefined;
|
|
237
|
+
longitude?: number | undefined;
|
|
238
|
+
}>>;
|
|
239
|
+
languageCode: import("zod").ZodOptional<import("zod").ZodString>;
|
|
240
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
241
|
+
latLng: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
242
|
+
latitude: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
243
|
+
longitude: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
244
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
245
|
+
latitude?: number | undefined;
|
|
246
|
+
longitude?: number | undefined;
|
|
247
|
+
}, {
|
|
248
|
+
latitude?: number | undefined;
|
|
249
|
+
longitude?: number | undefined;
|
|
250
|
+
}>>;
|
|
251
|
+
languageCode: import("zod").ZodOptional<import("zod").ZodString>;
|
|
252
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
253
|
+
latLng: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
254
|
+
latitude: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
255
|
+
longitude: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
256
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
257
|
+
latitude?: number | undefined;
|
|
258
|
+
longitude?: number | undefined;
|
|
259
|
+
}, {
|
|
260
|
+
latitude?: number | undefined;
|
|
261
|
+
longitude?: number | undefined;
|
|
262
|
+
}>>;
|
|
263
|
+
languageCode: import("zod").ZodOptional<import("zod").ZodString>;
|
|
264
|
+
}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
265
|
+
thinkingConfig: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
266
|
+
includeThoughts: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
267
|
+
thinkingBudget: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
268
|
+
thinkingLevel: import("zod").ZodOptional<import("zod").ZodEnum<["MINIMAL", "LOW", "MEDIUM", "HIGH"]>>;
|
|
269
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
270
|
+
includeThoughts: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
271
|
+
thinkingBudget: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
272
|
+
thinkingLevel: import("zod").ZodOptional<import("zod").ZodEnum<["MINIMAL", "LOW", "MEDIUM", "HIGH"]>>;
|
|
273
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
274
|
+
includeThoughts: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
275
|
+
thinkingBudget: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
276
|
+
thinkingLevel: import("zod").ZodOptional<import("zod").ZodEnum<["MINIMAL", "LOW", "MEDIUM", "HIGH"]>>;
|
|
277
|
+
}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
278
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
279
|
+
version: import("zod").ZodOptional<import("zod").ZodString>;
|
|
280
|
+
maxOutputTokens: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
281
|
+
topK: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
282
|
+
stopSequences: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
283
|
+
} & {
|
|
284
|
+
apiKey: import("zod").ZodOptional<import("zod").ZodString>;
|
|
285
|
+
labels: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
|
|
286
|
+
temperature: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
287
|
+
topP: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
288
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
289
|
+
safetySettings: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
290
|
+
category: import("zod").ZodEnum<["HARM_CATEGORY_UNSPECIFIED", "HARM_CATEGORY_HATE_SPEECH", "HARM_CATEGORY_DANGEROUS_CONTENT", "HARM_CATEGORY_HARASSMENT", "HARM_CATEGORY_SEXUALLY_EXPLICIT"]>;
|
|
291
|
+
threshold: import("zod").ZodEnum<["BLOCK_LOW_AND_ABOVE", "BLOCK_MEDIUM_AND_ABOVE", "BLOCK_ONLY_HIGH", "BLOCK_NONE"]>;
|
|
292
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
293
|
+
category: import("zod").ZodEnum<["HARM_CATEGORY_UNSPECIFIED", "HARM_CATEGORY_HATE_SPEECH", "HARM_CATEGORY_DANGEROUS_CONTENT", "HARM_CATEGORY_HARASSMENT", "HARM_CATEGORY_SEXUALLY_EXPLICIT"]>;
|
|
294
|
+
threshold: import("zod").ZodEnum<["BLOCK_LOW_AND_ABOVE", "BLOCK_MEDIUM_AND_ABOVE", "BLOCK_ONLY_HIGH", "BLOCK_NONE"]>;
|
|
295
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
296
|
+
category: import("zod").ZodEnum<["HARM_CATEGORY_UNSPECIFIED", "HARM_CATEGORY_HATE_SPEECH", "HARM_CATEGORY_DANGEROUS_CONTENT", "HARM_CATEGORY_HARASSMENT", "HARM_CATEGORY_SEXUALLY_EXPLICIT"]>;
|
|
297
|
+
threshold: import("zod").ZodEnum<["BLOCK_LOW_AND_ABOVE", "BLOCK_MEDIUM_AND_ABOVE", "BLOCK_ONLY_HIGH", "BLOCK_NONE"]>;
|
|
298
|
+
}, import("zod").ZodTypeAny, "passthrough">>, "many">>;
|
|
299
|
+
vertexRetrieval: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
300
|
+
datastore: import("zod").ZodObject<{
|
|
301
|
+
projectId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
302
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
303
|
+
dataStoreId: import("zod").ZodString;
|
|
304
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
305
|
+
projectId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
306
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
307
|
+
dataStoreId: import("zod").ZodString;
|
|
308
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
309
|
+
projectId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
310
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
311
|
+
dataStoreId: import("zod").ZodString;
|
|
312
|
+
}, import("zod").ZodTypeAny, "passthrough">>;
|
|
313
|
+
disableAttribution: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
314
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
315
|
+
datastore: import("zod").ZodObject<{
|
|
316
|
+
projectId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
317
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
318
|
+
dataStoreId: import("zod").ZodString;
|
|
319
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
320
|
+
projectId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
321
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
322
|
+
dataStoreId: import("zod").ZodString;
|
|
323
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
324
|
+
projectId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
325
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
326
|
+
dataStoreId: import("zod").ZodString;
|
|
327
|
+
}, import("zod").ZodTypeAny, "passthrough">>;
|
|
328
|
+
disableAttribution: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
329
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
330
|
+
datastore: import("zod").ZodObject<{
|
|
331
|
+
projectId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
332
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
333
|
+
dataStoreId: import("zod").ZodString;
|
|
334
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
335
|
+
projectId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
336
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
337
|
+
dataStoreId: import("zod").ZodString;
|
|
338
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
339
|
+
projectId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
340
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
341
|
+
dataStoreId: import("zod").ZodString;
|
|
342
|
+
}, import("zod").ZodTypeAny, "passthrough">>;
|
|
343
|
+
disableAttribution: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
344
|
+
}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
345
|
+
googleSearchRetrieval: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
346
|
+
disableAttribution: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
347
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
348
|
+
disableAttribution: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
349
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
350
|
+
disableAttribution: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
351
|
+
}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
352
|
+
functionCallingConfig: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
353
|
+
mode: import("zod").ZodOptional<import("zod").ZodEnum<["MODE_UNSPECIFIED", "AUTO", "ANY", "NONE"]>>;
|
|
354
|
+
allowedFunctionNames: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
355
|
+
streamFunctionCallArguments: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
356
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
357
|
+
mode: import("zod").ZodOptional<import("zod").ZodEnum<["MODE_UNSPECIFIED", "AUTO", "ANY", "NONE"]>>;
|
|
358
|
+
allowedFunctionNames: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
359
|
+
streamFunctionCallArguments: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
360
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
361
|
+
mode: import("zod").ZodOptional<import("zod").ZodEnum<["MODE_UNSPECIFIED", "AUTO", "ANY", "NONE"]>>;
|
|
362
|
+
allowedFunctionNames: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
363
|
+
streamFunctionCallArguments: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
364
|
+
}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
365
|
+
retrievalConfig: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
366
|
+
latLng: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
367
|
+
latitude: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
368
|
+
longitude: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
369
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
370
|
+
latitude?: number | undefined;
|
|
371
|
+
longitude?: number | undefined;
|
|
372
|
+
}, {
|
|
373
|
+
latitude?: number | undefined;
|
|
374
|
+
longitude?: number | undefined;
|
|
375
|
+
}>>;
|
|
376
|
+
languageCode: import("zod").ZodOptional<import("zod").ZodString>;
|
|
377
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
378
|
+
latLng: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
379
|
+
latitude: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
380
|
+
longitude: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
381
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
382
|
+
latitude?: number | undefined;
|
|
383
|
+
longitude?: number | undefined;
|
|
384
|
+
}, {
|
|
385
|
+
latitude?: number | undefined;
|
|
386
|
+
longitude?: number | undefined;
|
|
387
|
+
}>>;
|
|
388
|
+
languageCode: import("zod").ZodOptional<import("zod").ZodString>;
|
|
389
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
390
|
+
latLng: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
391
|
+
latitude: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
392
|
+
longitude: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
393
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
394
|
+
latitude?: number | undefined;
|
|
395
|
+
longitude?: number | undefined;
|
|
396
|
+
}, {
|
|
397
|
+
latitude?: number | undefined;
|
|
398
|
+
longitude?: number | undefined;
|
|
399
|
+
}>>;
|
|
400
|
+
languageCode: import("zod").ZodOptional<import("zod").ZodString>;
|
|
401
|
+
}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
402
|
+
thinkingConfig: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
403
|
+
includeThoughts: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
404
|
+
thinkingBudget: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
405
|
+
thinkingLevel: import("zod").ZodOptional<import("zod").ZodEnum<["MINIMAL", "LOW", "MEDIUM", "HIGH"]>>;
|
|
406
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
407
|
+
includeThoughts: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
408
|
+
thinkingBudget: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
409
|
+
thinkingLevel: import("zod").ZodOptional<import("zod").ZodEnum<["MINIMAL", "LOW", "MEDIUM", "HIGH"]>>;
|
|
410
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
411
|
+
includeThoughts: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
412
|
+
thinkingBudget: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
413
|
+
thinkingLevel: import("zod").ZodOptional<import("zod").ZodEnum<["MINIMAL", "LOW", "MEDIUM", "HIGH"]>>;
|
|
414
|
+
}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
415
|
+
}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
416
|
+
export type GeminiModelReference = typeof geminiModelReference;
|
|
417
|
+
export declare function vertexAiMultiLocation(options: VertexAiMultiLocationOptions & {
|
|
418
|
+
circuitBreakerProvider: CircuitBreakerProvider;
|
|
419
|
+
logger: Logger;
|
|
420
|
+
}): import("genkit/plugin").GenkitPlugin;
|
|
421
|
+
export declare namespace vertexAiMultiLocation {
|
|
422
|
+
var model: <T extends GeminiModelReference>(baseModel: T) => T;
|
|
423
|
+
}
|
|
424
|
+
export {};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { vertexAI } from '@genkit-ai/google-genai';
|
|
2
|
+
import { GenkitError, modelRef } from 'genkit';
|
|
3
|
+
import { genkitPlugin } from 'genkit/plugin';
|
|
4
|
+
import { shuffle, toArray } from '../../utils/array/index.js';
|
|
5
|
+
import { isInstanceOf } from '../../utils/type-guards.js';
|
|
6
|
+
const geminiModelReference = vertexAI.model('gemini-2.5-flash');
|
|
7
|
+
export function vertexAiMultiLocation(options) {
|
|
8
|
+
return genkitPlugin('vertexai-multi-location', (ai) => {
|
|
9
|
+
const modelNames = toArray(options.modelNames);
|
|
10
|
+
for (const modelName of modelNames) {
|
|
11
|
+
ai.defineModel({
|
|
12
|
+
name: `vertexai-multi-location/${modelName}`,
|
|
13
|
+
versions: geminiModelReference.info?.versions,
|
|
14
|
+
supports: geminiModelReference.info?.supports,
|
|
15
|
+
configSchema: geminiModelReference.configSchema,
|
|
16
|
+
label: `${geminiModelReference.info?.label} (Multi-Location Routing)`,
|
|
17
|
+
}, async (request) => {
|
|
18
|
+
const shuffledLocations = shuffle([...options.locations]);
|
|
19
|
+
let lastError;
|
|
20
|
+
for (const location of shuffledLocations) {
|
|
21
|
+
const circuitBreakerKey = `genkit:vertex-ai:location:${location}`;
|
|
22
|
+
const circuitBreaker = options.circuitBreakerProvider.provide(circuitBreakerKey, {
|
|
23
|
+
threshold: 1, // Aggressive for 429
|
|
24
|
+
resetTimeout: options.circuitBreakerConfig?.resetTimeout ?? 30000,
|
|
25
|
+
...options.circuitBreakerConfig,
|
|
26
|
+
});
|
|
27
|
+
const check = await circuitBreaker.check();
|
|
28
|
+
if (!check.allowed) {
|
|
29
|
+
options.logger.warn(`Location ${location} is currently unhealthy. Skipping...`);
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
try {
|
|
33
|
+
const result = await ai.generate({
|
|
34
|
+
model: `vertexai/${modelName}`,
|
|
35
|
+
...request,
|
|
36
|
+
config: {
|
|
37
|
+
...request.config,
|
|
38
|
+
location: location,
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
await circuitBreaker.recordSuccess();
|
|
42
|
+
return result;
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
lastError = error;
|
|
46
|
+
if (!isInstanceOf(error, GenkitError)) {
|
|
47
|
+
throw error;
|
|
48
|
+
}
|
|
49
|
+
const isRetryable = ((error.status == 'RESOURCE_EXHAUSTED') || (error.status == 'UNAVAILABLE') || error.message.includes('quota'));
|
|
50
|
+
if (!isRetryable) {
|
|
51
|
+
throw error;
|
|
52
|
+
}
|
|
53
|
+
options.logger.warn(`Location ${location} responded with ${error.status}. Tripping circuit breaker and trying next location...`);
|
|
54
|
+
await circuitBreaker.recordFailure();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
throw lastError;
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
vertexAiMultiLocation.model = function multiLocationModel(baseModel) {
|
|
63
|
+
return modelRef({
|
|
64
|
+
name: `vertexai-multi-location/${baseModel.name.replace('vertexai/', '')}`,
|
|
65
|
+
configSchema: baseModel.configSchema,
|
|
66
|
+
info: baseModel.info,
|
|
67
|
+
version: baseModel.version,
|
|
68
|
+
config: baseModel.config,
|
|
69
|
+
});
|
|
70
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { genkit, GenkitError, z } from 'genkit';
|
|
2
|
+
import { beforeAll, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
3
|
+
import { CircuitBreakerState } from '../../../circuit-breaker/index.js';
|
|
4
|
+
import { CircuitBreakerProvider } from '../../../circuit-breaker/provider.js';
|
|
5
|
+
import { Logger } from '../../../logger/logger.js';
|
|
6
|
+
import { setupIntegrationTest } from '../../../unit-test/index.js';
|
|
7
|
+
import { vertexAiMultiLocation } from '../multi-region.plugin.js';
|
|
8
|
+
vi.mock('#/utils/array/index.js', async (importOriginal) => {
|
|
9
|
+
const actual = await importOriginal();
|
|
10
|
+
return {
|
|
11
|
+
...actual,
|
|
12
|
+
shuffle: vi.fn((items) => [...items]),
|
|
13
|
+
};
|
|
14
|
+
});
|
|
15
|
+
vi.mock('@genkit-ai/google-genai', () => ({
|
|
16
|
+
vertexAI: {
|
|
17
|
+
model: vi.fn((name) => ({
|
|
18
|
+
name: `vertexai/${name}`,
|
|
19
|
+
info: { label: 'mock' },
|
|
20
|
+
configSchema: z.object({}),
|
|
21
|
+
})),
|
|
22
|
+
},
|
|
23
|
+
googleAI: vi.fn(),
|
|
24
|
+
}));
|
|
25
|
+
describe('Genkit vertexai-multi-location Plugin Tests', () => {
|
|
26
|
+
let ai;
|
|
27
|
+
let cbProvider;
|
|
28
|
+
let logger;
|
|
29
|
+
beforeAll(async () => {
|
|
30
|
+
const { injector } = await setupIntegrationTest({ modules: { circuitBreaker: true } });
|
|
31
|
+
cbProvider = injector.resolve(CircuitBreakerProvider);
|
|
32
|
+
logger = injector.resolve(Logger, 'Test');
|
|
33
|
+
ai = genkit({
|
|
34
|
+
plugins: [
|
|
35
|
+
vertexAiMultiLocation({
|
|
36
|
+
modelNames: 'gemini-2.5-flash',
|
|
37
|
+
locations: ['region-1', 'region-2'],
|
|
38
|
+
circuitBreakerProvider: cbProvider,
|
|
39
|
+
logger,
|
|
40
|
+
circuitBreakerConfig: { resetTimeout: 1000000 },
|
|
41
|
+
}),
|
|
42
|
+
],
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
beforeEach(async () => {
|
|
46
|
+
vi.clearAllMocks();
|
|
47
|
+
const config = { threshold: 1, resetTimeout: 1000000 };
|
|
48
|
+
await cbProvider.provide('genkit:vertex-ai:location:region-1', config).recordSuccess();
|
|
49
|
+
await cbProvider.provide('genkit:vertex-ai:location:region-2', config).recordSuccess();
|
|
50
|
+
await cbProvider.provide('genkit:vertex-ai:location:cb-fail', config).recordSuccess();
|
|
51
|
+
await cbProvider.provide('genkit:vertex-ai:location:cb-success', config).recordSuccess();
|
|
52
|
+
});
|
|
53
|
+
it('should route to a location successfully', async () => {
|
|
54
|
+
// Register a mock for the regional model in the registry
|
|
55
|
+
ai.defineModel({
|
|
56
|
+
name: 'vertexai/gemini-2.5-flash',
|
|
57
|
+
}, async (request) => {
|
|
58
|
+
return {
|
|
59
|
+
message: {
|
|
60
|
+
role: 'model',
|
|
61
|
+
content: [{ text: `hello from ${request.config?.location}` }],
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
});
|
|
65
|
+
const response = await ai.generate({
|
|
66
|
+
model: 'vertexai-multi-location/gemini-2.5-flash',
|
|
67
|
+
prompt: 'test',
|
|
68
|
+
});
|
|
69
|
+
expect(response.text).toContain('hello from');
|
|
70
|
+
});
|
|
71
|
+
it('should failover on 429 error', async () => {
|
|
72
|
+
let callCount = 0;
|
|
73
|
+
// Overwrite the mock model to fail once
|
|
74
|
+
ai.defineModel({
|
|
75
|
+
name: 'vertexai/gemini-2.5-flash',
|
|
76
|
+
}, async (request) => {
|
|
77
|
+
callCount++;
|
|
78
|
+
if (callCount === 1) {
|
|
79
|
+
throw new GenkitError({ status: 'RESOURCE_EXHAUSTED', message: 'Rate limit exceeded' });
|
|
80
|
+
}
|
|
81
|
+
return {
|
|
82
|
+
message: {
|
|
83
|
+
role: 'model',
|
|
84
|
+
content: [{ text: `success from ${request.config?.location}` }],
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
});
|
|
88
|
+
const response = await ai.generate({
|
|
89
|
+
model: 'vertexai-multi-location/gemini-2.5-flash',
|
|
90
|
+
prompt: 'test',
|
|
91
|
+
});
|
|
92
|
+
expect(response.text).toContain('success from');
|
|
93
|
+
expect(callCount).toBe(2);
|
|
94
|
+
});
|
|
95
|
+
it('should trip circuit breaker on 429 and skip location', async () => {
|
|
96
|
+
const locationToFail = 'cb-fail';
|
|
97
|
+
const locationToSuccess = 'cb-success';
|
|
98
|
+
const locations = [locationToFail, locationToSuccess];
|
|
99
|
+
ai = genkit({
|
|
100
|
+
plugins: [
|
|
101
|
+
vertexAiMultiLocation({
|
|
102
|
+
modelNames: 'gemini-2.5-flash',
|
|
103
|
+
locations,
|
|
104
|
+
circuitBreakerProvider: cbProvider,
|
|
105
|
+
logger,
|
|
106
|
+
circuitBreakerConfig: { resetTimeout: 1000000 },
|
|
107
|
+
}),
|
|
108
|
+
],
|
|
109
|
+
});
|
|
110
|
+
ai.defineModel({
|
|
111
|
+
name: 'vertexai/gemini-2.5-flash',
|
|
112
|
+
}, async (request) => {
|
|
113
|
+
if (request.config?.location === locationToFail) {
|
|
114
|
+
throw new GenkitError({ status: 'RESOURCE_EXHAUSTED', message: 'Rate limit' });
|
|
115
|
+
}
|
|
116
|
+
return {
|
|
117
|
+
message: {
|
|
118
|
+
role: 'model',
|
|
119
|
+
content: [{ text: `success from ${request.config?.location}` }],
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
});
|
|
123
|
+
// First call to trip the breaker for 'locationToFail'
|
|
124
|
+
const response1 = await ai.generate({
|
|
125
|
+
model: 'vertexai-multi-location/gemini-2.5-flash',
|
|
126
|
+
prompt: 'test',
|
|
127
|
+
});
|
|
128
|
+
expect(response1.text).toBe('success from cb-success');
|
|
129
|
+
const cb = cbProvider.provide(`genkit:vertex-ai:location:${locationToFail}`, { threshold: 1, resetTimeout: 1000000 });
|
|
130
|
+
const status = await cb.check();
|
|
131
|
+
expect(status.state).toBe(CircuitBreakerState.Open);
|
|
132
|
+
expect(status.allowed).toBe(false);
|
|
133
|
+
// Second call should skip 'locationToFail' automatically
|
|
134
|
+
const response2 = await ai.generate({
|
|
135
|
+
model: 'vertexai-multi-location/gemini-2.5-flash',
|
|
136
|
+
prompt: 'test',
|
|
137
|
+
});
|
|
138
|
+
expect(response2.text).toBe('success from cb-success');
|
|
139
|
+
});
|
|
140
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { CircuitBreakerConfig } from '../../circuit-breaker/circuit-breaker.js';
|
|
2
|
+
export interface VertexAiMultiLocationOptions {
|
|
3
|
+
/** The model name(s) to be virtualized (e.g., 'gemini-2.5-flash'). */
|
|
4
|
+
modelNames: string | string[];
|
|
5
|
+
/** The Google Cloud locations to use for routing. */
|
|
6
|
+
locations: string[];
|
|
7
|
+
/**
|
|
8
|
+
* Optional circuit breaker configuration.
|
|
9
|
+
* By default, a threshold of 1 is used for 429 errors.
|
|
10
|
+
*/
|
|
11
|
+
circuitBreakerConfig?: Partial<CircuitBreakerConfig>;
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { afterAll, beforeAll, beforeEach, describe, expect, test } from 'vitest';
|
|
1
|
+
import { afterAll, beforeAll, beforeEach, describe, expect, test, vi } from 'vitest';
|
|
2
2
|
import { AuthenticationClientService } from '../../authentication/client/index.js';
|
|
3
3
|
import { AuthenticationAncillaryService, AuthenticationService as AuthenticationServerService } from '../../authentication/server/index.js';
|
|
4
4
|
import { HttpClientOptions } from '../../http/client/index.js';
|
|
@@ -17,6 +17,13 @@ describe('AuthenticationApiController Integration', () => {
|
|
|
17
17
|
const schema = 'authentication';
|
|
18
18
|
const tenantId = crypto.randomUUID();
|
|
19
19
|
beforeAll(async () => {
|
|
20
|
+
const storage = new Map();
|
|
21
|
+
globalThis.localStorage = {
|
|
22
|
+
getItem: vi.fn((key) => storage.get(key) ?? null),
|
|
23
|
+
setItem: vi.fn((key, value) => storage.set(key, value)),
|
|
24
|
+
removeItem: vi.fn((key) => storage.delete(key)),
|
|
25
|
+
clear: vi.fn(() => storage.clear()),
|
|
26
|
+
};
|
|
20
27
|
({ injector, database } = await setupIntegrationTest({
|
|
21
28
|
modules: { authentication: true, audit: true, keyValueStore: true, test: true, api: true, webServer: true },
|
|
22
29
|
authenticationAncillaryService: DefaultAuthenticationAncillaryService,
|
|
@@ -36,6 +43,7 @@ describe('AuthenticationApiController Integration', () => {
|
|
|
36
43
|
await injector?.dispose();
|
|
37
44
|
});
|
|
38
45
|
beforeEach(async () => {
|
|
46
|
+
globalThis.localStorage?.clear();
|
|
39
47
|
await clearTenantData(database, schema, ['credentials', 'session', 'user', 'service_account', 'system_account', 'subject'], tenantId);
|
|
40
48
|
});
|
|
41
49
|
test('login should work via API client', async () => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { afterAll, beforeAll, beforeEach, describe, expect, test } from 'vitest';
|
|
1
|
+
import { afterAll, beforeAll, beforeEach, describe, expect, test, vi } from 'vitest';
|
|
2
2
|
import { AuthenticationClientService } from '../../authentication/client/index.js';
|
|
3
3
|
import { AuthenticationService as AuthenticationServerService } from '../../authentication/server/index.js';
|
|
4
4
|
import { HttpClientOptions } from '../../http/client/index.js';
|
|
@@ -17,6 +17,13 @@ describe('AuthenticationClientService Integration', () => {
|
|
|
17
17
|
const schema = 'authentication';
|
|
18
18
|
const tenantId = crypto.randomUUID();
|
|
19
19
|
beforeAll(async () => {
|
|
20
|
+
const storage = new Map();
|
|
21
|
+
globalThis.localStorage = {
|
|
22
|
+
getItem: vi.fn((key) => storage.get(key) ?? null),
|
|
23
|
+
setItem: vi.fn((key, value) => storage.set(key, value)),
|
|
24
|
+
removeItem: vi.fn((key) => storage.delete(key)),
|
|
25
|
+
clear: vi.fn(() => storage.clear()),
|
|
26
|
+
};
|
|
20
27
|
({ injector, database } = await setupIntegrationTest({
|
|
21
28
|
modules: { authentication: true, audit: true, keyValueStore: true, test: true, api: true, webServer: true },
|
|
22
29
|
authenticationAncillaryService: DefaultAuthenticationAncillaryService,
|
|
@@ -36,6 +43,7 @@ describe('AuthenticationClientService Integration', () => {
|
|
|
36
43
|
await injector?.dispose();
|
|
37
44
|
});
|
|
38
45
|
beforeEach(async () => {
|
|
46
|
+
globalThis.localStorage?.clear();
|
|
39
47
|
await clearTenantData(database, schema, ['credentials', 'session', 'user', 'service_account', 'system_account', 'subject'], tenantId);
|
|
40
48
|
});
|
|
41
49
|
test('login and logout should work', async () => {
|
|
@@ -4,10 +4,10 @@ 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 { formatError } from '../../errors/index.js';
|
|
7
8
|
import { Singleton } from '../../injector/decorators.js';
|
|
8
9
|
import { supportsColoredStdout } from '../../supports.js';
|
|
9
10
|
import { enumValueName } from '../../utils/enum.js';
|
|
10
|
-
import { formatError } from '../../errors/index.js';
|
|
11
11
|
import { objectKeys } from '../../utils/object/object.js';
|
|
12
12
|
import { isNotNullOrUndefined } from '../../utils/type-guards.js';
|
|
13
13
|
import { LogFormatter } from '../formatter.js';
|
package/orm/sqls/sqls.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* simplifying common SQL operations like generating UUIDs, working with intervals,
|
|
5
5
|
* and aggregating data.
|
|
6
6
|
*/
|
|
7
|
-
import { Column, type AnyColumn, type
|
|
7
|
+
import { Column, SQL, type AnyColumn, type SQLChunk, type SQLWrapper } from 'drizzle-orm';
|
|
8
8
|
import type { GetSelectTableSelection, SelectResultField, TableLike } from 'drizzle-orm/query-builders/select.types';
|
|
9
9
|
import type { EnumerationObject, EnumerationValue, Record } from '../../types/types.js';
|
|
10
10
|
import { type PgEnumFromEnumeration } from '../enums.js';
|
|
@@ -155,12 +155,12 @@ export declare namespace jsonAgg {
|
|
|
155
155
|
export declare function coalesce<T extends (Column | SQL | SQL.Aliased)[]>(...columns: T): SQL<SelectResultField<T>[number]>;
|
|
156
156
|
/**
|
|
157
157
|
* Creates a PostgreSQL `to_jsonb` function call.
|
|
158
|
-
* Converts the input
|
|
159
|
-
* @template T - The
|
|
160
|
-
* @param
|
|
158
|
+
* Converts the input SQL expression to a JSONB value.
|
|
159
|
+
* @template T - The value type.
|
|
160
|
+
* @param value - The value to convert.
|
|
161
161
|
* @returns A Drizzle SQL object representing the value as JSONB.
|
|
162
162
|
*/
|
|
163
|
-
export declare function toJsonb<T extends
|
|
163
|
+
export declare function toJsonb<T extends SQLWrapper>(value: T): SQL<SelectResultField<T>>;
|
|
164
164
|
/**
|
|
165
165
|
* Creates a PostgreSQL `num_nulls` function call.
|
|
166
166
|
* Counts the number of null arguments.
|
package/orm/sqls/sqls.js
CHANGED
|
@@ -4,13 +4,27 @@
|
|
|
4
4
|
* simplifying common SQL operations like generating UUIDs, working with intervals,
|
|
5
5
|
* and aggregating data.
|
|
6
6
|
*/
|
|
7
|
-
import { and, Column, eq, isSQLWrapper, sql, isNotNull as sqlIsNotNull, isNull as sqlIsNull, Table } from 'drizzle-orm';
|
|
7
|
+
import { and, Column, eq, isSQLWrapper, sql, SQL, isNotNull as sqlIsNotNull, isNull as sqlIsNull, Table } from 'drizzle-orm';
|
|
8
8
|
import { match, P } from 'ts-pattern';
|
|
9
9
|
import { distinct, toArray } from '../../utils/array/array.js';
|
|
10
10
|
import { objectEntries, objectValues } from '../../utils/object/object.js';
|
|
11
11
|
import { assertDefined, isArray, isBoolean, isDefined, isInstanceOf, isNotNull, isNull, isNullOrUndefined, isNumber, isObject, isString } from '../../utils/type-guards.js';
|
|
12
12
|
import { getEnumName } from '../enums.js';
|
|
13
13
|
import { caseWhen } from './case-when.js';
|
|
14
|
+
const isJsonbSymbol = Symbol('isJsonb');
|
|
15
|
+
function markAsJsonb(value) {
|
|
16
|
+
value[isJsonbSymbol] = true;
|
|
17
|
+
return value;
|
|
18
|
+
}
|
|
19
|
+
function isJsonb(value) {
|
|
20
|
+
if (value?.[isJsonbSymbol] == true) {
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
if (isInstanceOf(value, Column) && (value.getSQLType() === 'jsonb')) {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
14
28
|
export const simpleJsonKeyPattern = /^[a-zA-Z0-9_-]+$/u;
|
|
15
29
|
/** Drizzle SQL helper for getting the current transaction's timestamp. Returns a Date object. */
|
|
16
30
|
export const TRANSACTION_TIMESTAMP = sql `transaction_timestamp()`;
|
|
@@ -171,13 +185,16 @@ export function coalesce(...columns) {
|
|
|
171
185
|
}
|
|
172
186
|
/**
|
|
173
187
|
* Creates a PostgreSQL `to_jsonb` function call.
|
|
174
|
-
* Converts the input
|
|
175
|
-
* @template T - The
|
|
176
|
-
* @param
|
|
188
|
+
* Converts the input SQL expression to a JSONB value.
|
|
189
|
+
* @template T - The value type.
|
|
190
|
+
* @param value - The value to convert.
|
|
177
191
|
* @returns A Drizzle SQL object representing the value as JSONB.
|
|
178
192
|
*/
|
|
179
|
-
export function toJsonb(
|
|
180
|
-
|
|
193
|
+
export function toJsonb(value) {
|
|
194
|
+
if (isJsonb(value)) {
|
|
195
|
+
return value.getSQL();
|
|
196
|
+
}
|
|
197
|
+
return markAsJsonb(sql `to_jsonb(${value})`);
|
|
181
198
|
}
|
|
182
199
|
/**
|
|
183
200
|
* Creates a PostgreSQL `num_nulls` function call.
|
|
@@ -395,9 +412,9 @@ export function jsonbBuildObject(properties) {
|
|
|
395
412
|
}
|
|
396
413
|
}
|
|
397
414
|
if (chunks.length == 0) {
|
|
398
|
-
return sql `'{}'::jsonb
|
|
415
|
+
return markAsJsonb(sql `'{}'::jsonb`);
|
|
399
416
|
}
|
|
400
|
-
return sql `jsonb_build_object(${sql.join(chunks, sql `, `)})
|
|
417
|
+
return markAsJsonb(sql `jsonb_build_object(${sql.join(chunks, sql `, `)})`);
|
|
401
418
|
}
|
|
402
419
|
/**
|
|
403
420
|
* A recursive utility to build PostgreSQL JSONB from TS structures.
|
|
@@ -405,20 +422,20 @@ export function jsonbBuildObject(properties) {
|
|
|
405
422
|
*/
|
|
406
423
|
export function buildJsonb(value) {
|
|
407
424
|
if (isSQLWrapper(value)) {
|
|
408
|
-
return
|
|
425
|
+
return toJsonb(value);
|
|
409
426
|
}
|
|
410
427
|
if (isNullOrUndefined(value)) {
|
|
411
|
-
return sql `'null'::jsonb
|
|
428
|
+
return markAsJsonb(sql `'null'::jsonb`);
|
|
412
429
|
}
|
|
413
430
|
if (isArray(value)) {
|
|
414
431
|
if (value.length == 0) {
|
|
415
|
-
return sql `'[]'::jsonb
|
|
432
|
+
return markAsJsonb(sql `'[]'::jsonb`);
|
|
416
433
|
}
|
|
417
434
|
const elements = value.map((inner) => buildJsonb(inner));
|
|
418
|
-
return sql `jsonb_build_array(${sql.join(elements, sql `, `)})
|
|
435
|
+
return markAsJsonb(sql `jsonb_build_array(${sql.join(elements, sql `, `)})`);
|
|
419
436
|
}
|
|
420
437
|
if (isObject(value)) {
|
|
421
438
|
return jsonbBuildObject(value);
|
|
422
439
|
}
|
|
423
|
-
return sql `${JSON.stringify(value)}::jsonb
|
|
440
|
+
return markAsJsonb(sql `${JSON.stringify(value)}::jsonb`);
|
|
424
441
|
}
|
|
@@ -68,7 +68,7 @@ describe('ORM Query Converter Complex', () => {
|
|
|
68
68
|
const condition = convertQuery(q, table, colMap);
|
|
69
69
|
const sqlStr = dialect.sqlToQuery(condition).sql;
|
|
70
70
|
// Tokenizer is supported via JSON object syntax
|
|
71
|
-
expect(sqlStr).toContain('"test"."complex_items"."name" @@@ jsonb_build_object(\'match\', jsonb_build_object(\'value\', $1, \'tokenizer\', jsonb_build_object(\'type\', $2, \'min_gram\', $3, \'max_gram\', $4)))::pdb.query');
|
|
71
|
+
expect(sqlStr).toContain('"test"."complex_items"."name" @@@ jsonb_build_object(\'match\', jsonb_build_object(\'value\', $1::jsonb, \'tokenizer\', jsonb_build_object(\'type\', $2::jsonb, \'min_gram\', $3::jsonb, \'max_gram\', $4::jsonb)))::pdb.query');
|
|
72
72
|
});
|
|
73
73
|
test('should handle ParadeDB $parade range', () => {
|
|
74
74
|
const q = {
|
|
@@ -84,7 +84,7 @@ describe('ORM Query Converter Complex', () => {
|
|
|
84
84
|
const condition = convertQuery(q, table, colMap);
|
|
85
85
|
const sqlStr = dialect.sqlToQuery(condition).sql;
|
|
86
86
|
// This should fall back to convertParadeComparisonQuery with recursive jsonb build
|
|
87
|
-
expect(sqlStr).toContain('"test"."complex_items"."value" @@@ jsonb_build_object(\'range\', jsonb_build_object(\'lower_bound\', jsonb_build_object(\'included\', $1), \'upper_bound\', jsonb_build_object(\'excluded\', $2)))::pdb.query');
|
|
87
|
+
expect(sqlStr).toContain('"test"."complex_items"."value" @@@ jsonb_build_object(\'range\', jsonb_build_object(\'lower_bound\', jsonb_build_object(\'included\', $1::jsonb), \'upper_bound\', jsonb_build_object(\'excluded\', $2::jsonb)))::pdb.query');
|
|
88
88
|
});
|
|
89
89
|
test('should handle ParadeDB $parade phrasePrefix', () => {
|
|
90
90
|
const q = {
|
|
@@ -96,7 +96,7 @@ describe('ORM Query Converter Complex', () => {
|
|
|
96
96
|
};
|
|
97
97
|
const condition = convertQuery(q, table, colMap);
|
|
98
98
|
const sqlStr = dialect.sqlToQuery(condition).sql;
|
|
99
|
-
expect(sqlStr).toContain('"test"."complex_items"."name" @@@ jsonb_build_object(\'phrase_prefix\', jsonb_build_object(\'phrases\', jsonb_build_array($1, $2), \'max_expansions\', $3))::pdb.query');
|
|
99
|
+
expect(sqlStr).toContain('"test"."complex_items"."name" @@@ jsonb_build_object(\'phrase_prefix\', jsonb_build_object(\'phrases\', jsonb_build_array($1::jsonb, $2::jsonb), \'max_expansions\', $3::jsonb))::pdb.query');
|
|
100
100
|
});
|
|
101
101
|
test('should handle ParadeDB $parade regexPhrase', () => {
|
|
102
102
|
const q = {
|
|
@@ -108,7 +108,7 @@ describe('ORM Query Converter Complex', () => {
|
|
|
108
108
|
};
|
|
109
109
|
const condition = convertQuery(q, table, colMap);
|
|
110
110
|
const sqlStr = dialect.sqlToQuery(condition).sql;
|
|
111
|
-
expect(sqlStr).toContain('"test"."complex_items"."name" @@@ jsonb_build_object(\'regex_phrase\', jsonb_build_object(\'regexes\', jsonb_build_array($1, $2), \'slop\', $3))::pdb.query');
|
|
111
|
+
expect(sqlStr).toContain('"test"."complex_items"."name" @@@ jsonb_build_object(\'regex_phrase\', jsonb_build_object(\'regexes\', jsonb_build_array($1::jsonb, $2::jsonb), \'slop\', $3::jsonb))::pdb.query');
|
|
112
112
|
});
|
|
113
113
|
test('should handle ParadeDB top-level moreLikeThis', () => {
|
|
114
114
|
const q = {
|
|
@@ -121,6 +121,6 @@ describe('ORM Query Converter Complex', () => {
|
|
|
121
121
|
};
|
|
122
122
|
const condition = convertQuery(q, table, colMap);
|
|
123
123
|
const sqlStr = dialect.sqlToQuery(condition).sql;
|
|
124
|
-
expect(sqlStr).toContain('"test"."complex_items"."id" @@@ jsonb_build_object(\'more_like_this\', jsonb_build_object(\'key_value\', $1, \'fields\', ARRAY[$2, $3]))::pdb.query');
|
|
124
|
+
expect(sqlStr).toContain('"test"."complex_items"."id" @@@ jsonb_build_object(\'more_like_this\', jsonb_build_object(\'key_value\', $1::jsonb, \'fields\', to_jsonb(ARRAY[$2, $3])))::pdb.query');
|
|
125
125
|
});
|
|
126
126
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tstdl/base",
|
|
3
|
-
"version": "0.93.
|
|
3
|
+
"version": "0.93.111",
|
|
4
4
|
"author": "Patrick Hein",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -153,7 +153,7 @@
|
|
|
153
153
|
"peerDependencies": {
|
|
154
154
|
"@genkit-ai/google-genai": "^1.28",
|
|
155
155
|
"@google-cloud/storage": "^7.18",
|
|
156
|
-
"@google/genai": "^1.
|
|
156
|
+
"@google/genai": "^1.40",
|
|
157
157
|
"@toon-format/toon": "^2.1.0",
|
|
158
158
|
"@tstdl/angular": "^0.93",
|
|
159
159
|
"@zxcvbn-ts/core": "^3.0",
|
package/task-queue/task-queue.js
CHANGED
|
@@ -79,7 +79,7 @@ export const defaultQueueConfig = {
|
|
|
79
79
|
};
|
|
80
80
|
export class TaskQueue extends Transactional {
|
|
81
81
|
config = this.transactionalContextData ?? (() => { const arg = injectArgument(this); return isString(arg) ? { namespace: arg } : arg; })();
|
|
82
|
-
logger = inject(Logger,
|
|
82
|
+
logger = inject(Logger, TaskQueue.name).with({ namespace: this.config.namespace });
|
|
83
83
|
batch() {
|
|
84
84
|
return new TaskQueueEnqueueBatch(this);
|
|
85
85
|
}
|
package/test1.js
CHANGED
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
import './polyfills.js';
|
|
2
|
-
import {
|
|
3
|
-
import { configureAiService } from './ai/module.js';
|
|
2
|
+
import { configureGenkit, injectGenkit, injectMultiLocationModel } from './ai/genkit/module.js';
|
|
4
3
|
import { Application, provideInitializer, provideModule, provideSignalHandler } from './application/index.js';
|
|
5
|
-
import {
|
|
6
|
-
import { configureAuthenticationServer } from './authentication/server/module.js';
|
|
4
|
+
import { configurePostgresCircuitBreaker, migratePostgresCircuitBreaker } from './circuit-breaker/postgres/module.js';
|
|
7
5
|
import { inject, Injector, runInInjectionContext } from './injector/index.js';
|
|
8
|
-
import { configurePostgresKeyValueStore, migratePostgresKeyValueStoreSchema } from './key-value-store/postgres/module.js';
|
|
9
|
-
import { configurePostgresLock, migratePostgresLockSchema } from './lock/postgres/index.js';
|
|
10
6
|
import { PrettyPrintLogFormatter, provideConsoleLogTransport } from './logger/index.js';
|
|
11
|
-
import { configureOrm
|
|
12
|
-
import { configurePostgresTaskQueue, migratePostgresTaskQueueSchema } from './task-queue/postgres/
|
|
13
|
-
import {
|
|
14
|
-
import { Test, testData } from './test/test.model.js';
|
|
15
|
-
import { timedBenchmarkAsync } from './utils/benchmark.js';
|
|
7
|
+
import { configureOrm } from './orm/server/index.js';
|
|
8
|
+
import { configurePostgresTaskQueue, migratePostgresTaskQueueSchema } from './task-queue/postgres/module.js';
|
|
9
|
+
import { createArray } from './utils/array/array.js';
|
|
16
10
|
import * as configParser from './utils/config-parser.js';
|
|
17
11
|
import { string } from './utils/config-parser.js';
|
|
12
|
+
import { assert } from './utils/type-guards.js';
|
|
18
13
|
const config = {
|
|
19
14
|
database: {
|
|
20
15
|
host: configParser.string('DATABASE_HOST', '127.0.0.1'),
|
|
@@ -24,74 +19,67 @@ const config = {
|
|
|
24
19
|
database: configParser.string('DATABASE_NAME', 'tstdl'),
|
|
25
20
|
},
|
|
26
21
|
ai: {
|
|
27
|
-
apiKey: string('AI_API_KEY', undefined),
|
|
28
22
|
keyFile: string('AI_API_KEY_FILE', undefined),
|
|
29
23
|
vertex: {
|
|
30
24
|
project: string('AI_VERTEX_PROJECT', undefined),
|
|
31
25
|
location: string('AI_VERTEX_LOCATION', undefined),
|
|
26
|
+
bucket: string('AI_VERTEX_BUCKET', undefined),
|
|
32
27
|
},
|
|
33
28
|
},
|
|
34
29
|
};
|
|
35
30
|
async function bootstrap() {
|
|
36
31
|
const injector = inject(Injector);
|
|
37
|
-
|
|
32
|
+
assert(config.ai.vertex.location?.startsWith('europe') == true, 'AI vertex location must be in europe for data protection reasons');
|
|
33
|
+
configureGenkit({
|
|
38
34
|
vertex: {
|
|
39
|
-
|
|
35
|
+
projectId: '922353391551', // insolytics-application
|
|
40
36
|
location: 'europe-west4', // netherlands
|
|
37
|
+
// keyFile: '/home/patrick/.environments/insolytix-application-service-key.json',
|
|
38
|
+
},
|
|
39
|
+
multiLocationVertex: {
|
|
40
|
+
modelNames: ['gemini-2.5-flash'],
|
|
41
|
+
locations: [
|
|
42
|
+
'europe-west4',
|
|
43
|
+
'europe-west9',
|
|
44
|
+
// 'europe-west3',
|
|
45
|
+
// 'europe-west1',
|
|
46
|
+
// 'europe-southwest1',
|
|
47
|
+
// 'europe-west8',
|
|
48
|
+
// 'europe-north1',
|
|
49
|
+
// 'europe-central2',
|
|
50
|
+
// 'europe-west2', // UK - not EU
|
|
51
|
+
// 'europe-west6', // Switzerland - not EU
|
|
52
|
+
],
|
|
41
53
|
},
|
|
42
|
-
keyFile: '/home/patrick/.secret-files/insolytic-application-service-key.json',
|
|
43
54
|
});
|
|
44
|
-
/*
|
|
45
55
|
configureOrm({
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
configureAuthenticationServer({
|
|
59
|
-
serviceOptions: {
|
|
60
|
-
secret: '6fze56uz5e6ufrtzufrtu',
|
|
61
|
-
},
|
|
56
|
+
repositoryConfig: {
|
|
57
|
+
schema: 'test',
|
|
58
|
+
},
|
|
59
|
+
connection: {
|
|
60
|
+
host: config.database.host,
|
|
61
|
+
port: config.database.port,
|
|
62
|
+
user: config.database.user,
|
|
63
|
+
password: config.database.pass,
|
|
64
|
+
database: config.database.database,
|
|
65
|
+
},
|
|
62
66
|
});
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
await runInInjectionContext(injector, migratePostgresKeyValueStoreSchema);
|
|
69
|
-
await runInInjectionContext(injector, migratePostgresLockSchema);
|
|
70
|
-
await runInInjectionContext(injector, migratePostgresQueueSchema);
|
|
71
|
-
await runInInjectionContext(injector, migrateAuditSchema);
|
|
72
|
-
await runInInjectionContext(injector, migrateTestSchema);
|
|
73
|
-
*/
|
|
67
|
+
configurePostgresCircuitBreaker();
|
|
68
|
+
configurePostgresTaskQueue();
|
|
69
|
+
await runInInjectionContext(injector, migratePostgresCircuitBreaker);
|
|
70
|
+
await runInInjectionContext(injector, migratePostgresTaskQueueSchema);
|
|
74
71
|
}
|
|
75
72
|
async function main(_cancellationSignal) {
|
|
76
|
-
const
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
parts: [
|
|
86
|
-
{ text: 'Count from 1 to 1000. List *every* number.' },
|
|
87
|
-
],
|
|
88
|
-
}],
|
|
89
|
-
});
|
|
90
|
-
for await (const { text, usage } of aiStream) {
|
|
91
|
-
console.log({ text, usage });
|
|
73
|
+
const genkit = injectGenkit();
|
|
74
|
+
const model = injectMultiLocationModel('gemini-2.5-flash');
|
|
75
|
+
const promises = createArray(1000, async () => await genkit.generate({
|
|
76
|
+
model,
|
|
77
|
+
prompt: 'Hello, world!',
|
|
78
|
+
}));
|
|
79
|
+
const responses = await Promise.all(promises);
|
|
80
|
+
for (const response of responses) {
|
|
81
|
+
console.log(response.text);
|
|
92
82
|
}
|
|
93
|
-
if (1 + 1 == 2)
|
|
94
|
-
process.exit(0);
|
|
95
83
|
}
|
|
96
84
|
Application.run('Test', [
|
|
97
85
|
provideInitializer(bootstrap),
|
package/typst/render.d.ts
CHANGED
|
@@ -20,4 +20,4 @@ export type TypstRenderOptions = {
|
|
|
20
20
|
* @param source
|
|
21
21
|
* @param options
|
|
22
22
|
*/
|
|
23
|
-
export declare function renderTypst(source: string, options?: TypstRenderOptions): Promise<Uint8Array
|
|
23
|
+
export declare function renderTypst(source: string, options?: TypstRenderOptions): Promise<Uint8Array<ArrayBuffer>>;
|