@isdk/ai-tool 0.0.2
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/README.cn.md +261 -0
- package/README.md +3 -0
- package/dist/chunk-EZFPVSGF.mjs +22 -0
- package/dist/chunk-PKECBABP.mjs +5085 -0
- package/dist/funcs.d.mts +6 -0
- package/dist/funcs.d.ts +6 -0
- package/dist/funcs.js +5016 -0
- package/dist/funcs.mjs +37 -0
- package/dist/index-D4KjfAKl.d.mts +606 -0
- package/dist/index-D4KjfAKl.d.ts +606 -0
- package/dist/index.d.mts +1097 -0
- package/dist/index.d.ts +1097 -0
- package/dist/index.js +5239 -0
- package/dist/index.mjs +399 -0
- package/dist/test/util.d.mts +7 -0
- package/dist/test/util.d.ts +7 -0
- package/dist/test/util.js +98 -0
- package/dist/test/util.mjs +61 -0
- package/docs/.nojekyll +1 -0
- package/docs/README.md +5 -0
- package/docs/classes/AbortError.md +359 -0
- package/docs/classes/AlreadyExistsError.md +339 -0
- package/docs/classes/BaseError.md +346 -0
- package/docs/classes/ClientTools.md +2705 -0
- package/docs/classes/CommonError.md +368 -0
- package/docs/classes/ConfigFile.md +346 -0
- package/docs/classes/EventClient.md +3183 -0
- package/docs/classes/EventServer.md +3138 -0
- package/docs/classes/EventToolFunc.md +2498 -0
- package/docs/classes/FStringPromptTemplate.md +1236 -0
- package/docs/classes/FewShotPromptTemplate.md +1286 -0
- package/docs/classes/GolangPromptTemplate.md +1236 -0
- package/docs/classes/HFEnvironment.md +212 -0
- package/docs/classes/HFInterpreter.md +386 -0
- package/docs/classes/HFTemplate.md +79 -0
- package/docs/classes/HfPromptTemplate.md +1236 -0
- package/docs/classes/NotFoundError.md +339 -0
- package/docs/classes/NotImplementationError.md +339 -0
- package/docs/classes/PromptExampleSelector.md +207 -0
- package/docs/classes/PromptTemplate.md +1163 -0
- package/docs/classes/ReadableStreamError.md +359 -0
- package/docs/classes/ResClientTools.md +2859 -0
- package/docs/classes/ResServerTools.md +2783 -0
- package/docs/classes/SSEChannel.md +289 -0
- package/docs/classes/ServerTools.md +2633 -0
- package/docs/classes/ToolFunc.md +2124 -0
- package/docs/enums/ErrorCode.md +217 -0
- package/docs/enums/XXHashAlgorithm.md +30 -0
- package/docs/interfaces/AIChatAssistantMessageParam.md +84 -0
- package/docs/interfaces/AIChatContentPartImage.md +36 -0
- package/docs/interfaces/AIChatContentPartText.md +30 -0
- package/docs/interfaces/AIChatMessageParamBase.md +35 -0
- package/docs/interfaces/AIChatMessageToolCall.md +48 -0
- package/docs/interfaces/AIChatSystemMessageParam.md +51 -0
- package/docs/interfaces/AIChatToolMessageParam.md +62 -0
- package/docs/interfaces/AIChatUserMessageParam.md +95 -0
- package/docs/interfaces/AIResult.md +65 -0
- package/docs/interfaces/AIStreamCallbacksAndOptions.md +158 -0
- package/docs/interfaces/AIStreamParser.md +33 -0
- package/docs/interfaces/AIStreamParserOptions.md +23 -0
- package/docs/interfaces/BaseFunc.md +145 -0
- package/docs/interfaces/BaseFuncItem.md +99 -0
- package/docs/interfaces/ClientFuncItem.md +181 -0
- package/docs/interfaces/DotenvExpandOptions.md +51 -0
- package/docs/interfaces/DotenvExpandOutput.md +30 -0
- package/docs/interfaces/DotenvParseInput.md +7 -0
- package/docs/interfaces/DotenvParseOutput.md +7 -0
- package/docs/interfaces/DotenvPopulateInput.md +7 -0
- package/docs/interfaces/EventClientFuncParams.md +66 -0
- package/docs/interfaces/EventServerFuncParams.md +79 -0
- package/docs/interfaces/FewShotPromptTemplateOptions.md +179 -0
- package/docs/interfaces/FuncItem.md +130 -0
- package/docs/interfaces/FuncParam.md +67 -0
- package/docs/interfaces/FuncParams.md +7 -0
- package/docs/interfaces/Funcs.md +7 -0
- package/docs/interfaces/IOptions.md +30 -0
- package/docs/interfaces/JsonFilter.md +7 -0
- package/docs/interfaces/PromptExampleSelectorOptions.md +39 -0
- package/docs/interfaces/PromptTemplateOptions.md +84 -0
- package/docs/interfaces/RemoteFuncItem.md +167 -0
- package/docs/interfaces/ResClientFuncParams.md +34 -0
- package/docs/interfaces/ResServerFuncParams.md +79 -0
- package/docs/interfaces/SanitizeFilenameOptions.md +30 -0
- package/docs/interfaces/ServerFuncItem.md +192 -0
- package/docs/interfaces/ServerFuncParams.md +44 -0
- package/docs/modules.md +2707 -0
- package/package.json +112 -0
|
@@ -0,0 +1,1163 @@
|
|
|
1
|
+
[@isdk/ai-tool](../README.md) / [Exports](../modules.md) / PromptTemplate
|
|
2
|
+
|
|
3
|
+
# Class: PromptTemplate
|
|
4
|
+
|
|
5
|
+
## Hierarchy
|
|
6
|
+
|
|
7
|
+
- `BaseFactory`
|
|
8
|
+
|
|
9
|
+
↳ **`PromptTemplate`**
|
|
10
|
+
|
|
11
|
+
↳↳ [`HfPromptTemplate`](HfPromptTemplate.md)
|
|
12
|
+
|
|
13
|
+
↳↳ [`FStringPromptTemplate`](FStringPromptTemplate.md)
|
|
14
|
+
|
|
15
|
+
↳↳ [`GolangPromptTemplate`](GolangPromptTemplate.md)
|
|
16
|
+
|
|
17
|
+
↳↳ [`FewShotPromptTemplate`](FewShotPromptTemplate.md)
|
|
18
|
+
|
|
19
|
+
## Table of contents
|
|
20
|
+
|
|
21
|
+
### Constructors
|
|
22
|
+
|
|
23
|
+
- [constructor](PromptTemplate.md#constructor)
|
|
24
|
+
|
|
25
|
+
### Properties
|
|
26
|
+
|
|
27
|
+
- [compiledTemplate](PromptTemplate.md#compiledtemplate)
|
|
28
|
+
- [data](PromptTemplate.md#data)
|
|
29
|
+
- [inputVariables](PromptTemplate.md#inputvariables)
|
|
30
|
+
- [template](PromptTemplate.md#template)
|
|
31
|
+
- [templateFormat](PromptTemplate.md#templateformat)
|
|
32
|
+
- [\_Factory](PromptTemplate.md#_factory)
|
|
33
|
+
- [\_aliases](PromptTemplate.md#_aliases)
|
|
34
|
+
- [\_baseNameOnly](PromptTemplate.md#_basenameonly)
|
|
35
|
+
- [\_children](PromptTemplate.md#_children)
|
|
36
|
+
|
|
37
|
+
### Accessors
|
|
38
|
+
|
|
39
|
+
- [Factory](PromptTemplate.md#factory)
|
|
40
|
+
- [aliases](PromptTemplate.md#aliases)
|
|
41
|
+
|
|
42
|
+
### Methods
|
|
43
|
+
|
|
44
|
+
- [\_format](PromptTemplate.md#_format)
|
|
45
|
+
- [\_initialize](PromptTemplate.md#_initialize)
|
|
46
|
+
- [filterData](PromptTemplate.md#filterdata)
|
|
47
|
+
- [format](PromptTemplate.md#format)
|
|
48
|
+
- [initialize](PromptTemplate.md#initialize)
|
|
49
|
+
- [partial](PromptTemplate.md#partial)
|
|
50
|
+
- [toJSON](PromptTemplate.md#tojson)
|
|
51
|
+
- [\_findRootFactory](PromptTemplate.md#_findrootfactory)
|
|
52
|
+
- [\_get](PromptTemplate.md#_get)
|
|
53
|
+
- [\_register](PromptTemplate.md#_register)
|
|
54
|
+
- [cleanAliases](PromptTemplate.md#cleanaliases)
|
|
55
|
+
- [createObject](PromptTemplate.md#createobject)
|
|
56
|
+
- [findRootFactory](PromptTemplate.md#findrootfactory)
|
|
57
|
+
- [forEach](PromptTemplate.md#foreach)
|
|
58
|
+
- [format](PromptTemplate.md#format-1)
|
|
59
|
+
- [formatIf](PromptTemplate.md#formatif)
|
|
60
|
+
- [formatName](PromptTemplate.md#formatname)
|
|
61
|
+
- [formatNameFromClass](PromptTemplate.md#formatnamefromclass)
|
|
62
|
+
- [from](PromptTemplate.md#from)
|
|
63
|
+
- [get](PromptTemplate.md#get)
|
|
64
|
+
- [getAliases](PromptTemplate.md#getaliases)
|
|
65
|
+
- [getDisplayName](PromptTemplate.md#getdisplayname)
|
|
66
|
+
- [getNameFrom](PromptTemplate.md#getnamefrom)
|
|
67
|
+
- [getRealName](PromptTemplate.md#getrealname)
|
|
68
|
+
- [getRealNameFromAlias](PromptTemplate.md#getrealnamefromalias)
|
|
69
|
+
- [isTemplate](PromptTemplate.md#istemplate)
|
|
70
|
+
- [register](PromptTemplate.md#register)
|
|
71
|
+
- [registeredClass](PromptTemplate.md#registeredclass)
|
|
72
|
+
- [removeAlias](PromptTemplate.md#removealias)
|
|
73
|
+
- [setAlias](PromptTemplate.md#setalias)
|
|
74
|
+
- [setAliases](PromptTemplate.md#setaliases)
|
|
75
|
+
- [setDisplayName](PromptTemplate.md#setdisplayname)
|
|
76
|
+
- [unregister](PromptTemplate.md#unregister)
|
|
77
|
+
|
|
78
|
+
## Constructors
|
|
79
|
+
|
|
80
|
+
### constructor
|
|
81
|
+
|
|
82
|
+
• **new PromptTemplate**(`template?`, `options?`): [`PromptTemplate`](PromptTemplate.md)
|
|
83
|
+
|
|
84
|
+
#### Parameters
|
|
85
|
+
|
|
86
|
+
| Name | Type |
|
|
87
|
+
| :------ | :------ |
|
|
88
|
+
| `template?` | `string` \| [`PromptTemplateOptions`](../interfaces/PromptTemplateOptions.md) |
|
|
89
|
+
| `options?` | [`PromptTemplateOptions`](../interfaces/PromptTemplateOptions.md) |
|
|
90
|
+
|
|
91
|
+
#### Returns
|
|
92
|
+
|
|
93
|
+
[`PromptTemplate`](PromptTemplate.md)
|
|
94
|
+
|
|
95
|
+
#### Overrides
|
|
96
|
+
|
|
97
|
+
BaseFactory.constructor
|
|
98
|
+
|
|
99
|
+
#### Defined in
|
|
100
|
+
|
|
101
|
+
[packages/ai-tool/src/utils/prompt/prompt-template.ts:69](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/prompt/prompt-template.ts#L69)
|
|
102
|
+
|
|
103
|
+
## Properties
|
|
104
|
+
|
|
105
|
+
### compiledTemplate
|
|
106
|
+
|
|
107
|
+
• **compiledTemplate**: `any`
|
|
108
|
+
|
|
109
|
+
#### Defined in
|
|
110
|
+
|
|
111
|
+
[packages/ai-tool/src/utils/prompt/prompt-template.ts:21](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/prompt/prompt-template.ts#L21)
|
|
112
|
+
|
|
113
|
+
___
|
|
114
|
+
|
|
115
|
+
### data
|
|
116
|
+
|
|
117
|
+
• **data**: `undefined` \| `Record`\<`string`, `any`\>
|
|
118
|
+
|
|
119
|
+
#### Defined in
|
|
120
|
+
|
|
121
|
+
[packages/ai-tool/src/utils/prompt/prompt-template.ts:24](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/prompt/prompt-template.ts#L24)
|
|
122
|
+
|
|
123
|
+
___
|
|
124
|
+
|
|
125
|
+
### inputVariables
|
|
126
|
+
|
|
127
|
+
• **inputVariables**: `undefined` \| `string`[]
|
|
128
|
+
|
|
129
|
+
#### Defined in
|
|
130
|
+
|
|
131
|
+
[packages/ai-tool/src/utils/prompt/prompt-template.ts:25](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/prompt/prompt-template.ts#L25)
|
|
132
|
+
|
|
133
|
+
___
|
|
134
|
+
|
|
135
|
+
### template
|
|
136
|
+
|
|
137
|
+
• **template**: `string`
|
|
138
|
+
|
|
139
|
+
#### Defined in
|
|
140
|
+
|
|
141
|
+
[packages/ai-tool/src/utils/prompt/prompt-template.ts:22](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/prompt/prompt-template.ts#L22)
|
|
142
|
+
|
|
143
|
+
___
|
|
144
|
+
|
|
145
|
+
### templateFormat
|
|
146
|
+
|
|
147
|
+
• **templateFormat**: `undefined` \| `string`
|
|
148
|
+
|
|
149
|
+
#### Defined in
|
|
150
|
+
|
|
151
|
+
[packages/ai-tool/src/utils/prompt/prompt-template.ts:23](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/prompt/prompt-template.ts#L23)
|
|
152
|
+
|
|
153
|
+
___
|
|
154
|
+
|
|
155
|
+
### \_Factory
|
|
156
|
+
|
|
157
|
+
▪ `Static` **\_Factory**: typeof `BaseFactory`
|
|
158
|
+
|
|
159
|
+
The Root Factory class
|
|
160
|
+
|
|
161
|
+
**`Name`**
|
|
162
|
+
|
|
163
|
+
_Factory
|
|
164
|
+
|
|
165
|
+
**`Abstract`**
|
|
166
|
+
|
|
167
|
+
#### Inherited from
|
|
168
|
+
|
|
169
|
+
BaseFactory.\_Factory
|
|
170
|
+
|
|
171
|
+
#### Defined in
|
|
172
|
+
|
|
173
|
+
node_modules/.pnpm/custom-factory@2.3.0-alpha.6/node_modules/custom-factory/lib/base-factory.d.ts:41
|
|
174
|
+
|
|
175
|
+
___
|
|
176
|
+
|
|
177
|
+
### \_aliases
|
|
178
|
+
|
|
179
|
+
▪ `Static` **\_aliases**: [alias: string]
|
|
180
|
+
|
|
181
|
+
the registered alias items object.
|
|
182
|
+
the key is alias name, the value is the registered name
|
|
183
|
+
|
|
184
|
+
**`Abstract`**
|
|
185
|
+
|
|
186
|
+
#### Inherited from
|
|
187
|
+
|
|
188
|
+
BaseFactory.\_aliases
|
|
189
|
+
|
|
190
|
+
#### Defined in
|
|
191
|
+
|
|
192
|
+
node_modules/.pnpm/custom-factory@2.3.0-alpha.6/node_modules/custom-factory/lib/base-factory.d.ts:59
|
|
193
|
+
|
|
194
|
+
___
|
|
195
|
+
|
|
196
|
+
### \_baseNameOnly
|
|
197
|
+
|
|
198
|
+
▪ `Static` **\_baseNameOnly**: `number`
|
|
199
|
+
|
|
200
|
+
Extracts a specified number of words from a PascalCase class name to use as a base name for registration,
|
|
201
|
+
only if no `name` is specified. The parameter value indicates the maximum depth of the word extraction.
|
|
202
|
+
|
|
203
|
+
In JavaScript, class names use `PascalCase` convention where each word starts with a capital letter.
|
|
204
|
+
The baseNameOnly parameter is a number that specifies which words to extract from the class name as the base name.
|
|
205
|
+
If the value is 1, it extracts the first word, 2 extracts the first two words, and 0 uses the entire class name.
|
|
206
|
+
The base name is used to register the class to the factory.
|
|
207
|
+
|
|
208
|
+
**`Example`**
|
|
209
|
+
|
|
210
|
+
```ts
|
|
211
|
+
such as "JsonTextCodec" if baseNameOnly is 1, the first word "Json" will be extracted from "JsonTextCodec" as
|
|
212
|
+
the base name. If baseNameOnly is 2, the first two words "JsonText" will be extracted as the base name. If
|
|
213
|
+
baseNameOnly is 0, the entire class name "JsonTextCodec" will be used as the base name.
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
**`Name`**
|
|
217
|
+
|
|
218
|
+
_baseNameOnly
|
|
219
|
+
|
|
220
|
+
**`Default`**
|
|
221
|
+
|
|
222
|
+
```ts
|
|
223
|
+
1
|
|
224
|
+
@internal
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
#### Inherited from
|
|
228
|
+
|
|
229
|
+
BaseFactory.\_baseNameOnly
|
|
230
|
+
|
|
231
|
+
#### Defined in
|
|
232
|
+
|
|
233
|
+
node_modules/.pnpm/custom-factory@2.3.0-alpha.6/node_modules/custom-factory/lib/base-factory.d.ts:82
|
|
234
|
+
|
|
235
|
+
___
|
|
236
|
+
|
|
237
|
+
### \_children
|
|
238
|
+
|
|
239
|
+
▪ `Static` **\_children**: `Object`
|
|
240
|
+
|
|
241
|
+
The registered classes in the Factory
|
|
242
|
+
|
|
243
|
+
**`Name`**
|
|
244
|
+
|
|
245
|
+
_children
|
|
246
|
+
|
|
247
|
+
**`Abstract`**
|
|
248
|
+
|
|
249
|
+
#### Index signature
|
|
250
|
+
|
|
251
|
+
▪ [name: `string`]: `any`
|
|
252
|
+
|
|
253
|
+
#### Inherited from
|
|
254
|
+
|
|
255
|
+
BaseFactory.\_children
|
|
256
|
+
|
|
257
|
+
#### Defined in
|
|
258
|
+
|
|
259
|
+
node_modules/.pnpm/custom-factory@2.3.0-alpha.6/node_modules/custom-factory/lib/base-factory.d.ts:49
|
|
260
|
+
|
|
261
|
+
## Accessors
|
|
262
|
+
|
|
263
|
+
### Factory
|
|
264
|
+
|
|
265
|
+
• `get` **Factory**(): typeof `BaseFactory`
|
|
266
|
+
|
|
267
|
+
The Root Factory class
|
|
268
|
+
|
|
269
|
+
#### Returns
|
|
270
|
+
|
|
271
|
+
typeof `BaseFactory`
|
|
272
|
+
|
|
273
|
+
#### Inherited from
|
|
274
|
+
|
|
275
|
+
BaseFactory.Factory
|
|
276
|
+
|
|
277
|
+
#### Defined in
|
|
278
|
+
|
|
279
|
+
node_modules/.pnpm/custom-factory@2.3.0-alpha.6/node_modules/custom-factory/lib/base-factory.d.ts:63
|
|
280
|
+
|
|
281
|
+
___
|
|
282
|
+
|
|
283
|
+
### aliases
|
|
284
|
+
|
|
285
|
+
• `get` **aliases**(): `string`[]
|
|
286
|
+
|
|
287
|
+
the aliases of itself
|
|
288
|
+
|
|
289
|
+
#### Returns
|
|
290
|
+
|
|
291
|
+
`string`[]
|
|
292
|
+
|
|
293
|
+
#### Inherited from
|
|
294
|
+
|
|
295
|
+
BaseFactory.aliases
|
|
296
|
+
|
|
297
|
+
#### Defined in
|
|
298
|
+
|
|
299
|
+
node_modules/.pnpm/custom-factory@2.3.0-alpha.6/node_modules/custom-factory/lib/base-factory.d.ts:200
|
|
300
|
+
|
|
301
|
+
• `set` **aliases**(`value`): `void`
|
|
302
|
+
|
|
303
|
+
#### Parameters
|
|
304
|
+
|
|
305
|
+
| Name | Type |
|
|
306
|
+
| :------ | :------ |
|
|
307
|
+
| `value` | `string`[] |
|
|
308
|
+
|
|
309
|
+
#### Returns
|
|
310
|
+
|
|
311
|
+
`void`
|
|
312
|
+
|
|
313
|
+
#### Inherited from
|
|
314
|
+
|
|
315
|
+
BaseFactory.aliases
|
|
316
|
+
|
|
317
|
+
#### Defined in
|
|
318
|
+
|
|
319
|
+
node_modules/.pnpm/custom-factory@2.3.0-alpha.6/node_modules/custom-factory/lib/base-factory.d.ts:196
|
|
320
|
+
|
|
321
|
+
## Methods
|
|
322
|
+
|
|
323
|
+
### \_format
|
|
324
|
+
|
|
325
|
+
▸ **_format**(`data`): `string` \| `Promise`\<`string`\>
|
|
326
|
+
|
|
327
|
+
#### Parameters
|
|
328
|
+
|
|
329
|
+
| Name | Type |
|
|
330
|
+
| :------ | :------ |
|
|
331
|
+
| `data` | `Record`\<`string`, `any`\> |
|
|
332
|
+
|
|
333
|
+
#### Returns
|
|
334
|
+
|
|
335
|
+
`string` \| `Promise`\<`string`\>
|
|
336
|
+
|
|
337
|
+
#### Defined in
|
|
338
|
+
|
|
339
|
+
[packages/ai-tool/src/utils/prompt/prompt-template.ts:105](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/prompt/prompt-template.ts#L105)
|
|
340
|
+
|
|
341
|
+
___
|
|
342
|
+
|
|
343
|
+
### \_initialize
|
|
344
|
+
|
|
345
|
+
▸ **_initialize**(`options?`): `void`
|
|
346
|
+
|
|
347
|
+
#### Parameters
|
|
348
|
+
|
|
349
|
+
| Name | Type |
|
|
350
|
+
| :------ | :------ |
|
|
351
|
+
| `options?` | [`PromptTemplateOptions`](../interfaces/PromptTemplateOptions.md) |
|
|
352
|
+
|
|
353
|
+
#### Returns
|
|
354
|
+
|
|
355
|
+
`void`
|
|
356
|
+
|
|
357
|
+
#### Defined in
|
|
358
|
+
|
|
359
|
+
[packages/ai-tool/src/utils/prompt/prompt-template.ts:92](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/prompt/prompt-template.ts#L92)
|
|
360
|
+
|
|
361
|
+
___
|
|
362
|
+
|
|
363
|
+
### filterData
|
|
364
|
+
|
|
365
|
+
▸ **filterData**(`data`): `Record`\<`string`, `any`\>
|
|
366
|
+
|
|
367
|
+
Validate/filter the data in inputVariables
|
|
368
|
+
|
|
369
|
+
#### Parameters
|
|
370
|
+
|
|
371
|
+
| Name | Type |
|
|
372
|
+
| :------ | :------ |
|
|
373
|
+
| `data` | `Record`\<`string`, `any`\> |
|
|
374
|
+
|
|
375
|
+
#### Returns
|
|
376
|
+
|
|
377
|
+
`Record`\<`string`, `any`\>
|
|
378
|
+
|
|
379
|
+
#### Defined in
|
|
380
|
+
|
|
381
|
+
[packages/ai-tool/src/utils/prompt/prompt-template.ts:62](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/prompt/prompt-template.ts#L62)
|
|
382
|
+
|
|
383
|
+
___
|
|
384
|
+
|
|
385
|
+
### format
|
|
386
|
+
|
|
387
|
+
▸ **format**(`data?`): `Promise`\<`string`\>
|
|
388
|
+
|
|
389
|
+
#### Parameters
|
|
390
|
+
|
|
391
|
+
| Name | Type |
|
|
392
|
+
| :------ | :------ |
|
|
393
|
+
| `data?` | `Record`\<`string`, `any`\> |
|
|
394
|
+
|
|
395
|
+
#### Returns
|
|
396
|
+
|
|
397
|
+
`Promise`\<`string`\>
|
|
398
|
+
|
|
399
|
+
#### Defined in
|
|
400
|
+
|
|
401
|
+
[packages/ai-tool/src/utils/prompt/prompt-template.ts:109](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/prompt/prompt-template.ts#L109)
|
|
402
|
+
|
|
403
|
+
___
|
|
404
|
+
|
|
405
|
+
### initialize
|
|
406
|
+
|
|
407
|
+
▸ **initialize**(`options?`): `void`
|
|
408
|
+
|
|
409
|
+
#### Parameters
|
|
410
|
+
|
|
411
|
+
| Name | Type |
|
|
412
|
+
| :------ | :------ |
|
|
413
|
+
| `options?` | [`PromptTemplateOptions`](../interfaces/PromptTemplateOptions.md) |
|
|
414
|
+
|
|
415
|
+
#### Returns
|
|
416
|
+
|
|
417
|
+
`void`
|
|
418
|
+
|
|
419
|
+
#### Overrides
|
|
420
|
+
|
|
421
|
+
BaseFactory.initialize
|
|
422
|
+
|
|
423
|
+
#### Defined in
|
|
424
|
+
|
|
425
|
+
[packages/ai-tool/src/utils/prompt/prompt-template.ts:96](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/prompt/prompt-template.ts#L96)
|
|
426
|
+
|
|
427
|
+
___
|
|
428
|
+
|
|
429
|
+
### partial
|
|
430
|
+
|
|
431
|
+
▸ **partial**(`data`): [`PromptTemplate`](PromptTemplate.md)
|
|
432
|
+
|
|
433
|
+
it can make sense to "partial" a prompt template - eg pass in a subset of the required values, as to create a new prompt template which expects only the remaining subset of values.
|
|
434
|
+
|
|
435
|
+
#### Parameters
|
|
436
|
+
|
|
437
|
+
| Name | Type | Description |
|
|
438
|
+
| :------ | :------ | :------ |
|
|
439
|
+
| `data` | `Record`\<`string`, `any`\> | the partial data |
|
|
440
|
+
|
|
441
|
+
#### Returns
|
|
442
|
+
|
|
443
|
+
[`PromptTemplate`](PromptTemplate.md)
|
|
444
|
+
|
|
445
|
+
the new partial PromptTemplate instance
|
|
446
|
+
|
|
447
|
+
#### Defined in
|
|
448
|
+
|
|
449
|
+
[packages/ai-tool/src/utils/prompt/prompt-template.ts:139](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/prompt/prompt-template.ts#L139)
|
|
450
|
+
|
|
451
|
+
___
|
|
452
|
+
|
|
453
|
+
### toJSON
|
|
454
|
+
|
|
455
|
+
▸ **toJSON**(`options?`): [`PromptTemplateOptions`](../interfaces/PromptTemplateOptions.md)
|
|
456
|
+
|
|
457
|
+
#### Parameters
|
|
458
|
+
|
|
459
|
+
| Name | Type |
|
|
460
|
+
| :------ | :------ |
|
|
461
|
+
| `options` | [`PromptTemplateOptions`](../interfaces/PromptTemplateOptions.md) |
|
|
462
|
+
|
|
463
|
+
#### Returns
|
|
464
|
+
|
|
465
|
+
[`PromptTemplateOptions`](../interfaces/PromptTemplateOptions.md)
|
|
466
|
+
|
|
467
|
+
#### Defined in
|
|
468
|
+
|
|
469
|
+
[packages/ai-tool/src/utils/prompt/prompt-template.ts:147](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/prompt/prompt-template.ts#L147)
|
|
470
|
+
|
|
471
|
+
___
|
|
472
|
+
|
|
473
|
+
### \_findRootFactory
|
|
474
|
+
|
|
475
|
+
▸ **_findRootFactory**(`aClass`): `undefined` \| typeof `BaseFactory`
|
|
476
|
+
|
|
477
|
+
find the real root factory
|
|
478
|
+
|
|
479
|
+
#### Parameters
|
|
480
|
+
|
|
481
|
+
| Name | Type | Description |
|
|
482
|
+
| :------ | :------ | :------ |
|
|
483
|
+
| `aClass` | typeof `BaseFactory` | the abstract root factory class |
|
|
484
|
+
|
|
485
|
+
#### Returns
|
|
486
|
+
|
|
487
|
+
`undefined` \| typeof `BaseFactory`
|
|
488
|
+
|
|
489
|
+
#### Inherited from
|
|
490
|
+
|
|
491
|
+
BaseFactory.\_findRootFactory
|
|
492
|
+
|
|
493
|
+
#### Defined in
|
|
494
|
+
|
|
495
|
+
node_modules/.pnpm/custom-factory@2.3.0-alpha.6/node_modules/custom-factory/lib/base-factory.d.ts:99
|
|
496
|
+
|
|
497
|
+
___
|
|
498
|
+
|
|
499
|
+
### \_get
|
|
500
|
+
|
|
501
|
+
▸ **_get**(`name`): `any`
|
|
502
|
+
|
|
503
|
+
#### Parameters
|
|
504
|
+
|
|
505
|
+
| Name | Type |
|
|
506
|
+
| :------ | :------ |
|
|
507
|
+
| `name` | `any` |
|
|
508
|
+
|
|
509
|
+
#### Returns
|
|
510
|
+
|
|
511
|
+
`any`
|
|
512
|
+
|
|
513
|
+
#### Inherited from
|
|
514
|
+
|
|
515
|
+
BaseFactory.\_get
|
|
516
|
+
|
|
517
|
+
#### Defined in
|
|
518
|
+
|
|
519
|
+
node_modules/.pnpm/custom-factory@2.3.0-alpha.6/node_modules/custom-factory/lib/base-factory.d.ts:234
|
|
520
|
+
|
|
521
|
+
___
|
|
522
|
+
|
|
523
|
+
### \_register
|
|
524
|
+
|
|
525
|
+
▸ **_register**(`aClass`, `aOptions?`): `boolean`
|
|
526
|
+
|
|
527
|
+
register the aClass to the factory
|
|
528
|
+
|
|
529
|
+
#### Parameters
|
|
530
|
+
|
|
531
|
+
| Name | Type | Description |
|
|
532
|
+
| :------ | :------ | :------ |
|
|
533
|
+
| `aClass` | typeof `BaseFactory` | the class to register the Factory |
|
|
534
|
+
| `aOptions?` | `any` | the options for the class and the factory |
|
|
535
|
+
|
|
536
|
+
#### Returns
|
|
537
|
+
|
|
538
|
+
`boolean`
|
|
539
|
+
|
|
540
|
+
return true if successful.
|
|
541
|
+
|
|
542
|
+
#### Inherited from
|
|
543
|
+
|
|
544
|
+
BaseFactory.\_register
|
|
545
|
+
|
|
546
|
+
#### Defined in
|
|
547
|
+
|
|
548
|
+
node_modules/.pnpm/custom-factory@2.3.0-alpha.6/node_modules/custom-factory/lib/base-factory.d.ts:145
|
|
549
|
+
|
|
550
|
+
___
|
|
551
|
+
|
|
552
|
+
### cleanAliases
|
|
553
|
+
|
|
554
|
+
▸ **cleanAliases**(`aName`): `void`
|
|
555
|
+
|
|
556
|
+
remove all aliases of the registered item or itself
|
|
557
|
+
|
|
558
|
+
#### Parameters
|
|
559
|
+
|
|
560
|
+
| Name | Type | Description |
|
|
561
|
+
| :------ | :------ | :------ |
|
|
562
|
+
| `aName` | `undefined` \| `string` \| typeof `BaseFactory` | the registered item or name |
|
|
563
|
+
|
|
564
|
+
#### Returns
|
|
565
|
+
|
|
566
|
+
`void`
|
|
567
|
+
|
|
568
|
+
#### Inherited from
|
|
569
|
+
|
|
570
|
+
BaseFactory.cleanAliases
|
|
571
|
+
|
|
572
|
+
#### Defined in
|
|
573
|
+
|
|
574
|
+
node_modules/.pnpm/custom-factory@2.3.0-alpha.6/node_modules/custom-factory/lib/base-factory.d.ts:162
|
|
575
|
+
|
|
576
|
+
___
|
|
577
|
+
|
|
578
|
+
### createObject
|
|
579
|
+
|
|
580
|
+
▸ **createObject**(`aName`, `aOptions`): `undefined` \| `BaseFactory`
|
|
581
|
+
|
|
582
|
+
Create a new object instance of Factory
|
|
583
|
+
|
|
584
|
+
#### Parameters
|
|
585
|
+
|
|
586
|
+
| Name | Type |
|
|
587
|
+
| :------ | :------ |
|
|
588
|
+
| `aName` | `string` \| `BaseFactory` |
|
|
589
|
+
| `aOptions` | `any` |
|
|
590
|
+
|
|
591
|
+
#### Returns
|
|
592
|
+
|
|
593
|
+
`undefined` \| `BaseFactory`
|
|
594
|
+
|
|
595
|
+
#### Inherited from
|
|
596
|
+
|
|
597
|
+
BaseFactory.createObject
|
|
598
|
+
|
|
599
|
+
#### Defined in
|
|
600
|
+
|
|
601
|
+
node_modules/.pnpm/custom-factory@2.3.0-alpha.6/node_modules/custom-factory/lib/base-factory.d.ts:241
|
|
602
|
+
|
|
603
|
+
___
|
|
604
|
+
|
|
605
|
+
### findRootFactory
|
|
606
|
+
|
|
607
|
+
▸ **findRootFactory**(): `undefined` \| typeof `BaseFactory`
|
|
608
|
+
|
|
609
|
+
find the real root factory
|
|
610
|
+
|
|
611
|
+
You can overwrite it to specify your root factory class
|
|
612
|
+
or set _Factory directly.
|
|
613
|
+
|
|
614
|
+
#### Returns
|
|
615
|
+
|
|
616
|
+
`undefined` \| typeof `BaseFactory`
|
|
617
|
+
|
|
618
|
+
the root factory class
|
|
619
|
+
|
|
620
|
+
**`Abstract`**
|
|
621
|
+
|
|
622
|
+
#### Inherited from
|
|
623
|
+
|
|
624
|
+
BaseFactory.findRootFactory
|
|
625
|
+
|
|
626
|
+
#### Defined in
|
|
627
|
+
|
|
628
|
+
node_modules/.pnpm/custom-factory@2.3.0-alpha.6/node_modules/custom-factory/lib/base-factory.d.ts:92
|
|
629
|
+
|
|
630
|
+
___
|
|
631
|
+
|
|
632
|
+
### forEach
|
|
633
|
+
|
|
634
|
+
▸ **forEach**(`cb`): `any`
|
|
635
|
+
|
|
636
|
+
executes a provided callback function once for each registered element.
|
|
637
|
+
|
|
638
|
+
#### Parameters
|
|
639
|
+
|
|
640
|
+
| Name | Type | Description |
|
|
641
|
+
| :------ | :------ | :------ |
|
|
642
|
+
| `cb` | (`ctor`: typeof `BaseFactory`, `name`: `string`) => `undefined` \| `string` | the forEach callback function |
|
|
643
|
+
|
|
644
|
+
#### Returns
|
|
645
|
+
|
|
646
|
+
`any`
|
|
647
|
+
|
|
648
|
+
#### Inherited from
|
|
649
|
+
|
|
650
|
+
BaseFactory.forEach
|
|
651
|
+
|
|
652
|
+
#### Defined in
|
|
653
|
+
|
|
654
|
+
node_modules/.pnpm/custom-factory@2.3.0-alpha.6/node_modules/custom-factory/lib/base-factory.d.ts:227
|
|
655
|
+
|
|
656
|
+
___
|
|
657
|
+
|
|
658
|
+
### format
|
|
659
|
+
|
|
660
|
+
▸ **format**(`options`): `Promise`\<`string`\>
|
|
661
|
+
|
|
662
|
+
#### Parameters
|
|
663
|
+
|
|
664
|
+
| Name | Type |
|
|
665
|
+
| :------ | :------ |
|
|
666
|
+
| `options` | [`PromptTemplateOptions`](../interfaces/PromptTemplateOptions.md) |
|
|
667
|
+
|
|
668
|
+
#### Returns
|
|
669
|
+
|
|
670
|
+
`Promise`\<`string`\>
|
|
671
|
+
|
|
672
|
+
#### Defined in
|
|
673
|
+
|
|
674
|
+
[packages/ai-tool/src/utils/prompt/prompt-template.ts:31](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/prompt/prompt-template.ts#L31)
|
|
675
|
+
|
|
676
|
+
___
|
|
677
|
+
|
|
678
|
+
### formatIf
|
|
679
|
+
|
|
680
|
+
▸ **formatIf**(`options`): `Promise`\<`undefined` \| `string`\>
|
|
681
|
+
|
|
682
|
+
If the given options.template is the template, perform formatting using that template.
|
|
683
|
+
|
|
684
|
+
#### Parameters
|
|
685
|
+
|
|
686
|
+
| Name | Type | Description |
|
|
687
|
+
| :------ | :------ | :------ |
|
|
688
|
+
| `options` | [`PromptTemplateOptions`](../interfaces/PromptTemplateOptions.md) | The options object to check for being a template and to format. |
|
|
689
|
+
|
|
690
|
+
#### Returns
|
|
691
|
+
|
|
692
|
+
`Promise`\<`undefined` \| `string`\>
|
|
693
|
+
|
|
694
|
+
A Promise that resolves to the formatted result if options is a template; otherwise, no value is returned.
|
|
695
|
+
|
|
696
|
+
#### Defined in
|
|
697
|
+
|
|
698
|
+
[packages/ai-tool/src/utils/prompt/prompt-template.ts:41](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/prompt/prompt-template.ts#L41)
|
|
699
|
+
|
|
700
|
+
___
|
|
701
|
+
|
|
702
|
+
### formatName
|
|
703
|
+
|
|
704
|
+
▸ **formatName**(`aName`): `string`
|
|
705
|
+
|
|
706
|
+
format(transform) the name to be registered.
|
|
707
|
+
|
|
708
|
+
defaults to returning the name unchanged. By overloading this method, case-insensitive names can be achieved.
|
|
709
|
+
|
|
710
|
+
#### Parameters
|
|
711
|
+
|
|
712
|
+
| Name | Type |
|
|
713
|
+
| :------ | :------ |
|
|
714
|
+
| `aName` | `string` |
|
|
715
|
+
|
|
716
|
+
#### Returns
|
|
717
|
+
|
|
718
|
+
`string`
|
|
719
|
+
|
|
720
|
+
**`Abstract`**
|
|
721
|
+
|
|
722
|
+
#### Inherited from
|
|
723
|
+
|
|
724
|
+
BaseFactory.formatName
|
|
725
|
+
|
|
726
|
+
#### Defined in
|
|
727
|
+
|
|
728
|
+
node_modules/.pnpm/custom-factory@2.3.0-alpha.6/node_modules/custom-factory/lib/base-factory.d.ts:116
|
|
729
|
+
|
|
730
|
+
___
|
|
731
|
+
|
|
732
|
+
### formatNameFromClass
|
|
733
|
+
|
|
734
|
+
▸ **formatNameFromClass**(`aClass`, `aBaseNameOnly?`): `string`
|
|
735
|
+
|
|
736
|
+
format(transform) the name to be registered for the aClass
|
|
737
|
+
|
|
738
|
+
#### Parameters
|
|
739
|
+
|
|
740
|
+
| Name | Type |
|
|
741
|
+
| :------ | :------ |
|
|
742
|
+
| `aClass` | `any` |
|
|
743
|
+
| `aBaseNameOnly?` | `number` |
|
|
744
|
+
|
|
745
|
+
#### Returns
|
|
746
|
+
|
|
747
|
+
`string`
|
|
748
|
+
|
|
749
|
+
the name to register
|
|
750
|
+
|
|
751
|
+
#### Inherited from
|
|
752
|
+
|
|
753
|
+
BaseFactory.formatNameFromClass
|
|
754
|
+
|
|
755
|
+
#### Defined in
|
|
756
|
+
|
|
757
|
+
node_modules/.pnpm/custom-factory@2.3.0-alpha.6/node_modules/custom-factory/lib/base-factory.d.ts:130
|
|
758
|
+
|
|
759
|
+
___
|
|
760
|
+
|
|
761
|
+
### from
|
|
762
|
+
|
|
763
|
+
▸ **from**(`template?`, `options?`): [`PromptTemplate`](PromptTemplate.md)
|
|
764
|
+
|
|
765
|
+
#### Parameters
|
|
766
|
+
|
|
767
|
+
| Name | Type |
|
|
768
|
+
| :------ | :------ |
|
|
769
|
+
| `template?` | `string` \| [`PromptTemplateOptions`](../interfaces/PromptTemplateOptions.md) |
|
|
770
|
+
| `options?` | [`PromptTemplateOptions`](../interfaces/PromptTemplateOptions.md) |
|
|
771
|
+
|
|
772
|
+
#### Returns
|
|
773
|
+
|
|
774
|
+
[`PromptTemplate`](PromptTemplate.md)
|
|
775
|
+
|
|
776
|
+
#### Defined in
|
|
777
|
+
|
|
778
|
+
[packages/ai-tool/src/utils/prompt/prompt-template.ts:27](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/prompt/prompt-template.ts#L27)
|
|
779
|
+
|
|
780
|
+
___
|
|
781
|
+
|
|
782
|
+
### get
|
|
783
|
+
|
|
784
|
+
▸ **get**(`name`): `undefined` \| typeof `BaseFactory`
|
|
785
|
+
|
|
786
|
+
Get the registered class via name
|
|
787
|
+
|
|
788
|
+
#### Parameters
|
|
789
|
+
|
|
790
|
+
| Name | Type |
|
|
791
|
+
| :------ | :------ |
|
|
792
|
+
| `name` | `any` |
|
|
793
|
+
|
|
794
|
+
#### Returns
|
|
795
|
+
|
|
796
|
+
`undefined` \| typeof `BaseFactory`
|
|
797
|
+
|
|
798
|
+
return the registered class if found the name
|
|
799
|
+
|
|
800
|
+
#### Inherited from
|
|
801
|
+
|
|
802
|
+
BaseFactory.get
|
|
803
|
+
|
|
804
|
+
#### Defined in
|
|
805
|
+
|
|
806
|
+
node_modules/.pnpm/custom-factory@2.3.0-alpha.6/node_modules/custom-factory/lib/base-factory.d.ts:233
|
|
807
|
+
|
|
808
|
+
___
|
|
809
|
+
|
|
810
|
+
### getAliases
|
|
811
|
+
|
|
812
|
+
▸ **getAliases**(`aClass`): `string`[]
|
|
813
|
+
|
|
814
|
+
get the aliases of the aClass
|
|
815
|
+
|
|
816
|
+
#### Parameters
|
|
817
|
+
|
|
818
|
+
| Name | Type | Description |
|
|
819
|
+
| :------ | :------ | :------ |
|
|
820
|
+
| `aClass` | `undefined` \| `string` \| typeof `BaseFactory` | the class or name to get aliases, means itself if no aClass specified |
|
|
821
|
+
|
|
822
|
+
#### Returns
|
|
823
|
+
|
|
824
|
+
`string`[]
|
|
825
|
+
|
|
826
|
+
aliases
|
|
827
|
+
|
|
828
|
+
#### Inherited from
|
|
829
|
+
|
|
830
|
+
BaseFactory.getAliases
|
|
831
|
+
|
|
832
|
+
#### Defined in
|
|
833
|
+
|
|
834
|
+
node_modules/.pnpm/custom-factory@2.3.0-alpha.6/node_modules/custom-factory/lib/base-factory.d.ts:195
|
|
835
|
+
|
|
836
|
+
___
|
|
837
|
+
|
|
838
|
+
### getDisplayName
|
|
839
|
+
|
|
840
|
+
▸ **getDisplayName**(`aClass`): `undefined` \| `string`
|
|
841
|
+
|
|
842
|
+
Get the display name from aClass
|
|
843
|
+
|
|
844
|
+
#### Parameters
|
|
845
|
+
|
|
846
|
+
| Name | Type | Description |
|
|
847
|
+
| :------ | :------ | :------ |
|
|
848
|
+
| `aClass` | `undefined` \| `string` \| `Function` | the class, name or itself, means itself if no aClass |
|
|
849
|
+
|
|
850
|
+
#### Returns
|
|
851
|
+
|
|
852
|
+
`undefined` \| `string`
|
|
853
|
+
|
|
854
|
+
#### Inherited from
|
|
855
|
+
|
|
856
|
+
BaseFactory.getDisplayName
|
|
857
|
+
|
|
858
|
+
#### Defined in
|
|
859
|
+
|
|
860
|
+
node_modules/.pnpm/custom-factory@2.3.0-alpha.6/node_modules/custom-factory/lib/base-factory.d.ts:206
|
|
861
|
+
|
|
862
|
+
___
|
|
863
|
+
|
|
864
|
+
### getNameFrom
|
|
865
|
+
|
|
866
|
+
▸ **getNameFrom**(`aClass`): `string`
|
|
867
|
+
|
|
868
|
+
Get the unique(registered) name in the factory
|
|
869
|
+
|
|
870
|
+
#### Parameters
|
|
871
|
+
|
|
872
|
+
| Name | Type |
|
|
873
|
+
| :------ | :------ |
|
|
874
|
+
| `aClass` | `string` \| `Function` |
|
|
875
|
+
|
|
876
|
+
#### Returns
|
|
877
|
+
|
|
878
|
+
`string`
|
|
879
|
+
|
|
880
|
+
the unique name in the factory
|
|
881
|
+
|
|
882
|
+
#### Inherited from
|
|
883
|
+
|
|
884
|
+
BaseFactory.getNameFrom
|
|
885
|
+
|
|
886
|
+
#### Defined in
|
|
887
|
+
|
|
888
|
+
node_modules/.pnpm/custom-factory@2.3.0-alpha.6/node_modules/custom-factory/lib/base-factory.d.ts:122
|
|
889
|
+
|
|
890
|
+
___
|
|
891
|
+
|
|
892
|
+
### getRealName
|
|
893
|
+
|
|
894
|
+
▸ **getRealName**(`name`): `any`
|
|
895
|
+
|
|
896
|
+
#### Parameters
|
|
897
|
+
|
|
898
|
+
| Name | Type |
|
|
899
|
+
| :------ | :------ |
|
|
900
|
+
| `name` | `any` |
|
|
901
|
+
|
|
902
|
+
#### Returns
|
|
903
|
+
|
|
904
|
+
`any`
|
|
905
|
+
|
|
906
|
+
#### Inherited from
|
|
907
|
+
|
|
908
|
+
BaseFactory.getRealName
|
|
909
|
+
|
|
910
|
+
#### Defined in
|
|
911
|
+
|
|
912
|
+
node_modules/.pnpm/custom-factory@2.3.0-alpha.6/node_modules/custom-factory/lib/base-factory.d.ts:100
|
|
913
|
+
|
|
914
|
+
___
|
|
915
|
+
|
|
916
|
+
### getRealNameFromAlias
|
|
917
|
+
|
|
918
|
+
▸ **getRealNameFromAlias**(`alias`): `undefined` \| `string`
|
|
919
|
+
|
|
920
|
+
get the unique name in the factory from an alias name
|
|
921
|
+
|
|
922
|
+
#### Parameters
|
|
923
|
+
|
|
924
|
+
| Name | Type | Description |
|
|
925
|
+
| :------ | :------ | :------ |
|
|
926
|
+
| `alias` | `string` | the alias name |
|
|
927
|
+
|
|
928
|
+
#### Returns
|
|
929
|
+
|
|
930
|
+
`undefined` \| `string`
|
|
931
|
+
|
|
932
|
+
the unique name in the factory
|
|
933
|
+
|
|
934
|
+
#### Inherited from
|
|
935
|
+
|
|
936
|
+
BaseFactory.getRealNameFromAlias
|
|
937
|
+
|
|
938
|
+
#### Defined in
|
|
939
|
+
|
|
940
|
+
node_modules/.pnpm/custom-factory@2.3.0-alpha.6/node_modules/custom-factory/lib/base-factory.d.ts:106
|
|
941
|
+
|
|
942
|
+
___
|
|
943
|
+
|
|
944
|
+
### isTemplate
|
|
945
|
+
|
|
946
|
+
▸ **isTemplate**(`templateOpt`): `any`
|
|
947
|
+
|
|
948
|
+
#### Parameters
|
|
949
|
+
|
|
950
|
+
| Name | Type |
|
|
951
|
+
| :------ | :------ |
|
|
952
|
+
| `templateOpt` | [`PromptTemplateOptions`](../interfaces/PromptTemplateOptions.md) |
|
|
953
|
+
|
|
954
|
+
#### Returns
|
|
955
|
+
|
|
956
|
+
`any`
|
|
957
|
+
|
|
958
|
+
#### Defined in
|
|
959
|
+
|
|
960
|
+
[packages/ai-tool/src/utils/prompt/prompt-template.ts:48](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/prompt/prompt-template.ts#L48)
|
|
961
|
+
|
|
962
|
+
___
|
|
963
|
+
|
|
964
|
+
### register
|
|
965
|
+
|
|
966
|
+
▸ **register**(`...args`): `boolean`
|
|
967
|
+
|
|
968
|
+
register the aClass to the factory
|
|
969
|
+
|
|
970
|
+
#### Parameters
|
|
971
|
+
|
|
972
|
+
| Name | Type |
|
|
973
|
+
| :------ | :------ |
|
|
974
|
+
| `...args` | `any`[] |
|
|
975
|
+
|
|
976
|
+
#### Returns
|
|
977
|
+
|
|
978
|
+
`boolean`
|
|
979
|
+
|
|
980
|
+
return true if successful.
|
|
981
|
+
|
|
982
|
+
#### Inherited from
|
|
983
|
+
|
|
984
|
+
BaseFactory.register
|
|
985
|
+
|
|
986
|
+
#### Defined in
|
|
987
|
+
|
|
988
|
+
node_modules/.pnpm/custom-factory@2.3.0-alpha.6/node_modules/custom-factory/lib/base-factory.d.ts:137
|
|
989
|
+
|
|
990
|
+
___
|
|
991
|
+
|
|
992
|
+
### registeredClass
|
|
993
|
+
|
|
994
|
+
▸ **registeredClass**(`aName`): ``false`` \| typeof `BaseFactory`
|
|
995
|
+
|
|
996
|
+
Check the name, alias or itself whether registered.
|
|
997
|
+
|
|
998
|
+
#### Parameters
|
|
999
|
+
|
|
1000
|
+
| Name | Type | Description |
|
|
1001
|
+
| :------ | :------ | :------ |
|
|
1002
|
+
| `aName` | `undefined` \| `string` | the class name |
|
|
1003
|
+
|
|
1004
|
+
#### Returns
|
|
1005
|
+
|
|
1006
|
+
``false`` \| typeof `BaseFactory`
|
|
1007
|
+
|
|
1008
|
+
the registered class if registered, otherwise returns false
|
|
1009
|
+
|
|
1010
|
+
#### Inherited from
|
|
1011
|
+
|
|
1012
|
+
BaseFactory.registeredClass
|
|
1013
|
+
|
|
1014
|
+
#### Defined in
|
|
1015
|
+
|
|
1016
|
+
node_modules/.pnpm/custom-factory@2.3.0-alpha.6/node_modules/custom-factory/lib/base-factory.d.ts:151
|
|
1017
|
+
|
|
1018
|
+
___
|
|
1019
|
+
|
|
1020
|
+
### removeAlias
|
|
1021
|
+
|
|
1022
|
+
▸ **removeAlias**(`...aliases`): `void`
|
|
1023
|
+
|
|
1024
|
+
remove specified aliases
|
|
1025
|
+
|
|
1026
|
+
#### Parameters
|
|
1027
|
+
|
|
1028
|
+
| Name | Type | Description |
|
|
1029
|
+
| :------ | :------ | :------ |
|
|
1030
|
+
| `...aliases` | `string`[] | the aliases to remove |
|
|
1031
|
+
|
|
1032
|
+
#### Returns
|
|
1033
|
+
|
|
1034
|
+
`void`
|
|
1035
|
+
|
|
1036
|
+
#### Inherited from
|
|
1037
|
+
|
|
1038
|
+
BaseFactory.removeAlias
|
|
1039
|
+
|
|
1040
|
+
#### Defined in
|
|
1041
|
+
|
|
1042
|
+
node_modules/.pnpm/custom-factory@2.3.0-alpha.6/node_modules/custom-factory/lib/base-factory.d.ts:167
|
|
1043
|
+
|
|
1044
|
+
___
|
|
1045
|
+
|
|
1046
|
+
### setAlias
|
|
1047
|
+
|
|
1048
|
+
▸ **setAlias**(`aClass`, `alias`): `void`
|
|
1049
|
+
|
|
1050
|
+
set alias to a class
|
|
1051
|
+
|
|
1052
|
+
#### Parameters
|
|
1053
|
+
|
|
1054
|
+
| Name | Type | Description |
|
|
1055
|
+
| :------ | :------ | :------ |
|
|
1056
|
+
| `aClass` | `undefined` \| `string` \| typeof `BaseFactory` | the class to set alias |
|
|
1057
|
+
| `alias` | `string` | |
|
|
1058
|
+
|
|
1059
|
+
#### Returns
|
|
1060
|
+
|
|
1061
|
+
`void`
|
|
1062
|
+
|
|
1063
|
+
#### Inherited from
|
|
1064
|
+
|
|
1065
|
+
BaseFactory.setAlias
|
|
1066
|
+
|
|
1067
|
+
#### Defined in
|
|
1068
|
+
|
|
1069
|
+
node_modules/.pnpm/custom-factory@2.3.0-alpha.6/node_modules/custom-factory/lib/base-factory.d.ts:189
|
|
1070
|
+
|
|
1071
|
+
___
|
|
1072
|
+
|
|
1073
|
+
### setAliases
|
|
1074
|
+
|
|
1075
|
+
▸ **setAliases**(`aClass`, `...aAliases`): `void`
|
|
1076
|
+
|
|
1077
|
+
set aliases to a class
|
|
1078
|
+
|
|
1079
|
+
#### Parameters
|
|
1080
|
+
|
|
1081
|
+
| Name | Type | Description |
|
|
1082
|
+
| :------ | :------ | :------ |
|
|
1083
|
+
| `aClass` | `undefined` \| `string` \| typeof `BaseFactory` | the class to set aliases |
|
|
1084
|
+
| `...aAliases` | `any`[] | - |
|
|
1085
|
+
|
|
1086
|
+
#### Returns
|
|
1087
|
+
|
|
1088
|
+
`void`
|
|
1089
|
+
|
|
1090
|
+
**`Example`**
|
|
1091
|
+
|
|
1092
|
+
```ts
|
|
1093
|
+
import { BaseFactory } from 'custom-factory'
|
|
1094
|
+
class Factory extends BaseFactory {}
|
|
1095
|
+
const register = Factory.register.bind(Factory)
|
|
1096
|
+
const aliases = Factory.setAliases.bind(Factory)
|
|
1097
|
+
class MyFactory {}
|
|
1098
|
+
register(MyFactory)
|
|
1099
|
+
aliases(MyFactory, 'my', 'MY')
|
|
1100
|
+
```
|
|
1101
|
+
|
|
1102
|
+
#### Inherited from
|
|
1103
|
+
|
|
1104
|
+
BaseFactory.setAliases
|
|
1105
|
+
|
|
1106
|
+
#### Defined in
|
|
1107
|
+
|
|
1108
|
+
node_modules/.pnpm/custom-factory@2.3.0-alpha.6/node_modules/custom-factory/lib/base-factory.d.ts:183
|
|
1109
|
+
|
|
1110
|
+
___
|
|
1111
|
+
|
|
1112
|
+
### setDisplayName
|
|
1113
|
+
|
|
1114
|
+
▸ **setDisplayName**(`aClass`, `aDisplayName`): `void`
|
|
1115
|
+
|
|
1116
|
+
Set the display name to the aClass
|
|
1117
|
+
|
|
1118
|
+
#### Parameters
|
|
1119
|
+
|
|
1120
|
+
| Name | Type | Description |
|
|
1121
|
+
| :------ | :------ | :------ |
|
|
1122
|
+
| `aClass` | `undefined` \| `string` \| `Function` | the class, name or itself, means itself if no aClass |
|
|
1123
|
+
| `aDisplayName` | `string` \| \{ `displayName`: `string` } | the display name to set |
|
|
1124
|
+
|
|
1125
|
+
#### Returns
|
|
1126
|
+
|
|
1127
|
+
`void`
|
|
1128
|
+
|
|
1129
|
+
#### Inherited from
|
|
1130
|
+
|
|
1131
|
+
BaseFactory.setDisplayName
|
|
1132
|
+
|
|
1133
|
+
#### Defined in
|
|
1134
|
+
|
|
1135
|
+
node_modules/.pnpm/custom-factory@2.3.0-alpha.6/node_modules/custom-factory/lib/base-factory.d.ts:212
|
|
1136
|
+
|
|
1137
|
+
___
|
|
1138
|
+
|
|
1139
|
+
### unregister
|
|
1140
|
+
|
|
1141
|
+
▸ **unregister**(`aName`): `boolean`
|
|
1142
|
+
|
|
1143
|
+
unregister this class in the factory
|
|
1144
|
+
|
|
1145
|
+
#### Parameters
|
|
1146
|
+
|
|
1147
|
+
| Name | Type | Description |
|
|
1148
|
+
| :------ | :------ | :------ |
|
|
1149
|
+
| `aName` | `undefined` \| `string` \| `Function` | the registered name or class, no name means unregister itself. |
|
|
1150
|
+
|
|
1151
|
+
#### Returns
|
|
1152
|
+
|
|
1153
|
+
`boolean`
|
|
1154
|
+
|
|
1155
|
+
true means successful
|
|
1156
|
+
|
|
1157
|
+
#### Inherited from
|
|
1158
|
+
|
|
1159
|
+
BaseFactory.unregister
|
|
1160
|
+
|
|
1161
|
+
#### Defined in
|
|
1162
|
+
|
|
1163
|
+
node_modules/.pnpm/custom-factory@2.3.0-alpha.6/node_modules/custom-factory/lib/base-factory.d.ts:157
|