@tstdl/base 0.93.167 → 0.93.170
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/module.d.ts +1 -2
- package/ai/genkit/multi-region.plugin.d.ts +1 -415
- package/ai/genkit/multi-region.plugin.js +0 -2
- package/ai/genkit/types.d.ts +416 -1
- package/ai/genkit/types.js +2 -0
- package/ai/prompts/prompt-builder.d.ts +6 -2
- package/ai/prompts/prompt-builder.js +44 -5
- package/ai/prompts/steering.d.ts +2 -1
- package/ai/prompts/steering.js +3 -0
- package/document-management/server/services/document-management-ai.prompts.d.ts +27 -0
- package/document-management/server/services/document-management-ai.prompts.js +158 -0
- package/document-management/server/services/document-management-ai.service.d.ts +4 -17
- package/document-management/server/services/document-management-ai.service.js +49 -138
- package/document-management/server/validators/ai-validation-executor.d.ts +2 -0
- package/document-management/server/validators/ai-validation-executor.js +37 -28
- package/package.json +4 -11
package/ai/genkit/types.d.ts
CHANGED
|
@@ -1,5 +1,419 @@
|
|
|
1
|
+
import type { OmitIndexSignature, SimplifyDeep } from 'type-fest';
|
|
1
2
|
import type { CircuitBreakerConfig } from '../../circuit-breaker/circuit-breaker.js';
|
|
2
|
-
|
|
3
|
+
declare const geminiModelReference: import("genkit").ModelReference<import("zod").ZodObject<{
|
|
4
|
+
version: import("zod").ZodOptional<import("zod").ZodString>;
|
|
5
|
+
maxOutputTokens: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
6
|
+
topK: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
7
|
+
stopSequences: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
8
|
+
} & {
|
|
9
|
+
apiKey: import("zod").ZodOptional<import("zod").ZodString>;
|
|
10
|
+
labels: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
|
|
11
|
+
temperature: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
12
|
+
topP: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
13
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
14
|
+
safetySettings: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
15
|
+
category: import("zod").ZodEnum<["HARM_CATEGORY_UNSPECIFIED", "HARM_CATEGORY_HATE_SPEECH", "HARM_CATEGORY_DANGEROUS_CONTENT", "HARM_CATEGORY_HARASSMENT", "HARM_CATEGORY_SEXUALLY_EXPLICIT"]>;
|
|
16
|
+
threshold: import("zod").ZodEnum<["BLOCK_LOW_AND_ABOVE", "BLOCK_MEDIUM_AND_ABOVE", "BLOCK_ONLY_HIGH", "BLOCK_NONE"]>;
|
|
17
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
18
|
+
category: import("zod").ZodEnum<["HARM_CATEGORY_UNSPECIFIED", "HARM_CATEGORY_HATE_SPEECH", "HARM_CATEGORY_DANGEROUS_CONTENT", "HARM_CATEGORY_HARASSMENT", "HARM_CATEGORY_SEXUALLY_EXPLICIT"]>;
|
|
19
|
+
threshold: import("zod").ZodEnum<["BLOCK_LOW_AND_ABOVE", "BLOCK_MEDIUM_AND_ABOVE", "BLOCK_ONLY_HIGH", "BLOCK_NONE"]>;
|
|
20
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
21
|
+
category: import("zod").ZodEnum<["HARM_CATEGORY_UNSPECIFIED", "HARM_CATEGORY_HATE_SPEECH", "HARM_CATEGORY_DANGEROUS_CONTENT", "HARM_CATEGORY_HARASSMENT", "HARM_CATEGORY_SEXUALLY_EXPLICIT"]>;
|
|
22
|
+
threshold: import("zod").ZodEnum<["BLOCK_LOW_AND_ABOVE", "BLOCK_MEDIUM_AND_ABOVE", "BLOCK_ONLY_HIGH", "BLOCK_NONE"]>;
|
|
23
|
+
}, import("zod").ZodTypeAny, "passthrough">>, "many">>;
|
|
24
|
+
vertexRetrieval: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
25
|
+
datastore: import("zod").ZodObject<{
|
|
26
|
+
projectId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
27
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
28
|
+
dataStoreId: import("zod").ZodString;
|
|
29
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
30
|
+
projectId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
31
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
32
|
+
dataStoreId: import("zod").ZodString;
|
|
33
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
34
|
+
projectId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
35
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
36
|
+
dataStoreId: import("zod").ZodString;
|
|
37
|
+
}, import("zod").ZodTypeAny, "passthrough">>;
|
|
38
|
+
disableAttribution: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
39
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
40
|
+
datastore: import("zod").ZodObject<{
|
|
41
|
+
projectId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
42
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
43
|
+
dataStoreId: import("zod").ZodString;
|
|
44
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
45
|
+
projectId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
46
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
47
|
+
dataStoreId: import("zod").ZodString;
|
|
48
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
49
|
+
projectId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
50
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
51
|
+
dataStoreId: import("zod").ZodString;
|
|
52
|
+
}, import("zod").ZodTypeAny, "passthrough">>;
|
|
53
|
+
disableAttribution: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
54
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
55
|
+
datastore: import("zod").ZodObject<{
|
|
56
|
+
projectId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
57
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
58
|
+
dataStoreId: import("zod").ZodString;
|
|
59
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
60
|
+
projectId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
61
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
62
|
+
dataStoreId: import("zod").ZodString;
|
|
63
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
64
|
+
projectId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
65
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
66
|
+
dataStoreId: import("zod").ZodString;
|
|
67
|
+
}, import("zod").ZodTypeAny, "passthrough">>;
|
|
68
|
+
disableAttribution: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
69
|
+
}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
70
|
+
googleSearchRetrieval: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
71
|
+
disableAttribution: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
72
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
73
|
+
disableAttribution: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
74
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
75
|
+
disableAttribution: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
76
|
+
}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
77
|
+
functionCallingConfig: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
78
|
+
mode: import("zod").ZodOptional<import("zod").ZodEnum<["MODE_UNSPECIFIED", "AUTO", "ANY", "NONE"]>>;
|
|
79
|
+
allowedFunctionNames: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
80
|
+
streamFunctionCallArguments: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
81
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
82
|
+
mode: import("zod").ZodOptional<import("zod").ZodEnum<["MODE_UNSPECIFIED", "AUTO", "ANY", "NONE"]>>;
|
|
83
|
+
allowedFunctionNames: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
84
|
+
streamFunctionCallArguments: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
85
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
86
|
+
mode: import("zod").ZodOptional<import("zod").ZodEnum<["MODE_UNSPECIFIED", "AUTO", "ANY", "NONE"]>>;
|
|
87
|
+
allowedFunctionNames: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
88
|
+
streamFunctionCallArguments: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
89
|
+
}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
90
|
+
retrievalConfig: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
91
|
+
latLng: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
92
|
+
latitude: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
93
|
+
longitude: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
94
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
95
|
+
latitude?: number | undefined;
|
|
96
|
+
longitude?: number | undefined;
|
|
97
|
+
}, {
|
|
98
|
+
latitude?: number | undefined;
|
|
99
|
+
longitude?: number | undefined;
|
|
100
|
+
}>>;
|
|
101
|
+
languageCode: import("zod").ZodOptional<import("zod").ZodString>;
|
|
102
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
103
|
+
latLng: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
104
|
+
latitude: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
105
|
+
longitude: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
106
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
107
|
+
latitude?: number | undefined;
|
|
108
|
+
longitude?: number | undefined;
|
|
109
|
+
}, {
|
|
110
|
+
latitude?: number | undefined;
|
|
111
|
+
longitude?: number | undefined;
|
|
112
|
+
}>>;
|
|
113
|
+
languageCode: import("zod").ZodOptional<import("zod").ZodString>;
|
|
114
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
115
|
+
latLng: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
116
|
+
latitude: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
117
|
+
longitude: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
118
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
119
|
+
latitude?: number | undefined;
|
|
120
|
+
longitude?: number | undefined;
|
|
121
|
+
}, {
|
|
122
|
+
latitude?: number | undefined;
|
|
123
|
+
longitude?: number | undefined;
|
|
124
|
+
}>>;
|
|
125
|
+
languageCode: import("zod").ZodOptional<import("zod").ZodString>;
|
|
126
|
+
}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
127
|
+
thinkingConfig: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
128
|
+
includeThoughts: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
129
|
+
thinkingBudget: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
130
|
+
thinkingLevel: import("zod").ZodOptional<import("zod").ZodEnum<["MINIMAL", "LOW", "MEDIUM", "HIGH"]>>;
|
|
131
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
132
|
+
includeThoughts: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
133
|
+
thinkingBudget: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
134
|
+
thinkingLevel: import("zod").ZodOptional<import("zod").ZodEnum<["MINIMAL", "LOW", "MEDIUM", "HIGH"]>>;
|
|
135
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
136
|
+
includeThoughts: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
137
|
+
thinkingBudget: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
138
|
+
thinkingLevel: import("zod").ZodOptional<import("zod").ZodEnum<["MINIMAL", "LOW", "MEDIUM", "HIGH"]>>;
|
|
139
|
+
}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
140
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
141
|
+
version: import("zod").ZodOptional<import("zod").ZodString>;
|
|
142
|
+
maxOutputTokens: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
143
|
+
topK: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
144
|
+
stopSequences: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
145
|
+
} & {
|
|
146
|
+
apiKey: import("zod").ZodOptional<import("zod").ZodString>;
|
|
147
|
+
labels: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
|
|
148
|
+
temperature: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
149
|
+
topP: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
150
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
151
|
+
safetySettings: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
152
|
+
category: import("zod").ZodEnum<["HARM_CATEGORY_UNSPECIFIED", "HARM_CATEGORY_HATE_SPEECH", "HARM_CATEGORY_DANGEROUS_CONTENT", "HARM_CATEGORY_HARASSMENT", "HARM_CATEGORY_SEXUALLY_EXPLICIT"]>;
|
|
153
|
+
threshold: import("zod").ZodEnum<["BLOCK_LOW_AND_ABOVE", "BLOCK_MEDIUM_AND_ABOVE", "BLOCK_ONLY_HIGH", "BLOCK_NONE"]>;
|
|
154
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
155
|
+
category: import("zod").ZodEnum<["HARM_CATEGORY_UNSPECIFIED", "HARM_CATEGORY_HATE_SPEECH", "HARM_CATEGORY_DANGEROUS_CONTENT", "HARM_CATEGORY_HARASSMENT", "HARM_CATEGORY_SEXUALLY_EXPLICIT"]>;
|
|
156
|
+
threshold: import("zod").ZodEnum<["BLOCK_LOW_AND_ABOVE", "BLOCK_MEDIUM_AND_ABOVE", "BLOCK_ONLY_HIGH", "BLOCK_NONE"]>;
|
|
157
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
158
|
+
category: import("zod").ZodEnum<["HARM_CATEGORY_UNSPECIFIED", "HARM_CATEGORY_HATE_SPEECH", "HARM_CATEGORY_DANGEROUS_CONTENT", "HARM_CATEGORY_HARASSMENT", "HARM_CATEGORY_SEXUALLY_EXPLICIT"]>;
|
|
159
|
+
threshold: import("zod").ZodEnum<["BLOCK_LOW_AND_ABOVE", "BLOCK_MEDIUM_AND_ABOVE", "BLOCK_ONLY_HIGH", "BLOCK_NONE"]>;
|
|
160
|
+
}, import("zod").ZodTypeAny, "passthrough">>, "many">>;
|
|
161
|
+
vertexRetrieval: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
162
|
+
datastore: import("zod").ZodObject<{
|
|
163
|
+
projectId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
164
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
165
|
+
dataStoreId: import("zod").ZodString;
|
|
166
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
167
|
+
projectId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
168
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
169
|
+
dataStoreId: import("zod").ZodString;
|
|
170
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
171
|
+
projectId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
172
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
173
|
+
dataStoreId: import("zod").ZodString;
|
|
174
|
+
}, import("zod").ZodTypeAny, "passthrough">>;
|
|
175
|
+
disableAttribution: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
176
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
177
|
+
datastore: import("zod").ZodObject<{
|
|
178
|
+
projectId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
179
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
180
|
+
dataStoreId: import("zod").ZodString;
|
|
181
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
182
|
+
projectId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
183
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
184
|
+
dataStoreId: import("zod").ZodString;
|
|
185
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
186
|
+
projectId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
187
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
188
|
+
dataStoreId: import("zod").ZodString;
|
|
189
|
+
}, import("zod").ZodTypeAny, "passthrough">>;
|
|
190
|
+
disableAttribution: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
191
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
192
|
+
datastore: import("zod").ZodObject<{
|
|
193
|
+
projectId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
194
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
195
|
+
dataStoreId: import("zod").ZodString;
|
|
196
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
197
|
+
projectId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
198
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
199
|
+
dataStoreId: import("zod").ZodString;
|
|
200
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
201
|
+
projectId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
202
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
203
|
+
dataStoreId: import("zod").ZodString;
|
|
204
|
+
}, import("zod").ZodTypeAny, "passthrough">>;
|
|
205
|
+
disableAttribution: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
206
|
+
}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
207
|
+
googleSearchRetrieval: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
208
|
+
disableAttribution: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
209
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
210
|
+
disableAttribution: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
211
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
212
|
+
disableAttribution: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
213
|
+
}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
214
|
+
functionCallingConfig: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
215
|
+
mode: import("zod").ZodOptional<import("zod").ZodEnum<["MODE_UNSPECIFIED", "AUTO", "ANY", "NONE"]>>;
|
|
216
|
+
allowedFunctionNames: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
217
|
+
streamFunctionCallArguments: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
218
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
219
|
+
mode: import("zod").ZodOptional<import("zod").ZodEnum<["MODE_UNSPECIFIED", "AUTO", "ANY", "NONE"]>>;
|
|
220
|
+
allowedFunctionNames: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
221
|
+
streamFunctionCallArguments: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
222
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
223
|
+
mode: import("zod").ZodOptional<import("zod").ZodEnum<["MODE_UNSPECIFIED", "AUTO", "ANY", "NONE"]>>;
|
|
224
|
+
allowedFunctionNames: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
225
|
+
streamFunctionCallArguments: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
226
|
+
}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
227
|
+
retrievalConfig: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
228
|
+
latLng: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
229
|
+
latitude: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
230
|
+
longitude: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
231
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
232
|
+
latitude?: number | undefined;
|
|
233
|
+
longitude?: number | undefined;
|
|
234
|
+
}, {
|
|
235
|
+
latitude?: number | undefined;
|
|
236
|
+
longitude?: number | undefined;
|
|
237
|
+
}>>;
|
|
238
|
+
languageCode: import("zod").ZodOptional<import("zod").ZodString>;
|
|
239
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
240
|
+
latLng: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
241
|
+
latitude: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
242
|
+
longitude: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
243
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
244
|
+
latitude?: number | undefined;
|
|
245
|
+
longitude?: number | undefined;
|
|
246
|
+
}, {
|
|
247
|
+
latitude?: number | undefined;
|
|
248
|
+
longitude?: number | undefined;
|
|
249
|
+
}>>;
|
|
250
|
+
languageCode: import("zod").ZodOptional<import("zod").ZodString>;
|
|
251
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
252
|
+
latLng: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
253
|
+
latitude: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
254
|
+
longitude: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
255
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
256
|
+
latitude?: number | undefined;
|
|
257
|
+
longitude?: number | undefined;
|
|
258
|
+
}, {
|
|
259
|
+
latitude?: number | undefined;
|
|
260
|
+
longitude?: number | undefined;
|
|
261
|
+
}>>;
|
|
262
|
+
languageCode: import("zod").ZodOptional<import("zod").ZodString>;
|
|
263
|
+
}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
264
|
+
thinkingConfig: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
265
|
+
includeThoughts: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
266
|
+
thinkingBudget: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
267
|
+
thinkingLevel: import("zod").ZodOptional<import("zod").ZodEnum<["MINIMAL", "LOW", "MEDIUM", "HIGH"]>>;
|
|
268
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
269
|
+
includeThoughts: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
270
|
+
thinkingBudget: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
271
|
+
thinkingLevel: import("zod").ZodOptional<import("zod").ZodEnum<["MINIMAL", "LOW", "MEDIUM", "HIGH"]>>;
|
|
272
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
273
|
+
includeThoughts: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
274
|
+
thinkingBudget: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
275
|
+
thinkingLevel: import("zod").ZodOptional<import("zod").ZodEnum<["MINIMAL", "LOW", "MEDIUM", "HIGH"]>>;
|
|
276
|
+
}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
277
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
278
|
+
version: import("zod").ZodOptional<import("zod").ZodString>;
|
|
279
|
+
maxOutputTokens: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
280
|
+
topK: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
281
|
+
stopSequences: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
282
|
+
} & {
|
|
283
|
+
apiKey: import("zod").ZodOptional<import("zod").ZodString>;
|
|
284
|
+
labels: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
|
|
285
|
+
temperature: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
286
|
+
topP: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
287
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
288
|
+
safetySettings: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
289
|
+
category: import("zod").ZodEnum<["HARM_CATEGORY_UNSPECIFIED", "HARM_CATEGORY_HATE_SPEECH", "HARM_CATEGORY_DANGEROUS_CONTENT", "HARM_CATEGORY_HARASSMENT", "HARM_CATEGORY_SEXUALLY_EXPLICIT"]>;
|
|
290
|
+
threshold: import("zod").ZodEnum<["BLOCK_LOW_AND_ABOVE", "BLOCK_MEDIUM_AND_ABOVE", "BLOCK_ONLY_HIGH", "BLOCK_NONE"]>;
|
|
291
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
292
|
+
category: import("zod").ZodEnum<["HARM_CATEGORY_UNSPECIFIED", "HARM_CATEGORY_HATE_SPEECH", "HARM_CATEGORY_DANGEROUS_CONTENT", "HARM_CATEGORY_HARASSMENT", "HARM_CATEGORY_SEXUALLY_EXPLICIT"]>;
|
|
293
|
+
threshold: import("zod").ZodEnum<["BLOCK_LOW_AND_ABOVE", "BLOCK_MEDIUM_AND_ABOVE", "BLOCK_ONLY_HIGH", "BLOCK_NONE"]>;
|
|
294
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
295
|
+
category: import("zod").ZodEnum<["HARM_CATEGORY_UNSPECIFIED", "HARM_CATEGORY_HATE_SPEECH", "HARM_CATEGORY_DANGEROUS_CONTENT", "HARM_CATEGORY_HARASSMENT", "HARM_CATEGORY_SEXUALLY_EXPLICIT"]>;
|
|
296
|
+
threshold: import("zod").ZodEnum<["BLOCK_LOW_AND_ABOVE", "BLOCK_MEDIUM_AND_ABOVE", "BLOCK_ONLY_HIGH", "BLOCK_NONE"]>;
|
|
297
|
+
}, import("zod").ZodTypeAny, "passthrough">>, "many">>;
|
|
298
|
+
vertexRetrieval: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
299
|
+
datastore: import("zod").ZodObject<{
|
|
300
|
+
projectId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
301
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
302
|
+
dataStoreId: import("zod").ZodString;
|
|
303
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
304
|
+
projectId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
305
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
306
|
+
dataStoreId: import("zod").ZodString;
|
|
307
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
308
|
+
projectId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
309
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
310
|
+
dataStoreId: import("zod").ZodString;
|
|
311
|
+
}, import("zod").ZodTypeAny, "passthrough">>;
|
|
312
|
+
disableAttribution: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
313
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
314
|
+
datastore: import("zod").ZodObject<{
|
|
315
|
+
projectId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
316
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
317
|
+
dataStoreId: import("zod").ZodString;
|
|
318
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
319
|
+
projectId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
320
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
321
|
+
dataStoreId: import("zod").ZodString;
|
|
322
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
323
|
+
projectId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
324
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
325
|
+
dataStoreId: import("zod").ZodString;
|
|
326
|
+
}, import("zod").ZodTypeAny, "passthrough">>;
|
|
327
|
+
disableAttribution: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
328
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
329
|
+
datastore: import("zod").ZodObject<{
|
|
330
|
+
projectId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
331
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
332
|
+
dataStoreId: import("zod").ZodString;
|
|
333
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
334
|
+
projectId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
335
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
336
|
+
dataStoreId: import("zod").ZodString;
|
|
337
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
338
|
+
projectId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
339
|
+
location: import("zod").ZodOptional<import("zod").ZodString>;
|
|
340
|
+
dataStoreId: import("zod").ZodString;
|
|
341
|
+
}, import("zod").ZodTypeAny, "passthrough">>;
|
|
342
|
+
disableAttribution: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
343
|
+
}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
344
|
+
googleSearchRetrieval: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
345
|
+
disableAttribution: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
346
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
347
|
+
disableAttribution: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
348
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
349
|
+
disableAttribution: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
350
|
+
}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
351
|
+
functionCallingConfig: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
352
|
+
mode: import("zod").ZodOptional<import("zod").ZodEnum<["MODE_UNSPECIFIED", "AUTO", "ANY", "NONE"]>>;
|
|
353
|
+
allowedFunctionNames: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
354
|
+
streamFunctionCallArguments: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
355
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
356
|
+
mode: import("zod").ZodOptional<import("zod").ZodEnum<["MODE_UNSPECIFIED", "AUTO", "ANY", "NONE"]>>;
|
|
357
|
+
allowedFunctionNames: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
358
|
+
streamFunctionCallArguments: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
359
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
360
|
+
mode: import("zod").ZodOptional<import("zod").ZodEnum<["MODE_UNSPECIFIED", "AUTO", "ANY", "NONE"]>>;
|
|
361
|
+
allowedFunctionNames: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
362
|
+
streamFunctionCallArguments: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
363
|
+
}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
364
|
+
retrievalConfig: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
365
|
+
latLng: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
366
|
+
latitude: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
367
|
+
longitude: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
368
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
369
|
+
latitude?: number | undefined;
|
|
370
|
+
longitude?: number | undefined;
|
|
371
|
+
}, {
|
|
372
|
+
latitude?: number | undefined;
|
|
373
|
+
longitude?: number | undefined;
|
|
374
|
+
}>>;
|
|
375
|
+
languageCode: import("zod").ZodOptional<import("zod").ZodString>;
|
|
376
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
377
|
+
latLng: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
378
|
+
latitude: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
379
|
+
longitude: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
380
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
381
|
+
latitude?: number | undefined;
|
|
382
|
+
longitude?: number | undefined;
|
|
383
|
+
}, {
|
|
384
|
+
latitude?: number | undefined;
|
|
385
|
+
longitude?: number | undefined;
|
|
386
|
+
}>>;
|
|
387
|
+
languageCode: import("zod").ZodOptional<import("zod").ZodString>;
|
|
388
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
389
|
+
latLng: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
390
|
+
latitude: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
391
|
+
longitude: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
392
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
393
|
+
latitude?: number | undefined;
|
|
394
|
+
longitude?: number | undefined;
|
|
395
|
+
}, {
|
|
396
|
+
latitude?: number | undefined;
|
|
397
|
+
longitude?: number | undefined;
|
|
398
|
+
}>>;
|
|
399
|
+
languageCode: import("zod").ZodOptional<import("zod").ZodString>;
|
|
400
|
+
}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
401
|
+
thinkingConfig: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
402
|
+
includeThoughts: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
403
|
+
thinkingBudget: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
404
|
+
thinkingLevel: import("zod").ZodOptional<import("zod").ZodEnum<["MINIMAL", "LOW", "MEDIUM", "HIGH"]>>;
|
|
405
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
406
|
+
includeThoughts: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
407
|
+
thinkingBudget: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
408
|
+
thinkingLevel: import("zod").ZodOptional<import("zod").ZodEnum<["MINIMAL", "LOW", "MEDIUM", "HIGH"]>>;
|
|
409
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
410
|
+
includeThoughts: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
411
|
+
thinkingBudget: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
412
|
+
thinkingLevel: import("zod").ZodOptional<import("zod").ZodEnum<["MINIMAL", "LOW", "MEDIUM", "HIGH"]>>;
|
|
413
|
+
}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
414
|
+
}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
415
|
+
export type GeminiModelReference = typeof geminiModelReference;
|
|
416
|
+
export type GeminiModelConfig = SimplifyDeep<OmitIndexSignature<Parameters<GeminiModelReference['withConfig']>[0]>>;
|
|
3
417
|
export declare abstract class VertexAiMultiLocationOptions {
|
|
4
418
|
/** The Google Cloud locations to use for routing. */
|
|
5
419
|
locations: string[];
|
|
@@ -20,3 +434,4 @@ export declare abstract class VertexAiMultiLocationOptions {
|
|
|
20
434
|
*/
|
|
21
435
|
tokenLimitThreshold?: number;
|
|
22
436
|
}
|
|
437
|
+
export {};
|
package/ai/genkit/types.js
CHANGED
|
@@ -2,6 +2,7 @@ import type { Part } from 'genkit';
|
|
|
2
2
|
import type { SchemaTestable } from '../../schema/schema.js';
|
|
3
3
|
import type { ObjectLiteral } from '../../types/index.js';
|
|
4
4
|
import { type Instructions } from './instructions-formatter.js';
|
|
5
|
+
import { type FewShotExample } from './steering.js';
|
|
5
6
|
export type PromptBuilderInstructions = Record<string, Instructions>;
|
|
6
7
|
export type PromptBuilderContext = Record<string, PromptBuilderContextItem>;
|
|
7
8
|
export type PromptBuilderContextItem = ObjectLiteral;
|
|
@@ -11,8 +12,11 @@ export declare class PromptBuilder {
|
|
|
11
12
|
setRole(role: string): this;
|
|
12
13
|
setSystemTask(task: string): this;
|
|
13
14
|
setTask(task: string): this;
|
|
14
|
-
setSystemOutputSchema(schema: SchemaTestable): this;
|
|
15
|
-
setOutputSchema(schema: SchemaTestable): this;
|
|
15
|
+
setSystemOutputSchema<Input = ObjectLiteral, Output = ObjectLiteral>(schema: SchemaTestable<Output>, examples?: FewShotExample<Input, Output>[]): this;
|
|
16
|
+
setOutputSchema<Input = ObjectLiteral, Output = ObjectLiteral>(schema: SchemaTestable<Output>, examples?: FewShotExample<Input, Output>[]): this;
|
|
17
|
+
setSystemInstructionsOverride(override: ((instructions: Instructions) => Instructions | string) | undefined): this;
|
|
18
|
+
setInstructionsOverride(override: ((instructions: Instructions) => Instructions | string) | undefined): this;
|
|
19
|
+
setLanguage(language: string): this;
|
|
16
20
|
addSystemMedia(content: Uint8Array, mimeType: string): this;
|
|
17
21
|
addMedia(content: Uint8Array, mimeType: string): this;
|
|
18
22
|
addSystemInstructions(instructions: Record<string, Instructions>): this;
|
|
@@ -3,7 +3,8 @@ import { encodeBase64 } from '../../utils/base64.js';
|
|
|
3
3
|
import { fromEntries, objectEntries, objectKeys } from '../../utils/object/index.js';
|
|
4
4
|
import { assertObjectPass, isDefined, isString, isUndefined } from '../../utils/type-guards.js';
|
|
5
5
|
import { formatData } from './format.js';
|
|
6
|
-
import { formatInstructions, sections } from './instructions-formatter.js';
|
|
6
|
+
import { formatInstructions, sections, unorderedList } from './instructions-formatter.js';
|
|
7
|
+
import { fewShotPrompt, languagePrompt } from './steering.js';
|
|
7
8
|
export class PromptBuilder {
|
|
8
9
|
#systemMedia = [];
|
|
9
10
|
#media = [];
|
|
@@ -12,11 +13,16 @@ export class PromptBuilder {
|
|
|
12
13
|
#systemTask;
|
|
13
14
|
#task;
|
|
14
15
|
#systemOutputSchema;
|
|
16
|
+
#systemOutputExamples;
|
|
15
17
|
#outputSchema;
|
|
18
|
+
#outputExamples;
|
|
16
19
|
#systemInstructions = {};
|
|
17
20
|
#instructions = {};
|
|
18
21
|
#systemContextParts = {};
|
|
19
22
|
#contextParts = {};
|
|
23
|
+
#language;
|
|
24
|
+
#systemInstructionsOverride;
|
|
25
|
+
#instructionsOverride;
|
|
20
26
|
setSystemRole(role) {
|
|
21
27
|
this.#systemRole = role;
|
|
22
28
|
return this;
|
|
@@ -33,12 +39,26 @@ export class PromptBuilder {
|
|
|
33
39
|
this.#task = task;
|
|
34
40
|
return this;
|
|
35
41
|
}
|
|
36
|
-
setSystemOutputSchema(schema) {
|
|
42
|
+
setSystemOutputSchema(schema, examples) {
|
|
37
43
|
this.#systemOutputSchema = schema;
|
|
44
|
+
this.#systemOutputExamples = examples;
|
|
38
45
|
return this;
|
|
39
46
|
}
|
|
40
|
-
setOutputSchema(schema) {
|
|
47
|
+
setOutputSchema(schema, examples) {
|
|
41
48
|
this.#outputSchema = schema;
|
|
49
|
+
this.#outputExamples = examples;
|
|
50
|
+
return this;
|
|
51
|
+
}
|
|
52
|
+
setSystemInstructionsOverride(override) {
|
|
53
|
+
this.#systemInstructionsOverride = override;
|
|
54
|
+
return this;
|
|
55
|
+
}
|
|
56
|
+
setInstructionsOverride(override) {
|
|
57
|
+
this.#instructionsOverride = override;
|
|
58
|
+
return this;
|
|
59
|
+
}
|
|
60
|
+
setLanguage(language) {
|
|
61
|
+
this.#language = language;
|
|
42
62
|
return this;
|
|
43
63
|
}
|
|
44
64
|
addSystemMedia(content, mimeType) {
|
|
@@ -79,8 +99,11 @@ export class PromptBuilder {
|
|
|
79
99
|
context: this.#systemContextParts,
|
|
80
100
|
instructions: this.#systemInstructions,
|
|
81
101
|
outputSchema: this.#systemOutputSchema,
|
|
102
|
+
outputExamples: this.#systemOutputExamples,
|
|
82
103
|
task: this.#systemTask,
|
|
83
104
|
media: this.#systemMedia,
|
|
105
|
+
language: this.#language,
|
|
106
|
+
instructionsOverride: this.#systemInstructionsOverride,
|
|
84
107
|
});
|
|
85
108
|
}
|
|
86
109
|
buildUserPrompt() {
|
|
@@ -89,8 +112,11 @@ export class PromptBuilder {
|
|
|
89
112
|
context: this.#contextParts,
|
|
90
113
|
instructions: this.#instructions,
|
|
91
114
|
outputSchema: this.#outputSchema,
|
|
115
|
+
outputExamples: this.#outputExamples,
|
|
92
116
|
task: this.#task,
|
|
93
117
|
media: this.#media,
|
|
118
|
+
language: this.#language,
|
|
119
|
+
instructionsOverride: this.#instructionsOverride,
|
|
94
120
|
});
|
|
95
121
|
}
|
|
96
122
|
}
|
|
@@ -119,12 +145,25 @@ function buildPrompt(data) {
|
|
|
119
145
|
}
|
|
120
146
|
if (isDefined(data.outputSchema)) {
|
|
121
147
|
const schema = convertToOpenApiSchema(data.outputSchema);
|
|
122
|
-
|
|
148
|
+
const schemaJson = JSON.stringify(schema, null, 2);
|
|
149
|
+
instructions['**Output Schema**'] = `\`\`\`json\n${schemaJson}\n\`\`\``;
|
|
150
|
+
instructions['**Output Schema Instructions**'] = unorderedList({
|
|
151
|
+
'Schema Compliance': 'Generate valid JSON that strictly matches the provided schema.',
|
|
152
|
+
'Nullable fields with missing data': 'Must be set to literal `null`, not the string "null".',
|
|
153
|
+
'Optional fields with missing data': 'Omit the key entirely (sparse JSON).',
|
|
154
|
+
});
|
|
155
|
+
if (isDefined(data.outputExamples) && (data.outputExamples.length > 0)) {
|
|
156
|
+
instructions['**Output Examples**'] = fewShotPrompt(data.outputExamples);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
if (isDefined(data.language)) {
|
|
160
|
+
instructions['**Output Language**'] = languagePrompt(data.language);
|
|
123
161
|
}
|
|
124
162
|
if (isDefined(data.task)) {
|
|
125
163
|
instructions['**Task**'] = data.task;
|
|
126
164
|
}
|
|
127
|
-
const
|
|
165
|
+
const instructionsWithOverride = data.instructionsOverride?.(instructions) ?? instructions;
|
|
166
|
+
const formattedInstructions = isString(instructionsWithOverride) ? instructionsWithOverride : formatInstructions(instructionsWithOverride);
|
|
128
167
|
return [
|
|
129
168
|
...(data.media ?? []),
|
|
130
169
|
{ text: formattedInstructions },
|
package/ai/prompts/steering.d.ts
CHANGED
|
@@ -7,12 +7,13 @@ export type FewShotExample<Input = ObjectLiteral, Output = ObjectLiteral> = {
|
|
|
7
7
|
/** Optional reason explaining why this example is positive or negative. */
|
|
8
8
|
reason?: string;
|
|
9
9
|
};
|
|
10
|
+
export declare function fewShotExamples<const Input = ObjectLiteral, const Output = ObjectLiteral>(examples: FewShotExample<Input, Output>[]): FewShotExample<Input, Output>[];
|
|
10
11
|
/**
|
|
11
12
|
* Creates a prompt addition for few-shot learning.
|
|
12
13
|
* @param examples An array of input/output pairs.
|
|
13
14
|
* @returns A formatted few-shot prompt.
|
|
14
15
|
*/
|
|
15
|
-
export declare function fewShotPrompt<Input = ObjectLiteral, Output = ObjectLiteral>(examples: FewShotExample<Input, Output>[]): {
|
|
16
|
+
export declare function fewShotPrompt<const Input = ObjectLiteral, const Output = ObjectLiteral>(examples: FewShotExample<Input, Output>[]): {
|
|
16
17
|
Examples: string;
|
|
17
18
|
} | {
|
|
18
19
|
Examples: import("./instructions-formatter.js").InstructionsList;
|
package/ai/prompts/steering.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { fromEntries } from '../../utils/object/object.js';
|
|
2
2
|
import { isDefined, isString } from '../../utils/type-guards.js';
|
|
3
3
|
import { formatInstructions, orderedList, unorderedList } from './instructions-formatter.js';
|
|
4
|
+
export function fewShotExamples(examples) {
|
|
5
|
+
return examples;
|
|
6
|
+
}
|
|
4
7
|
/**
|
|
5
8
|
* Creates a prompt addition for few-shot learning.
|
|
6
9
|
* @param examples An array of input/output pairs.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type PromptBuilder } from '../../../ai/prompts/index.js';
|
|
2
|
+
import { type SchemaTestable } from '../../../schema/index.js';
|
|
3
|
+
export declare const DOCUMENT_MANAGEMENT_SYSTEM_ROLE = "You are a highly precise, analytical Document Management Specialist.";
|
|
4
|
+
export declare const contentExtractionSchema: import("../../../schema/index.js").ObjectSchema<{
|
|
5
|
+
content: string;
|
|
6
|
+
}>;
|
|
7
|
+
export declare function createContentExtractionPrompt(): PromptBuilder;
|
|
8
|
+
export declare function createClassifySchema(validTypes: string[]): SchemaTestable<{
|
|
9
|
+
documentType: string;
|
|
10
|
+
}>;
|
|
11
|
+
export declare function createClassifyPrompt(validTypes: string[]): PromptBuilder;
|
|
12
|
+
export declare const dataExtractionFields: {
|
|
13
|
+
Title: string;
|
|
14
|
+
Subtitle: string;
|
|
15
|
+
Summary: string;
|
|
16
|
+
Tags: string;
|
|
17
|
+
Date: string;
|
|
18
|
+
};
|
|
19
|
+
export declare function createDataExtractionPrompt(schema: SchemaTestable): PromptBuilder;
|
|
20
|
+
export declare const assignCollectionSchema: import("../../../schema/index.js").ObjectSchema<{
|
|
21
|
+
collectionIds: string[];
|
|
22
|
+
}>;
|
|
23
|
+
export declare function createAssignCollectionPrompt(): PromptBuilder;
|
|
24
|
+
export declare const assignRequestSchema: import("../../../schema/index.js").ObjectSchema<{
|
|
25
|
+
requestId: string | null;
|
|
26
|
+
}>;
|
|
27
|
+
export declare function createAssignRequestPrompt(): PromptBuilder;
|