@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.
Files changed (87) hide show
  1. package/README.cn.md +261 -0
  2. package/README.md +3 -0
  3. package/dist/chunk-EZFPVSGF.mjs +22 -0
  4. package/dist/chunk-PKECBABP.mjs +5085 -0
  5. package/dist/funcs.d.mts +6 -0
  6. package/dist/funcs.d.ts +6 -0
  7. package/dist/funcs.js +5016 -0
  8. package/dist/funcs.mjs +37 -0
  9. package/dist/index-D4KjfAKl.d.mts +606 -0
  10. package/dist/index-D4KjfAKl.d.ts +606 -0
  11. package/dist/index.d.mts +1097 -0
  12. package/dist/index.d.ts +1097 -0
  13. package/dist/index.js +5239 -0
  14. package/dist/index.mjs +399 -0
  15. package/dist/test/util.d.mts +7 -0
  16. package/dist/test/util.d.ts +7 -0
  17. package/dist/test/util.js +98 -0
  18. package/dist/test/util.mjs +61 -0
  19. package/docs/.nojekyll +1 -0
  20. package/docs/README.md +5 -0
  21. package/docs/classes/AbortError.md +359 -0
  22. package/docs/classes/AlreadyExistsError.md +339 -0
  23. package/docs/classes/BaseError.md +346 -0
  24. package/docs/classes/ClientTools.md +2705 -0
  25. package/docs/classes/CommonError.md +368 -0
  26. package/docs/classes/ConfigFile.md +346 -0
  27. package/docs/classes/EventClient.md +3183 -0
  28. package/docs/classes/EventServer.md +3138 -0
  29. package/docs/classes/EventToolFunc.md +2498 -0
  30. package/docs/classes/FStringPromptTemplate.md +1236 -0
  31. package/docs/classes/FewShotPromptTemplate.md +1286 -0
  32. package/docs/classes/GolangPromptTemplate.md +1236 -0
  33. package/docs/classes/HFEnvironment.md +212 -0
  34. package/docs/classes/HFInterpreter.md +386 -0
  35. package/docs/classes/HFTemplate.md +79 -0
  36. package/docs/classes/HfPromptTemplate.md +1236 -0
  37. package/docs/classes/NotFoundError.md +339 -0
  38. package/docs/classes/NotImplementationError.md +339 -0
  39. package/docs/classes/PromptExampleSelector.md +207 -0
  40. package/docs/classes/PromptTemplate.md +1163 -0
  41. package/docs/classes/ReadableStreamError.md +359 -0
  42. package/docs/classes/ResClientTools.md +2859 -0
  43. package/docs/classes/ResServerTools.md +2783 -0
  44. package/docs/classes/SSEChannel.md +289 -0
  45. package/docs/classes/ServerTools.md +2633 -0
  46. package/docs/classes/ToolFunc.md +2124 -0
  47. package/docs/enums/ErrorCode.md +217 -0
  48. package/docs/enums/XXHashAlgorithm.md +30 -0
  49. package/docs/interfaces/AIChatAssistantMessageParam.md +84 -0
  50. package/docs/interfaces/AIChatContentPartImage.md +36 -0
  51. package/docs/interfaces/AIChatContentPartText.md +30 -0
  52. package/docs/interfaces/AIChatMessageParamBase.md +35 -0
  53. package/docs/interfaces/AIChatMessageToolCall.md +48 -0
  54. package/docs/interfaces/AIChatSystemMessageParam.md +51 -0
  55. package/docs/interfaces/AIChatToolMessageParam.md +62 -0
  56. package/docs/interfaces/AIChatUserMessageParam.md +95 -0
  57. package/docs/interfaces/AIResult.md +65 -0
  58. package/docs/interfaces/AIStreamCallbacksAndOptions.md +158 -0
  59. package/docs/interfaces/AIStreamParser.md +33 -0
  60. package/docs/interfaces/AIStreamParserOptions.md +23 -0
  61. package/docs/interfaces/BaseFunc.md +145 -0
  62. package/docs/interfaces/BaseFuncItem.md +99 -0
  63. package/docs/interfaces/ClientFuncItem.md +181 -0
  64. package/docs/interfaces/DotenvExpandOptions.md +51 -0
  65. package/docs/interfaces/DotenvExpandOutput.md +30 -0
  66. package/docs/interfaces/DotenvParseInput.md +7 -0
  67. package/docs/interfaces/DotenvParseOutput.md +7 -0
  68. package/docs/interfaces/DotenvPopulateInput.md +7 -0
  69. package/docs/interfaces/EventClientFuncParams.md +66 -0
  70. package/docs/interfaces/EventServerFuncParams.md +79 -0
  71. package/docs/interfaces/FewShotPromptTemplateOptions.md +179 -0
  72. package/docs/interfaces/FuncItem.md +130 -0
  73. package/docs/interfaces/FuncParam.md +67 -0
  74. package/docs/interfaces/FuncParams.md +7 -0
  75. package/docs/interfaces/Funcs.md +7 -0
  76. package/docs/interfaces/IOptions.md +30 -0
  77. package/docs/interfaces/JsonFilter.md +7 -0
  78. package/docs/interfaces/PromptExampleSelectorOptions.md +39 -0
  79. package/docs/interfaces/PromptTemplateOptions.md +84 -0
  80. package/docs/interfaces/RemoteFuncItem.md +167 -0
  81. package/docs/interfaces/ResClientFuncParams.md +34 -0
  82. package/docs/interfaces/ResServerFuncParams.md +79 -0
  83. package/docs/interfaces/SanitizeFilenameOptions.md +30 -0
  84. package/docs/interfaces/ServerFuncItem.md +192 -0
  85. package/docs/interfaces/ServerFuncParams.md +44 -0
  86. package/docs/modules.md +2707 -0
  87. package/package.json +112 -0
@@ -0,0 +1,2707 @@
1
+ [@isdk/ai-tool](README.md) / Exports
2
+
3
+ # @isdk/ai-tool
4
+
5
+ ## Table of contents
6
+
7
+ ### Enumerations
8
+
9
+ - [ErrorCode](enums/ErrorCode.md)
10
+ - [XXHashAlgorithm](enums/XXHashAlgorithm.md)
11
+
12
+ ### Classes
13
+
14
+ - [AbortError](classes/AbortError.md)
15
+ - [AlreadyExistsError](classes/AlreadyExistsError.md)
16
+ - [BaseError](classes/BaseError.md)
17
+ - [ClientTools](classes/ClientTools.md)
18
+ - [CommonError](classes/CommonError.md)
19
+ - [ConfigFile](classes/ConfigFile.md)
20
+ - [EventClient](classes/EventClient.md)
21
+ - [EventServer](classes/EventServer.md)
22
+ - [EventToolFunc](classes/EventToolFunc.md)
23
+ - [FStringPromptTemplate](classes/FStringPromptTemplate.md)
24
+ - [FewShotPromptTemplate](classes/FewShotPromptTemplate.md)
25
+ - [GolangPromptTemplate](classes/GolangPromptTemplate.md)
26
+ - [HFEnvironment](classes/HFEnvironment.md)
27
+ - [HFInterpreter](classes/HFInterpreter.md)
28
+ - [HFTemplate](classes/HFTemplate.md)
29
+ - [HfPromptTemplate](classes/HfPromptTemplate.md)
30
+ - [NotFoundError](classes/NotFoundError.md)
31
+ - [NotImplementationError](classes/NotImplementationError.md)
32
+ - [PromptExampleSelector](classes/PromptExampleSelector.md)
33
+ - [PromptTemplate](classes/PromptTemplate.md)
34
+ - [ReadableStreamError](classes/ReadableStreamError.md)
35
+ - [ResClientTools](classes/ResClientTools.md)
36
+ - [ResServerTools](classes/ResServerTools.md)
37
+ - [SSEChannel](classes/SSEChannel.md)
38
+ - [ServerTools](classes/ServerTools.md)
39
+ - [ToolFunc](classes/ToolFunc.md)
40
+
41
+ ### Interfaces
42
+
43
+ - [AIChatAssistantMessageParam](interfaces/AIChatAssistantMessageParam.md)
44
+ - [AIChatContentPartImage](interfaces/AIChatContentPartImage.md)
45
+ - [AIChatContentPartText](interfaces/AIChatContentPartText.md)
46
+ - [AIChatMessageParamBase](interfaces/AIChatMessageParamBase.md)
47
+ - [AIChatMessageToolCall](interfaces/AIChatMessageToolCall.md)
48
+ - [AIChatSystemMessageParam](interfaces/AIChatSystemMessageParam.md)
49
+ - [AIChatToolMessageParam](interfaces/AIChatToolMessageParam.md)
50
+ - [AIChatUserMessageParam](interfaces/AIChatUserMessageParam.md)
51
+ - [AIResult](interfaces/AIResult.md)
52
+ - [AIStreamCallbacksAndOptions](interfaces/AIStreamCallbacksAndOptions.md)
53
+ - [AIStreamParser](interfaces/AIStreamParser.md)
54
+ - [AIStreamParserOptions](interfaces/AIStreamParserOptions.md)
55
+ - [BaseFunc](interfaces/BaseFunc.md)
56
+ - [BaseFuncItem](interfaces/BaseFuncItem.md)
57
+ - [ClientFuncItem](interfaces/ClientFuncItem.md)
58
+ - [DotenvExpandOptions](interfaces/DotenvExpandOptions.md)
59
+ - [DotenvExpandOutput](interfaces/DotenvExpandOutput.md)
60
+ - [DotenvParseInput](interfaces/DotenvParseInput.md)
61
+ - [DotenvParseOutput](interfaces/DotenvParseOutput.md)
62
+ - [DotenvPopulateInput](interfaces/DotenvPopulateInput.md)
63
+ - [EventClientFuncParams](interfaces/EventClientFuncParams.md)
64
+ - [EventServerFuncParams](interfaces/EventServerFuncParams.md)
65
+ - [FewShotPromptTemplateOptions](interfaces/FewShotPromptTemplateOptions.md)
66
+ - [FuncItem](interfaces/FuncItem.md)
67
+ - [FuncParam](interfaces/FuncParam.md)
68
+ - [FuncParams](interfaces/FuncParams.md)
69
+ - [Funcs](interfaces/Funcs.md)
70
+ - [IOptions](interfaces/IOptions.md)
71
+ - [JsonFilter](interfaces/JsonFilter.md)
72
+ - [PromptExampleSelectorOptions](interfaces/PromptExampleSelectorOptions.md)
73
+ - [PromptTemplateOptions](interfaces/PromptTemplateOptions.md)
74
+ - [RemoteFuncItem](interfaces/RemoteFuncItem.md)
75
+ - [ResClientFuncParams](interfaces/ResClientFuncParams.md)
76
+ - [ResServerFuncParams](interfaces/ResServerFuncParams.md)
77
+ - [SanitizeFilenameOptions](interfaces/SanitizeFilenameOptions.md)
78
+ - [ServerFuncItem](interfaces/ServerFuncItem.md)
79
+ - [ServerFuncParams](interfaces/ServerFuncParams.md)
80
+
81
+ ### Type Aliases
82
+
83
+ - [AIChatContentPart](modules.md#aichatcontentpart)
84
+ - [AIChatMessageParam](modules.md#aichatmessageparam)
85
+ - [AIChatRole](modules.md#aichatrole)
86
+ - [AIMessageType](modules.md#aimessagetype)
87
+ - [AIModelNameRule](modules.md#aimodelnamerule)
88
+ - [AIModelNameRuleFn](modules.md#aimodelnamerulefn)
89
+ - [AIModelNameRules](modules.md#aimodelnamerules)
90
+ - [AITextGenerationFinishReason](modules.md#aitextgenerationfinishreason)
91
+ - [ActionName](modules.md#actionname)
92
+ - [ErrorCodeType](modules.md#errorcodetype)
93
+ - [EventErrorListenerFn](modules.md#eventerrorlistenerfn)
94
+ - [EventListenerFn](modules.md#eventlistenerfn)
95
+ - [FStringPromptTemplateNode](modules.md#fstringprompttemplatenode)
96
+ - [FuncParamType](modules.md#funcparamtype)
97
+ - [PromptExamples](modules.md#promptexamples)
98
+ - [PromptTemplateType](modules.md#prompttemplatetype)
99
+ - [PromptType](modules.md#prompttype)
100
+ - [TFunc](modules.md#tfunc)
101
+
102
+ ### Variables
103
+
104
+ - [AIChatRoles](modules.md#aichatroles)
105
+ - [AIMessageTypes](modules.md#aimessagetypes)
106
+ - [AITextGenerationFinishReasons](modules.md#aitextgenerationfinishreasons)
107
+ - [AbortErrorCode](modules.md#aborterrorcode)
108
+ - [ActionNames](modules.md#actionnames)
109
+ - [AlreadyExistsErrorCode](modules.md#alreadyexistserrorcode)
110
+ - [ClientToolFuncSchema](modules.md#clienttoolfuncschema)
111
+ - [EventBusName](modules.md#eventbusname)
112
+ - [EventName](modules.md#eventname)
113
+ - [FilenameReservedRegex](modules.md#filenamereservedregex)
114
+ - [HFBuiltins](modules.md#hfbuiltins)
115
+ - [InternalErrorCode](modules.md#internalerrorcode)
116
+ - [NotFoundErrorCode](modules.md#notfounderrorcode)
117
+ - [NotImplementedErrorCode](modules.md#notimplementederrorcode)
118
+ - [PASSING\_SCORE](modules.md#passing_score)
119
+ - [PromptTemplateTypes](modules.md#prompttemplatetypes)
120
+ - [PromptTypes](modules.md#prompttypes)
121
+ - [RStreamErrCode](modules.md#rstreamerrcode)
122
+ - [RemoteToolFuncSchema](modules.md#remotetoolfuncschema)
123
+ - [ResClientToolsSchema](modules.md#resclienttoolsschema)
124
+ - [ResServerToolsSchema](modules.md#resservertoolsschema)
125
+ - [ResponseRStreamErrCode](modules.md#responserstreamerrcode)
126
+ - [SSEChannelAlreadyClosedErrCode](modules.md#ssechannelalreadyclosederrcode)
127
+ - [ServerToolFuncSchema](modules.md#servertoolfuncschema)
128
+ - [ToolFuncSchema](modules.md#toolfuncschema)
129
+ - [WindowsReservedNameRegex](modules.md#windowsreservednameregex)
130
+ - [base32768](modules.md#base32768)
131
+ - [defaultTemplateFormat](modules.md#defaulttemplateformat)
132
+ - [event](modules.md#event)
133
+ - [eventClient](modules.md#eventclient)
134
+ - [eventServer](modules.md#eventserver)
135
+ - [isSimilar](modules.md#issimilar)
136
+ - [lrucache](modules.md#lrucache)
137
+ - [mergeSegments](modules.md#mergesegments)
138
+ - [mimeType](modules.md#mimetype)
139
+ - [segments](modules.md#segments)
140
+ - [similarity](modules.md#similarity)
141
+ - [splitSegments](modules.md#splitsegments)
142
+ - [uuidNIL](modules.md#uuidnil)
143
+
144
+ ### Functions
145
+
146
+ - [AIStream](modules.md#aistream)
147
+ - [\_lrucache](modules.md#_lrucache)
148
+ - [backendEventable](modules.md#backendeventable)
149
+ - [canonicalize](modules.md#canonicalize)
150
+ - [canonicalizeEx](modules.md#canonicalizeex)
151
+ - [createCallbacksTransformer](modules.md#createcallbackstransformer)
152
+ - [createEmptyReadableStream](modules.md#createemptyreadablestream)
153
+ - [createEndWithRepetitionDetector](modules.md#createendwithrepetitiondetector)
154
+ - [createError](modules.md#createerror)
155
+ - [createEventStreamTransformer](modules.md#createeventstreamtransformer)
156
+ - [createHfValueFunc](modules.md#createhfvaluefunc)
157
+ - [createLRUCache](modules.md#createlrucache)
158
+ - [expandEnv](modules.md#expandenv)
159
+ - [expandObjEnv](modules.md#expandobjenv)
160
+ - [extNameLevel](modules.md#extnamelevel)
161
+ - [filenameReservedRegex](modules.md#filenamereservedregex-1)
162
+ - [getAllEnumKeys](modules.md#getallenumkeys)
163
+ - [getConfigFileNames](modules.md#getconfigfilenames)
164
+ - [getConfigs](modules.md#getconfigs)
165
+ - [getDefaultSimilarPassingScore](modules.md#getdefaultsimilarpassingscore)
166
+ - [getKeysPath](modules.md#getkeyspath)
167
+ - [getMultiLevelExtname](modules.md#getmultilevelextname)
168
+ - [getResponseErrorReadableStream](modules.md#getresponseerrorreadablestream)
169
+ - [hfParse](modules.md#hfparse)
170
+ - [hfTokenize](modules.md#hftokenize)
171
+ - [interpolateEnv](modules.md#interpolateenv)
172
+ - [interpolateFString](modules.md#interpolatefstring)
173
+ - [interpolateGolangTemplate](modules.md#interpolategolangtemplate)
174
+ - [isModelNameMatched](modules.md#ismodelnamematched)
175
+ - [isValidFilename](modules.md#isvalidfilename)
176
+ - [isValidFilepath](modules.md#isvalidfilepath)
177
+ - [jsonFilterToWhere](modules.md#jsonfiltertowhere)
178
+ - [loadFileFromPaths](modules.md#loadfilefrompaths)
179
+ - [loadTextFromPaths](modules.md#loadtextfrompaths)
180
+ - [parseFString](modules.md#parsefstring)
181
+ - [parseJsJson](modules.md#parsejsjson)
182
+ - [parseYaml](modules.md#parseyaml)
183
+ - [reControlCharsRegex](modules.md#recontrolcharsregex)
184
+ - [readableFromAsyncIterable](modules.md#readablefromasynciterable)
185
+ - [registerCoreTools](modules.md#registercoretools)
186
+ - [registerYamlTag](modules.md#registeryamltag)
187
+ - [sanitizeFilename](modules.md#sanitizefilename)
188
+ - [sanitizeFilepath](modules.md#sanitizefilepath)
189
+ - [saveConfigFile](modules.md#saveconfigfile)
190
+ - [sortedValues](modules.md#sortedvalues)
191
+ - [splitSentence](modules.md#splitsentence)
192
+ - [stringifyYaml](modules.md#stringifyyaml)
193
+ - [throwError](modules.md#throwerror)
194
+ - [trimStartOfStreamHelper](modules.md#trimstartofstreamhelper)
195
+ - [truncTo](modules.md#truncto)
196
+ - [uuid](modules.md#uuid)
197
+ - [uuidParse](modules.md#uuidparse)
198
+ - [uuidStringify](modules.md#uuidstringify)
199
+ - [uuidValidate](modules.md#uuidvalidate)
200
+ - [uuidVersion](modules.md#uuidversion)
201
+ - [uuidv1](modules.md#uuidv1)
202
+ - [uuidv4](modules.md#uuidv4)
203
+ - [uuidv5](modules.md#uuidv5)
204
+ - [wait](modules.md#wait)
205
+ - [xxhash](modules.md#xxhash)
206
+ - [xxhash32](modules.md#xxhash32)
207
+ - [xxhash64](modules.md#xxhash64)
208
+ - [xxhashAsStr](modules.md#xxhashasstr)
209
+
210
+ ## Type Aliases
211
+
212
+ ### AIChatContentPart
213
+
214
+ Ƭ **AIChatContentPart**: [`AIChatContentPartText`](interfaces/AIChatContentPartText.md) \| [`AIChatContentPartImage`](interfaces/AIChatContentPartImage.md)
215
+
216
+ #### Defined in
217
+
218
+ [packages/ai-tool/src/utils/chat.ts:70](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/chat.ts#L70)
219
+
220
+ ___
221
+
222
+ ### AIChatMessageParam
223
+
224
+ Ƭ **AIChatMessageParam**: [`AIChatSystemMessageParam`](interfaces/AIChatSystemMessageParam.md) \| [`AIChatUserMessageParam`](interfaces/AIChatUserMessageParam.md) \| [`AIChatAssistantMessageParam`](interfaces/AIChatAssistantMessageParam.md) \| [`AIChatToolMessageParam`](interfaces/AIChatToolMessageParam.md)
225
+
226
+ #### Defined in
227
+
228
+ [packages/ai-tool/src/utils/chat.ts:40](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/chat.ts#L40)
229
+
230
+ ___
231
+
232
+ ### AIChatRole
233
+
234
+ Ƭ **AIChatRole**: typeof [`AIChatRoles`](modules.md#aichatroles)[`number`] & `string`
235
+
236
+ #### Defined in
237
+
238
+ [packages/ai-tool/src/utils/chat.ts:38](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/chat.ts#L38)
239
+
240
+ ___
241
+
242
+ ### AIMessageType
243
+
244
+ Ƭ **AIMessageType**: typeof [`AIMessageTypes`](modules.md#aimessagetypes)[`number`]
245
+
246
+ #### Defined in
247
+
248
+ [packages/ai-tool/src/utils/chat.ts:32](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/chat.ts#L32)
249
+
250
+ ___
251
+
252
+ ### AIModelNameRule
253
+
254
+ Ƭ **AIModelNameRule**: `string` \| `RegExp` \| [`AIModelNameRuleFn`](modules.md#aimodelnamerulefn)
255
+
256
+ #### Defined in
257
+
258
+ [packages/ai-tool/src/utils/consts.ts:10](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/consts.ts#L10)
259
+
260
+ ___
261
+
262
+ ### AIModelNameRuleFn
263
+
264
+ Ƭ **AIModelNameRuleFn**: (`name`: `string`) => `string` \| `RegExpExecArray` \| `undefined`
265
+
266
+ #### Type declaration
267
+
268
+ ▸ (`name`): `string` \| `RegExpExecArray` \| `undefined`
269
+
270
+ ##### Parameters
271
+
272
+ | Name | Type |
273
+ | :------ | :------ |
274
+ | `name` | `string` |
275
+
276
+ ##### Returns
277
+
278
+ `string` \| `RegExpExecArray` \| `undefined`
279
+
280
+ #### Defined in
281
+
282
+ [packages/ai-tool/src/utils/consts.ts:8](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/consts.ts#L8)
283
+
284
+ ___
285
+
286
+ ### AIModelNameRules
287
+
288
+ Ƭ **AIModelNameRules**: [`AIModelNameRule`](modules.md#aimodelnamerule) \| [`AIModelNameRule`](modules.md#aimodelnamerule)[]
289
+
290
+ #### Defined in
291
+
292
+ [packages/ai-tool/src/utils/consts.ts:11](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/consts.ts#L11)
293
+
294
+ ___
295
+
296
+ ### AITextGenerationFinishReason
297
+
298
+ Ƭ **AITextGenerationFinishReason**: typeof [`AITextGenerationFinishReasons`](modules.md#aitextgenerationfinishreasons)[`number`]
299
+
300
+ #### Defined in
301
+
302
+ [packages/ai-tool/src/utils/chat.ts:10](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/chat.ts#L10)
303
+
304
+ ___
305
+
306
+ ### ActionName
307
+
308
+ Ƭ **ActionName**: typeof [`ActionNames`](modules.md#actionnames)[`number`]
309
+
310
+ #### Defined in
311
+
312
+ [packages/ai-tool/src/utils/consts.ts:6](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/consts.ts#L6)
313
+
314
+ ___
315
+
316
+ ### ErrorCodeType
317
+
318
+ Ƭ **ErrorCodeType**: `number` \| `string`
319
+
320
+ #### Defined in
321
+
322
+ [packages/ai-tool/src/utils/base-error.ts:3](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/base-error.ts#L3)
323
+
324
+ ___
325
+
326
+ ### EventErrorListenerFn
327
+
328
+ Ƭ **EventErrorListenerFn**: (`this`: `Event`, `err`: `Error`, `name`: `string`, ...`args`: `any`) => `any`
329
+
330
+ #### Type declaration
331
+
332
+ ▸ (`this`, `err`, `name`, `...args`): `any`
333
+
334
+ ##### Parameters
335
+
336
+ | Name | Type |
337
+ | :------ | :------ |
338
+ | `this` | `Event` |
339
+ | `err` | `Error` |
340
+ | `name` | `string` |
341
+ | `...args` | `any` |
342
+
343
+ ##### Returns
344
+
345
+ `any`
346
+
347
+ #### Defined in
348
+
349
+ [packages/ai-tool/src/utils/event/event-ability.ts:9](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/event/event-ability.ts#L9)
350
+
351
+ ___
352
+
353
+ ### EventListenerFn
354
+
355
+ Ƭ **EventListenerFn**: (`this`: `Event`, `name`: `string`, ...`args`: `any`) => `any`
356
+
357
+ #### Type declaration
358
+
359
+ ▸ (`this`, `name`, `...args`): `any`
360
+
361
+ ##### Parameters
362
+
363
+ | Name | Type |
364
+ | :------ | :------ |
365
+ | `this` | `Event` |
366
+ | `name` | `string` |
367
+ | `...args` | `any` |
368
+
369
+ ##### Returns
370
+
371
+ `any`
372
+
373
+ #### Defined in
374
+
375
+ [packages/ai-tool/src/utils/event/event-ability.ts:8](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/event/event-ability.ts#L8)
376
+
377
+ ___
378
+
379
+ ### FStringPromptTemplateNode
380
+
381
+ Ƭ **FStringPromptTemplateNode**: \{ `text`: `string` ; `type`: ``"literal"`` } \| \{ `name`: `string` ; `type`: ``"variable"`` }
382
+
383
+ Type that represents a node in a parsed format string. It can be either
384
+ a literal text or a variable name.
385
+
386
+ #### Defined in
387
+
388
+ [packages/ai-tool/src/utils/prompt/template/python.ts:6](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/prompt/template/python.ts#L6)
389
+
390
+ ___
391
+
392
+ ### FuncParamType
393
+
394
+ Ƭ **FuncParamType**: `string`
395
+
396
+ #### Defined in
397
+
398
+ [packages/ai-tool/src/tool-func.ts:5](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/tool-func.ts#L5)
399
+
400
+ ___
401
+
402
+ ### PromptExamples
403
+
404
+ Ƭ **PromptExamples**\<`T`\>: `Iterable`\<`PromiseLike`\<`T`\> \| `T`\> \| `AsyncIterable`\<`T`\>
405
+
406
+ #### Type parameters
407
+
408
+ | Name | Type |
409
+ | :------ | :------ |
410
+ | `T` | `any` |
411
+
412
+ #### Defined in
413
+
414
+ [packages/ai-tool/src/utils/prompt/prompt-example-selector.ts:3](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/prompt/prompt-example-selector.ts#L3)
415
+
416
+ ___
417
+
418
+ ### PromptTemplateType
419
+
420
+ Ƭ **PromptTemplateType**: typeof [`PromptTemplateTypes`](modules.md#prompttemplatetypes)[`number`]
421
+
422
+ #### Defined in
423
+
424
+ [packages/ai-tool/src/utils/prompt/consts.ts:17](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/prompt/consts.ts#L17)
425
+
426
+ ___
427
+
428
+ ### PromptType
429
+
430
+ Ƭ **PromptType**: typeof [`PromptTypes`](modules.md#prompttypes)[`number`]
431
+
432
+ #### Defined in
433
+
434
+ [packages/ai-tool/src/utils/prompt/consts.ts:10](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/prompt/consts.ts#L10)
435
+
436
+ ___
437
+
438
+ ### TFunc
439
+
440
+ Ƭ **TFunc**: (`this`: [`ToolFunc`](classes/ToolFunc.md), ...`params`: `any`[]) => `any`
441
+
442
+ #### Type declaration
443
+
444
+ ▸ (`this`, `...params`): `any`
445
+
446
+ ##### Parameters
447
+
448
+ | Name | Type |
449
+ | :------ | :------ |
450
+ | `this` | [`ToolFunc`](classes/ToolFunc.md) |
451
+ | `...params` | `any`[] |
452
+
453
+ ##### Returns
454
+
455
+ `any`
456
+
457
+ #### Defined in
458
+
459
+ [packages/ai-tool/src/tool-func.ts:18](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/tool-func.ts#L18)
460
+
461
+ ## Variables
462
+
463
+ ### AIChatRoles
464
+
465
+ • `Const` **AIChatRoles**: readonly [``"user"``, ``"assistant"``, ``"system"``, ``"tool"``, ``"tool_calls"``]
466
+
467
+ #### Defined in
468
+
469
+ [packages/ai-tool/src/utils/chat.ts:37](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/chat.ts#L37)
470
+
471
+ ___
472
+
473
+ ### AIMessageTypes
474
+
475
+ • `Const` **AIMessageTypes**: readonly [``"human"``, ``"ai"``, ``"generic"``, ``"system"``, ``"tool"``]
476
+
477
+ #### Defined in
478
+
479
+ [packages/ai-tool/src/utils/chat.ts:31](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/chat.ts#L31)
480
+
481
+ ___
482
+
483
+ ### AITextGenerationFinishReasons
484
+
485
+ • `Const` **AITextGenerationFinishReasons**: readonly [``"stop"``, ``"length"``, ``"content-filter"``, ``"tool-calls"``, ``"abort"``, ``"error"``, ``"other"``, ``null``]
486
+
487
+ #### Defined in
488
+
489
+ [packages/ai-tool/src/utils/chat.ts:1](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/chat.ts#L1)
490
+
491
+ ___
492
+
493
+ ### AbortErrorCode
494
+
495
+ • `Const` **AbortErrorCode**: [`Aborted`](enums/ErrorCode.md#aborted) = `ErrorCode.Aborted`
496
+
497
+ #### Defined in
498
+
499
+ [packages/ai-tool/src/utils/base-error.ts:31](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/base-error.ts#L31)
500
+
501
+ ___
502
+
503
+ ### ActionNames
504
+
505
+ • `Const` **ActionNames**: readonly [``"get"``, ``"post"``, ``"put"``, ``"delete"``, ``"patch"``, ``"list"``, ``"res"``]
506
+
507
+ #### Defined in
508
+
509
+ [packages/ai-tool/src/utils/consts.ts:5](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/consts.ts#L5)
510
+
511
+ ___
512
+
513
+ ### AlreadyExistsErrorCode
514
+
515
+ • `Const` **AlreadyExistsErrorCode**: [`Conflict`](enums/ErrorCode.md#conflict) = `ErrorCode.Conflict`
516
+
517
+ #### Defined in
518
+
519
+ [packages/ai-tool/src/utils/base-error.ts:30](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/base-error.ts#L30)
520
+
521
+ ___
522
+
523
+ ### ClientToolFuncSchema
524
+
525
+ • `Const` **ClientToolFuncSchema**: `Object`
526
+
527
+ #### Type declaration
528
+
529
+ | Name | Type |
530
+ | :------ | :------ |
531
+ | `action` | \{ `type`: `string` = 'string'; `assign`: (`value`: ``"get"`` \| ``"post"`` \| ``"put"`` \| ``"delete"`` \| ``"patch"`` \| ``"list"`` \| ``"res"``, `dest`: `any`, `src?`: `any`, `name?`: `string`, `options?`: `any`) => ``"get"`` \| ``"post"`` \| ``"put"`` \| ``"delete"`` \| ``"patch"`` \| ``"list"`` \| ``"res"`` } |
532
+ | `action.type` | `string` |
533
+ | `action.assign` | [object Object] |
534
+ | `allowExportFunc` | \{ `type`: `string` = 'boolean' } |
535
+ | `allowExportFunc.type` | `string` |
536
+ | `apiRoot` | \{ `type`: `string` = 'string'; `get`: (`this`: `any`) => `any` ; `set`: (`this`: `any`, `value`: `string`) => `void` } |
537
+ | `apiRoot.type` | `string` |
538
+ | `apiRoot.get` | [object Object] |
539
+ | `apiRoot.set` | [object Object] |
540
+ | `fetchOptions` | \{ `type`: `string` = 'object' } |
541
+ | `fetchOptions.type` | `string` |
542
+ | `stream` | \{ `type`: `string` = 'boolean' } |
543
+ | `stream.type` | `string` |
544
+
545
+ #### Defined in
546
+
547
+ [packages/ai-tool/src/client-tools.ts:153](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/client-tools.ts#L153)
548
+
549
+ ___
550
+
551
+ ### EventBusName
552
+
553
+ • `Const` **EventBusName**: ``"event-bus"``
554
+
555
+ #### Defined in
556
+
557
+ [packages/ai-tool/src/utils/event/event-ability.ts:7](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/event/event-ability.ts#L7)
558
+
559
+ ___
560
+
561
+ ### EventName
562
+
563
+ • `Const` **EventName**: ``"event"``
564
+
565
+ #### Defined in
566
+
567
+ [packages/ai-tool/src/utils/event/event-ability.ts:6](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/event/event-ability.ts#L6)
568
+
569
+ ___
570
+
571
+ ### FilenameReservedRegex
572
+
573
+ • `Const` **FilenameReservedRegex**: `RegExp`
574
+
575
+ Regular expression pattern for reserved characters in a filename.
576
+ do not use /g global option here: when the regex is executed multiple times, it will always begin where it left off last time.
577
+
578
+ #### Defined in
579
+
580
+ [packages/ai-tool/src/utils/filename.ts:8](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/filename.ts#L8)
581
+
582
+ ___
583
+
584
+ ### HFBuiltins
585
+
586
+ • `Const` **HFBuiltins**: `Object`
587
+
588
+ #### Type declaration
589
+
590
+ | Name | Type |
591
+ | :------ | :------ |
592
+ | `randomInt` | (`to`: `number`, `from`: `number`) => `number` |
593
+ | `select` | (`obj`: `any`, `index?`: `string` \| `number`) => `any` |
594
+
595
+ #### Defined in
596
+
597
+ [packages/ai-tool/src/utils/prompt/template/jinja/src/builtins.ts:52](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/prompt/template/jinja/src/builtins.ts#L52)
598
+
599
+ ___
600
+
601
+ ### InternalErrorCode
602
+
603
+ • `Const` **InternalErrorCode**: [`InternalError`](enums/ErrorCode.md#internalerror) = `ErrorCode.InternalError`
604
+
605
+ #### Defined in
606
+
607
+ [packages/ai-tool/src/utils/base-error.ts:27](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/base-error.ts#L27)
608
+
609
+ ___
610
+
611
+ ### NotFoundErrorCode
612
+
613
+ • `Const` **NotFoundErrorCode**: [`NotFound`](enums/ErrorCode.md#notfound) = `ErrorCode.NotFound`
614
+
615
+ #### Defined in
616
+
617
+ [packages/ai-tool/src/utils/base-error.ts:29](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/base-error.ts#L29)
618
+
619
+ ___
620
+
621
+ ### NotImplementedErrorCode
622
+
623
+ • `Const` **NotImplementedErrorCode**: [`NotImplemented`](enums/ErrorCode.md#notimplemented) = `ErrorCode.NotImplemented`
624
+
625
+ #### Defined in
626
+
627
+ [packages/ai-tool/src/utils/base-error.ts:28](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/base-error.ts#L28)
628
+
629
+ ___
630
+
631
+ ### PASSING\_SCORE
632
+
633
+ • `Const` **PASSING\_SCORE**: ``0.618``
634
+
635
+ #### Defined in
636
+
637
+ [packages/ai-tool/src/utils/consts.ts:3](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/consts.ts#L3)
638
+
639
+ ___
640
+
641
+ ### PromptTemplateTypes
642
+
643
+ • `Const` **PromptTemplateTypes**: readonly [``"internal"``, ``"hf"``, ``"fill"``]
644
+
645
+ #### Defined in
646
+
647
+ [packages/ai-tool/src/utils/prompt/consts.ts:12](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/prompt/consts.ts#L12)
648
+
649
+ ___
650
+
651
+ ### PromptTypes
652
+
653
+ • `Const` **PromptTypes**: readonly [``"chat"``, ``"char"``, ``"plan"``]
654
+
655
+ Prompt Type
656
+ defaults to `chat`
657
+
658
+ #### Defined in
659
+
660
+ [packages/ai-tool/src/utils/prompt/consts.ts:5](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/prompt/consts.ts#L5)
661
+
662
+ ___
663
+
664
+ ### RStreamErrCode
665
+
666
+ • `Const` **RStreamErrCode**: ``600``
667
+
668
+ #### Defined in
669
+
670
+ [packages/ai-tool/src/utils/stream/error-readable-stream.ts:3](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/stream/error-readable-stream.ts#L3)
671
+
672
+ ___
673
+
674
+ ### RemoteToolFuncSchema
675
+
676
+ • `Const` **RemoteToolFuncSchema**: `Object`
677
+
678
+ #### Type declaration
679
+
680
+ | Name | Type |
681
+ | :------ | :------ |
682
+ | `action` | \{ `type`: `string` = 'string'; `assign`: (`value`: ``"get"`` \| ``"post"`` \| ``"put"`` \| ``"delete"`` \| ``"patch"`` \| ``"list"`` \| ``"res"``, `dest`: `any`, `src?`: `any`, `name?`: `string`, `options?`: `any`) => ``"get"`` \| ``"post"`` \| ``"put"`` \| ``"delete"`` \| ``"patch"`` \| ``"list"`` \| ``"res"`` } |
683
+ | `action.type` | `string` |
684
+ | `action.assign` | [object Object] |
685
+ | `allowExportFunc` | \{ `type`: `string` = 'boolean' } |
686
+ | `allowExportFunc.type` | `string` |
687
+ | `apiRoot` | \{ `type`: `string` = 'string'; `get`: (`this`: `any`) => `any` ; `set`: (`this`: `any`, `value`: `string`) => `void` } |
688
+ | `apiRoot.type` | `string` |
689
+ | `apiRoot.get` | [object Object] |
690
+ | `apiRoot.set` | [object Object] |
691
+ | `fetchOptions` | \{ `type`: `string` = 'object' } |
692
+ | `fetchOptions.type` | `string` |
693
+ | `stream` | \{ `type`: `string` = 'boolean' } |
694
+ | `stream.type` | `string` |
695
+
696
+ #### Defined in
697
+
698
+ [packages/ai-tool/src/utils/consts.ts:13](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/consts.ts#L13)
699
+
700
+ ___
701
+
702
+ ### ResClientToolsSchema
703
+
704
+ • `Const` **ResClientToolsSchema**: `Object`
705
+
706
+ #### Type declaration
707
+
708
+ | Name | Type |
709
+ | :------ | :------ |
710
+ | `methods` | \{ `type`: `string` = 'array'; `assign`: (`value`: `string`[], `dest`: `any`, `src?`: `any`, `name?`: `string`, `options?`: `any`) => `void` } |
711
+ | `methods.type` | `string` |
712
+ | `methods.assign` | [object Object] |
713
+
714
+ #### Defined in
715
+
716
+ [packages/ai-tool/src/res-client-tools.ts:68](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/res-client-tools.ts#L68)
717
+
718
+ ___
719
+
720
+ ### ResServerToolsSchema
721
+
722
+ • `Const` **ResServerToolsSchema**: `Object`
723
+
724
+ #### Type declaration
725
+
726
+ | Name | Type |
727
+ | :------ | :------ |
728
+ | `methods` | \{ `type`: `string` = 'array' } |
729
+ | `methods.type` | `string` |
730
+
731
+ #### Defined in
732
+
733
+ [packages/ai-tool/src/res-server-tools.ts:77](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/res-server-tools.ts#L77)
734
+
735
+ ___
736
+
737
+ ### ResponseRStreamErrCode
738
+
739
+ • `Const` **ResponseRStreamErrCode**: ``601``
740
+
741
+ #### Defined in
742
+
743
+ [packages/ai-tool/src/utils/stream/error-readable-stream.ts:4](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/stream/error-readable-stream.ts#L4)
744
+
745
+ ___
746
+
747
+ ### SSEChannelAlreadyClosedErrCode
748
+
749
+ • `Const` **SSEChannelAlreadyClosedErrCode**: ``498``
750
+
751
+ #### Defined in
752
+
753
+ [packages/ai-tool/src/utils/event/sse-channel.ts:17](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/event/sse-channel.ts#L17)
754
+
755
+ ___
756
+
757
+ ### ServerToolFuncSchema
758
+
759
+ • `Const` **ServerToolFuncSchema**: `Object`
760
+
761
+ #### Type declaration
762
+
763
+ | Name | Type |
764
+ | :------ | :------ |
765
+ | `action` | \{ `type`: `string` = 'string'; `assign`: (`value`: ``"get"`` \| ``"post"`` \| ``"put"`` \| ``"delete"`` \| ``"patch"`` \| ``"list"`` \| ``"res"``, `dest`: `any`, `src?`: `any`, `name?`: `string`, `options?`: `any`) => ``"get"`` \| ``"post"`` \| ``"put"`` \| ``"delete"`` \| ``"patch"`` \| ``"list"`` \| ``"res"`` } |
766
+ | `action.type` | `string` |
767
+ | `action.assign` | [object Object] |
768
+ | `allowExportFunc` | \{ `type`: `string` = 'boolean' } |
769
+ | `allowExportFunc.type` | `string` |
770
+ | `apiRoot` | \{ `type`: `string` = 'string'; `get`: (`this`: `any`) => `any` ; `set`: (`this`: `any`, `value`: `string`) => `void` } |
771
+ | `apiRoot.type` | `string` |
772
+ | `apiRoot.get` | [object Object] |
773
+ | `apiRoot.set` | [object Object] |
774
+ | `fetchOptions` | \{ `type`: `string` = 'object' } |
775
+ | `fetchOptions.type` | `string` |
776
+ | `stream` | \{ `type`: `string` = 'boolean' } |
777
+ | `stream.type` | `string` |
778
+
779
+ #### Defined in
780
+
781
+ [packages/ai-tool/src/server-tools.ts:66](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/server-tools.ts#L66)
782
+
783
+ ___
784
+
785
+ ### ToolFuncSchema
786
+
787
+ • `Const` **ToolFuncSchema**: `Object`
788
+
789
+ #### Type declaration
790
+
791
+ | Name | Type |
792
+ | :------ | :------ |
793
+ | `depends` | \{ `exported`: `boolean` = false; `type`: `string` = 'object' } |
794
+ | `depends.exported` | `boolean` |
795
+ | `depends.type` | `string` |
796
+ | `description` | \{ `type`: `string` = 'string' } |
797
+ | `description.type` | `string` |
798
+ | `func` | \{ `type`: `string` = 'function'; `assign`: (`value`: `string` \| `Function`, `dest`: [`ToolFunc`](classes/ToolFunc.md), `src?`: [`ToolFunc`](classes/ToolFunc.md), `name?`: `string`, `options?`: `any`) => `string` \| `Function` } |
799
+ | `func.type` | `string` |
800
+ | `func.assign` | [object Object] |
801
+ | `name` | \{ `type`: `string` = 'string' } |
802
+ | `name.type` | `string` |
803
+ | `params` | \{ `type`: `string` = 'object' } |
804
+ | `params.type` | `string` |
805
+ | `result` | \{ `type`: `string` = 'any' } |
806
+ | `result.type` | `string` |
807
+ | `setup` | \{ `type`: `string` = 'function' } |
808
+ | `setup.type` | `string` |
809
+ | `tags` | \{ `type`: `string`[] } |
810
+ | `tags.type` | `string`[] |
811
+
812
+ #### Defined in
813
+
814
+ [packages/ai-tool/src/tool-func.ts:305](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/tool-func.ts#L305)
815
+
816
+ ___
817
+
818
+ ### WindowsReservedNameRegex
819
+
820
+ • `Const` **WindowsReservedNameRegex**: `RegExp`
821
+
822
+ Regular expression pattern for reserved names on Windows systems.
823
+
824
+ #### Defined in
825
+
826
+ [packages/ai-tool/src/utils/filename.ts:13](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/filename.ts#L13)
827
+
828
+ ___
829
+
830
+ ### base32768
831
+
832
+ • `Const` **base32768**: `__module` = `_base32768`
833
+
834
+ #### Defined in
835
+
836
+ [packages/ai-tool/src/utils/hash/xxhash.ts:5](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/hash/xxhash.ts#L5)
837
+
838
+ ___
839
+
840
+ ### defaultTemplateFormat
841
+
842
+ • `Const` **defaultTemplateFormat**: ``"default"``
843
+
844
+ #### Defined in
845
+
846
+ [packages/ai-tool/src/utils/prompt/prompt-template.ts:8](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/prompt/prompt-template.ts#L8)
847
+
848
+ ___
849
+
850
+ ### event
851
+
852
+ • `Const` **event**: [`EventToolFunc`](classes/EventToolFunc.md)
853
+
854
+ #### Defined in
855
+
856
+ [packages/ai-tool/src/funcs/event.ts:22](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/funcs/event.ts#L22)
857
+
858
+ ___
859
+
860
+ ### eventClient
861
+
862
+ • `Const` **eventClient**: [`EventClient`](classes/EventClient.md)
863
+
864
+ #### Defined in
865
+
866
+ [packages/ai-tool/src/funcs/event-client.ts:180](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/funcs/event-client.ts#L180)
867
+
868
+ ___
869
+
870
+ ### eventServer
871
+
872
+ • `Const` **eventServer**: [`EventServer`](classes/EventServer.md)
873
+
874
+ #### Defined in
875
+
876
+ [packages/ai-tool/src/funcs/event-server.ts:133](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/funcs/event-server.ts#L133)
877
+
878
+ ___
879
+
880
+ ### isSimilar
881
+
882
+ • `Const` **isSimilar**: [`ServerTools`](classes/ServerTools.md)
883
+
884
+ #### Defined in
885
+
886
+ [packages/ai-tool/src/funcs/is-similar.ts:33](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/funcs/is-similar.ts#L33)
887
+
888
+ ___
889
+
890
+ ### lrucache
891
+
892
+ • `Const` **lrucache**: [`ToolFunc`](classes/ToolFunc.md)
893
+
894
+ #### Defined in
895
+
896
+ [packages/ai-tool/src/funcs/lrucache.ts:40](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/funcs/lrucache.ts#L40)
897
+
898
+ ___
899
+
900
+ ### mergeSegments
901
+
902
+ • `Const` **mergeSegments**: [`ServerTools`](classes/ServerTools.md)
903
+
904
+ #### Defined in
905
+
906
+ [packages/ai-tool/src/funcs/merge-segments.ts:34](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/funcs/merge-segments.ts#L34)
907
+
908
+ ___
909
+
910
+ ### mimeType
911
+
912
+ • `Const` **mimeType**: `MimeType`
913
+
914
+ #### Defined in
915
+
916
+ node_modules/.pnpm/mime-type@5.0.0-alpha.1/node_modules/mime-type/src/with-db.d.ts:3
917
+
918
+ ___
919
+
920
+ ### segments
921
+
922
+ • `Const` **segments**: [`ServerTools`](classes/ServerTools.md)
923
+
924
+ #### Defined in
925
+
926
+ [packages/ai-tool/src/funcs/segments.ts:15](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/funcs/segments.ts#L15)
927
+
928
+ ___
929
+
930
+ ### similarity
931
+
932
+ • `Const` **similarity**: [`ServerTools`](classes/ServerTools.md)
933
+
934
+ #### Defined in
935
+
936
+ [packages/ai-tool/src/funcs/similarity.ts:47](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/funcs/similarity.ts#L47)
937
+
938
+ ___
939
+
940
+ ### splitSegments
941
+
942
+ • `Const` **splitSegments**: [`ServerTools`](classes/ServerTools.md)
943
+
944
+ #### Defined in
945
+
946
+ [packages/ai-tool/src/funcs/split-segments.ts:41](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/funcs/split-segments.ts#L41)
947
+
948
+ ___
949
+
950
+ ### uuidNIL
951
+
952
+ • `Const` **uuidNIL**: `NIL`
953
+
954
+ #### Defined in
955
+
956
+ node_modules/.pnpm/@types+uuid@9.0.8/node_modules/@types/uuid/index.d.ts:78
957
+
958
+ ## Functions
959
+
960
+ ### AIStream
961
+
962
+ ▸ **AIStream**\<`T`, `TOptions`\>(`response`, `customParser?`): `ReadableStream`\<[`AIResult`](interfaces/AIResult.md)\<`T`, `TOptions`\>\>
963
+
964
+ Returns a ReadableStream created from the response, parsed and handled with custom logic.
965
+ The stream goes through two transformation stages, first parsing the events and then
966
+ invoking the provided callbacks.
967
+
968
+ For 2xx HTTP responses:
969
+ - The function continues with standard stream processing.
970
+
971
+ For non-2xx HTTP responses:
972
+ - If the response body is defined, it asynchronously extracts and decodes the response body.
973
+ - It then creates a custom ReadableStream to propagate a detailed error message.
974
+
975
+ #### Type parameters
976
+
977
+ | Name | Type |
978
+ | :------ | :------ |
979
+ | `T` | `any` |
980
+ | `TOptions` | `any` |
981
+
982
+ #### Parameters
983
+
984
+ | Name | Type | Description |
985
+ | :------ | :------ | :------ |
986
+ | `response` | `Response` | The response. |
987
+ | `customParser?` | [`AIStreamParser`](interfaces/AIStreamParser.md)\<`T`, `TOptions`\> | The custom parser function. |
988
+
989
+ #### Returns
990
+
991
+ `ReadableStream`\<[`AIResult`](interfaces/AIResult.md)\<`T`, `TOptions`\>\>
992
+
993
+ The AIStream.
994
+
995
+ **`Throws`**
996
+
997
+ Will throw an error if the response is not OK.
998
+
999
+ #### Defined in
1000
+
1001
+ [packages/ai-tool/src/utils/stream/ai-stream.ts:207](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/stream/ai-stream.ts#L207)
1002
+
1003
+ ___
1004
+
1005
+ ### \_lrucache
1006
+
1007
+ ▸ **_lrucache**(`this`, `«destructured»?`): `_Cache`
1008
+
1009
+ #### Parameters
1010
+
1011
+ | Name | Type |
1012
+ | :------ | :------ |
1013
+ | `this` | [`ToolFunc`](classes/ToolFunc.md) |
1014
+ | `«destructured»` | `Object` |
1015
+ | › `key?` | `string` |
1016
+ | › `options?` | `number` \| `ICacheOptions` |
1017
+ | › `value?` | `any` |
1018
+
1019
+ #### Returns
1020
+
1021
+ `_Cache`
1022
+
1023
+ #### Defined in
1024
+
1025
+ [packages/ai-tool/src/funcs/lrucache.ts:6](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/funcs/lrucache.ts#L6)
1026
+
1027
+ ___
1028
+
1029
+ ### backendEventable
1030
+
1031
+ ▸ **backendEventable**(`targetClass`, `options?`): `Function`
1032
+
1033
+ #### Parameters
1034
+
1035
+ | Name | Type |
1036
+ | :------ | :------ |
1037
+ | `targetClass` | `Function` |
1038
+ | `options?` | `AbilityOptions` |
1039
+
1040
+ #### Returns
1041
+
1042
+ `Function`
1043
+
1044
+ #### Defined in
1045
+
1046
+ [packages/ai-tool/src/utils/event/event-ability.ts:80](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/event/event-ability.ts#L80)
1047
+
1048
+ ___
1049
+
1050
+ ### canonicalize
1051
+
1052
+ ▸ **canonicalize**(`obj`): `string`
1053
+
1054
+ #### Parameters
1055
+
1056
+ | Name | Type |
1057
+ | :------ | :------ |
1058
+ | `obj` | `any` |
1059
+
1060
+ #### Returns
1061
+
1062
+ `string`
1063
+
1064
+ #### Defined in
1065
+
1066
+ node_modules/.pnpm/json-canonicalize@1.0.6/node_modules/json-canonicalize/types/canonicalize.d.ts:1
1067
+
1068
+ ___
1069
+
1070
+ ### canonicalizeEx
1071
+
1072
+ ▸ **canonicalizeEx**(`obj`, `options?`): `string`
1073
+
1074
+ #### Parameters
1075
+
1076
+ | Name | Type |
1077
+ | :------ | :------ |
1078
+ | `obj` | `any` |
1079
+ | `options?` | [`IOptions`](interfaces/IOptions.md) |
1080
+
1081
+ #### Returns
1082
+
1083
+ `string`
1084
+
1085
+ #### Defined in
1086
+
1087
+ node_modules/.pnpm/json-canonicalize@1.0.6/node_modules/json-canonicalize/types/canonicalize-ex.d.ts:5
1088
+
1089
+ ___
1090
+
1091
+ ### createCallbacksTransformer
1092
+
1093
+ ▸ **createCallbacksTransformer**(`cb`): `TransformStream`\<[`AIResult`](interfaces/AIResult.md), `Uint8Array`\>
1094
+
1095
+ Creates a transform stream that encodes input messages and invokes optional callback functions.
1096
+ The transform stream uses the provided callbacks to execute custom logic at different stages of the stream's lifecycle.
1097
+ - `onStart`: Called once when the stream is initialized.
1098
+ - `onToken`: Called for each tokenized message.
1099
+ - `onCompletion`: Called every time an AIStream completion message is received. This can occur multiple times when using e.g. OpenAI functions
1100
+ - `onFinal`: Called once when the stream is closed with the final completion message.
1101
+
1102
+ This function is useful when you want to process a stream of messages and perform specific actions during the stream's lifecycle.
1103
+
1104
+ #### Parameters
1105
+
1106
+ | Name | Type |
1107
+ | :------ | :------ |
1108
+ | `cb` | `undefined` \| [`AIStreamCallbacksAndOptions`](interfaces/AIStreamCallbacksAndOptions.md) |
1109
+
1110
+ #### Returns
1111
+
1112
+ `TransformStream`\<[`AIResult`](interfaces/AIResult.md), `Uint8Array`\>
1113
+
1114
+ A transform stream that encodes input messages as Uint8Array and allows the execution of custom logic through callbacks.
1115
+
1116
+ **`Example`**
1117
+
1118
+ ```ts
1119
+ const callbacks = {
1120
+ onStart: async () => console.log('Stream started'),
1121
+ onToken: async (token) => console.log(`Token: ${token}`),
1122
+ onCompletion: async (completion) => console.log(`Completion: ${completion}`)
1123
+ onFinal: async () => data.close()
1124
+ };
1125
+ const transformer = createCallbacksTransformer(callbacks);
1126
+ ```
1127
+
1128
+ #### Defined in
1129
+
1130
+ [packages/ai-tool/src/utils/stream/ai-stream.ts:123](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/stream/ai-stream.ts#L123)
1131
+
1132
+ ___
1133
+
1134
+ ### createEmptyReadableStream
1135
+
1136
+ ▸ **createEmptyReadableStream**(): `ReadableStream`
1137
+
1138
+ Creates an empty ReadableStream that immediately closes upon creation.
1139
+ This function is used as a fallback for creating a ReadableStream when the response body is null or undefined,
1140
+ ensuring that the subsequent pipeline processing doesn't fail due to a lack of a stream.
1141
+
1142
+ #### Returns
1143
+
1144
+ `ReadableStream`
1145
+
1146
+ An empty and closed ReadableStream instance.
1147
+
1148
+ #### Defined in
1149
+
1150
+ [packages/ai-tool/src/utils/stream/create-empty-stream.ts:8](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/stream/create-empty-stream.ts#L8)
1151
+
1152
+ ___
1153
+
1154
+ ### createEndWithRepetitionDetector
1155
+
1156
+ ▸ **createEndWithRepetitionDetector**(`repetitionThreshold`): (`value`: `string`) => `boolean`
1157
+
1158
+ #### Parameters
1159
+
1160
+ | Name | Type |
1161
+ | :------ | :------ |
1162
+ | `repetitionThreshold` | `number` |
1163
+
1164
+ #### Returns
1165
+
1166
+ `fn`
1167
+
1168
+ ▸ (`value`): `boolean`
1169
+
1170
+ ##### Parameters
1171
+
1172
+ | Name | Type |
1173
+ | :------ | :------ |
1174
+ | `value` | `string` |
1175
+
1176
+ ##### Returns
1177
+
1178
+ `boolean`
1179
+
1180
+ #### Defined in
1181
+
1182
+ [packages/ai-tool/src/utils/end-with-repeated-sequence.ts:3](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/end-with-repeated-sequence.ts#L3)
1183
+
1184
+ ___
1185
+
1186
+ ### createError
1187
+
1188
+ ▸ **createError**(`message`, `name?`, `status?`): [`CommonError`](classes/CommonError.md)
1189
+
1190
+ Create an error object
1191
+
1192
+ #### Parameters
1193
+
1194
+ | Name | Type | Default value | Description |
1195
+ | :------ | :------ | :------ | :------ |
1196
+ | `message` | `string` | `undefined` | Error message |
1197
+ | `name?` | `string` \| `Record`\<`string`, `any`\> | `undefined` | Error name, optional |
1198
+ | `status` | `string` \| `number` | `InternalErrorCode` | Error status code, default to 500 |
1199
+
1200
+ #### Returns
1201
+
1202
+ [`CommonError`](classes/CommonError.md)
1203
+
1204
+ Error object
1205
+
1206
+ #### Defined in
1207
+
1208
+ [packages/ai-tool/src/utils/base-error.ts:217](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/base-error.ts#L217)
1209
+
1210
+ ___
1211
+
1212
+ ### createEventStreamTransformer
1213
+
1214
+ ▸ **createEventStreamTransformer**\<`TValue`, `TOptions`\>(`customParser?`): `TransformStream`\<`Uint8Array`, [`AIResult`](interfaces/AIResult.md)\<`TValue`, `TOptions`\>\>
1215
+
1216
+ Creates a TransformStream that parses events from an EventSource stream using a custom parser.
1217
+
1218
+ #### Type parameters
1219
+
1220
+ | Name | Type |
1221
+ | :------ | :------ |
1222
+ | `TValue` | `any` |
1223
+ | `TOptions` | `any` |
1224
+
1225
+ #### Parameters
1226
+
1227
+ | Name | Type | Description |
1228
+ | :------ | :------ | :------ |
1229
+ | `customParser?` | [`AIStreamParser`](interfaces/AIStreamParser.md)\<`any`, `any`\> | Function to handle event data. |
1230
+
1231
+ #### Returns
1232
+
1233
+ `TransformStream`\<`Uint8Array`, [`AIResult`](interfaces/AIResult.md)\<`TValue`, `TOptions`\>\>
1234
+
1235
+ TransformStream parsing events.
1236
+
1237
+ #### Defined in
1238
+
1239
+ [packages/ai-tool/src/utils/stream/ai-stream.ts:61](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/stream/ai-stream.ts#L61)
1240
+
1241
+ ___
1242
+
1243
+ ### createHfValueFunc
1244
+
1245
+ ▸ **createHfValueFunc**(`fn`): (`_data`: `any`) => `Function`
1246
+
1247
+ #### Parameters
1248
+
1249
+ | Name | Type |
1250
+ | :------ | :------ |
1251
+ | `fn` | `Function` |
1252
+
1253
+ #### Returns
1254
+
1255
+ `fn`
1256
+
1257
+ ▸ (`_data`): `Function`
1258
+
1259
+ ##### Parameters
1260
+
1261
+ | Name | Type |
1262
+ | :------ | :------ |
1263
+ | `_data` | `any` |
1264
+
1265
+ ##### Returns
1266
+
1267
+ `Function`
1268
+
1269
+ #### Defined in
1270
+
1271
+ [packages/ai-tool/src/utils/prompt/hf-prompt-template.ts:148](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/prompt/hf-prompt-template.ts#L148)
1272
+
1273
+ ___
1274
+
1275
+ ### createLRUCache
1276
+
1277
+ ▸ **createLRUCache**(`name`, `options?`): [`ToolFunc`](classes/ToolFunc.md)
1278
+
1279
+ #### Parameters
1280
+
1281
+ | Name | Type |
1282
+ | :------ | :------ |
1283
+ | `name` | `string` |
1284
+ | `options?` | `number` \| `ICacheOptions` |
1285
+
1286
+ #### Returns
1287
+
1288
+ [`ToolFunc`](classes/ToolFunc.md)
1289
+
1290
+ #### Defined in
1291
+
1292
+ [packages/ai-tool/src/funcs/lrucache.ts:22](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/funcs/lrucache.ts#L22)
1293
+
1294
+ ___
1295
+
1296
+ ### expandEnv
1297
+
1298
+ ▸ **expandEnv**(`options`): [`DotenvExpandOptions`](interfaces/DotenvExpandOptions.md)
1299
+
1300
+ Expand environment variables in the parsed object
1301
+
1302
+ #### Parameters
1303
+
1304
+ | Name | Type |
1305
+ | :------ | :------ |
1306
+ | `options` | [`DotenvExpandOptions`](interfaces/DotenvExpandOptions.md) |
1307
+
1308
+ #### Returns
1309
+
1310
+ [`DotenvExpandOptions`](interfaces/DotenvExpandOptions.md)
1311
+
1312
+ **`Example`**
1313
+
1314
+ ```ts
1315
+ const myEnv = {}
1316
+ const env = {
1317
+ processEnv: myEnv,
1318
+ parsed: {
1319
+ WORD: 'World',
1320
+ HELLO: 'Hello ${WORD}'
1321
+ }
1322
+ }
1323
+ expandEnv.expand(env)
1324
+
1325
+ console.log(myEnv.HELLO) // Hello World
1326
+ console.log(process.env.HELLO) // undefined
1327
+ ```
1328
+
1329
+ #### Defined in
1330
+
1331
+ [packages/ai-tool/src/utils/prompt/template/env.ts:82](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/prompt/template/env.ts#L82)
1332
+
1333
+ ___
1334
+
1335
+ ### expandObjEnv
1336
+
1337
+ ▸ **expandObjEnv**(`obj`, `options?`, `parsedObjs?`): `any`
1338
+
1339
+ Expands environment variables in an object/array or string.
1340
+
1341
+ This function replaces placeholders like `${VAR}` in strings and recursively
1342
+ processes objects and arrays with environment variable references.
1343
+
1344
+ #### Parameters
1345
+
1346
+ | Name | Type | Description |
1347
+ | :------ | :------ | :------ |
1348
+ | `obj` | `any` | The object/array or string to be processed. Can be any value, but primarily designed for objects, array and strings. |
1349
+ | `options` | [`DotenvExpandOptions`](interfaces/DotenvExpandOptions.md) | Configuration options: - processEnv: - An object to source environment variables from, defaults to `process.env`. - parsed: - Specify an object to provide the value of environment variables. |
1350
+ | `parsedObjs?` | `WeakSet`\<`any`\> | - |
1351
+
1352
+ #### Returns
1353
+
1354
+ `any`
1355
+
1356
+ - Returns the expanded object or string.
1357
+
1358
+ **`Example`**
1359
+
1360
+ ```ts
1361
+ const obj = {
1362
+ name: 'MyApp',
1363
+ envVar: '${ENV_VAR_NAME}',
1364
+ config: {
1365
+ url: 'http://${HOST}:${PORT}'
1366
+ },
1367
+ list: ['item1', '${ITEM2}']
1368
+ };
1369
+ // the expandedObj will have the actual values instead of placeholders.
1370
+ const expandedObj = expandObjEnv(obj, { processEnv: myCustomEnv }); // Assuming 'ENV_VAR_NAME' is defined as 'Production' and 'HOST', 'PORT', 'ITEM2' are set,
1371
+ ```
1372
+
1373
+ #### Defined in
1374
+
1375
+ [packages/ai-tool/src/utils/prompt/template/env.ts:142](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/prompt/template/env.ts#L142)
1376
+
1377
+ ___
1378
+
1379
+ ### extNameLevel
1380
+
1381
+ ▸ **extNameLevel**(`extName`): `number`
1382
+
1383
+ Calculates the level of an extension name.
1384
+
1385
+ The level represents the number of dots ('.') in the extension name, excluding the first dot which separates
1386
+ the base filename from the extension. For example, the level of ".txt" is 1, and the level of ".tar.gz" is 2.
1387
+
1388
+ #### Parameters
1389
+
1390
+ | Name | Type | Description |
1391
+ | :------ | :------ | :------ |
1392
+ | `extName` | `string` | The extension name to analyze. It should start with a dot ('.'). |
1393
+
1394
+ #### Returns
1395
+
1396
+ `number`
1397
+
1398
+ The level of the extension name, which is the count of dots minus one.
1399
+
1400
+ **`Example`**
1401
+
1402
+ ```typescript
1403
+ // Returns 0
1404
+ extNameLevel("no-file-ext");
1405
+
1406
+ // Returns 2
1407
+ extNameLevel(".tar.gz");
1408
+
1409
+ // Returns 1
1410
+ extNameLevel(".json5");
1411
+ ```
1412
+
1413
+ #### Defined in
1414
+
1415
+ [packages/ai-tool/src/utils/filename.ts:209](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/filename.ts#L209)
1416
+
1417
+ ___
1418
+
1419
+ ### filenameReservedRegex
1420
+
1421
+ ▸ **filenameReservedRegex**(): `RegExp`
1422
+
1423
+ Returns a new regular expression instance for reserved filename characters with the 'g' flag.
1424
+ use this to reset the with global option
1425
+
1426
+ #### Returns
1427
+
1428
+ `RegExp`
1429
+
1430
+ A compiled regular expression for reserved filename characters.
1431
+
1432
+ #### Defined in
1433
+
1434
+ [packages/ai-tool/src/utils/filename.ts:42](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/filename.ts#L42)
1435
+
1436
+ ___
1437
+
1438
+ ### getAllEnumKeys
1439
+
1440
+ ▸ **getAllEnumKeys**\<`T`\>(`enumType`): keyof typeof `enumType`[]
1441
+
1442
+ Retrieves all string keys from the given enumeration(number).
1443
+
1444
+ #### Type parameters
1445
+
1446
+ | Name | Type |
1447
+ | :------ | :------ |
1448
+ | `T` | extends `object` |
1449
+
1450
+ #### Parameters
1451
+
1452
+ | Name | Type | Description |
1453
+ | :------ | :------ | :------ |
1454
+ | `enumType` | `T` | The enumeration type with numeric values for which to retrieve keys. |
1455
+
1456
+ #### Returns
1457
+
1458
+ keyof typeof `enumType`[]
1459
+
1460
+ An array containing all string keys of the specified enumeration.
1461
+
1462
+ #### Defined in
1463
+
1464
+ [packages/ai-tool/src/utils/get-all-enum-keys.ts:7](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/get-all-enum-keys.ts#L7)
1465
+
1466
+ ___
1467
+
1468
+ ### getConfigFileNames
1469
+
1470
+ ▸ **getConfigFileNames**(`directoryPath`): `string`[]
1471
+
1472
+ #### Parameters
1473
+
1474
+ | Name | Type |
1475
+ | :------ | :------ |
1476
+ | `directoryPath` | `string` |
1477
+
1478
+ #### Returns
1479
+
1480
+ `string`[]
1481
+
1482
+ #### Defined in
1483
+
1484
+ [packages/ai-tool/src/utils/config.ts:50](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/config.ts#L50)
1485
+
1486
+ ___
1487
+
1488
+ ### getConfigs
1489
+
1490
+ ▸ **getConfigs**(`directoryPath`): `any`[]
1491
+
1492
+ #### Parameters
1493
+
1494
+ | Name | Type |
1495
+ | :------ | :------ |
1496
+ | `directoryPath` | `string` |
1497
+
1498
+ #### Returns
1499
+
1500
+ `any`[]
1501
+
1502
+ #### Defined in
1503
+
1504
+ [packages/ai-tool/src/utils/config.ts:63](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/config.ts#L63)
1505
+
1506
+ ___
1507
+
1508
+ ### getDefaultSimilarPassingScore
1509
+
1510
+ ▸ **getDefaultSimilarPassingScore**(`modelId`): `number`
1511
+
1512
+ #### Parameters
1513
+
1514
+ | Name | Type |
1515
+ | :------ | :------ |
1516
+ | `modelId` | `string` |
1517
+
1518
+ #### Returns
1519
+
1520
+ `number`
1521
+
1522
+ #### Defined in
1523
+
1524
+ [packages/ai-tool/src/funcs/is-similar.ts:7](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/funcs/is-similar.ts#L7)
1525
+
1526
+ ___
1527
+
1528
+ ### getKeysPath
1529
+
1530
+ ▸ **getKeysPath**\<`TValue`\>(`value`): `string`[]
1531
+
1532
+ Retrieves an array of all key paths as strings for a nested object or array.
1533
+
1534
+ #### Type parameters
1535
+
1536
+ | Name | Type |
1537
+ | :------ | :------ |
1538
+ | `TValue` | extends `object` |
1539
+
1540
+ #### Parameters
1541
+
1542
+ | Name | Type | Description |
1543
+ | :------ | :------ | :------ |
1544
+ | `value` | `TValue` | The object or array to extract the paths from. |
1545
+
1546
+ #### Returns
1547
+
1548
+ `string`[]
1549
+
1550
+ - An array of strings containing all the key paths.
1551
+
1552
+ **`Example`**
1553
+
1554
+ ```
1555
+ const obj = { a: { b: { c: 1 } }, d: [0, { e: 2 }] };
1556
+ console.log(getKeysPath(obj)); // Output: ['a.b.c', 'd[0]', 'd[1].e']
1557
+ ```
1558
+
1559
+ #### Defined in
1560
+
1561
+ [packages/ai-tool/src/utils/get-keys-path.ts:16](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/get-keys-path.ts#L16)
1562
+
1563
+ ___
1564
+
1565
+ ### getMultiLevelExtname
1566
+
1567
+ ▸ **getMultiLevelExtname**(`filename`, `level?`): `string`
1568
+
1569
+ Retrieves multi-level file extension
1570
+
1571
+ #### Parameters
1572
+
1573
+ | Name | Type | Default value | Description |
1574
+ | :------ | :------ | :------ | :------ |
1575
+ | `filename` | `string` | `undefined` | The file name |
1576
+ | `level` | `number` | `1` | The level, default is 1, indicating the number of extension levels to retrieve |
1577
+
1578
+ #### Returns
1579
+
1580
+ `string`
1581
+
1582
+ Returns a concatenated string of multiple extensions, or an empty string if no extension is found
1583
+
1584
+ #### Defined in
1585
+
1586
+ [packages/ai-tool/src/utils/filename.ts:174](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/filename.ts#L174)
1587
+
1588
+ ___
1589
+
1590
+ ### getResponseErrorReadableStream
1591
+
1592
+ ▸ **getResponseErrorReadableStream**(`body?`): `ReadableStream`\<`any`\>
1593
+
1594
+ #### Parameters
1595
+
1596
+ | Name | Type |
1597
+ | :------ | :------ |
1598
+ | `body?` | ``null`` \| `ReadableStream`\<`Uint8Array`\> |
1599
+
1600
+ #### Returns
1601
+
1602
+ `ReadableStream`\<`any`\>
1603
+
1604
+ #### Defined in
1605
+
1606
+ [packages/ai-tool/src/utils/stream/error-readable-stream.ts:12](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/stream/error-readable-stream.ts#L12)
1607
+
1608
+ ___
1609
+
1610
+ ### hfParse
1611
+
1612
+ ▸ **hfParse**(`tokens`): `Program`
1613
+
1614
+ Generate the Abstract Syntax Tree (AST) from a list of tokens.
1615
+ Operator precedence can be found here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_precedence#table
1616
+
1617
+ #### Parameters
1618
+
1619
+ | Name | Type |
1620
+ | :------ | :------ |
1621
+ | `tokens` | `Token`[] |
1622
+
1623
+ #### Returns
1624
+
1625
+ `Program`
1626
+
1627
+ #### Defined in
1628
+
1629
+ [packages/ai-tool/src/utils/prompt/template/jinja/src/parser.ts:30](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/prompt/template/jinja/src/parser.ts#L30)
1630
+
1631
+ ___
1632
+
1633
+ ### hfTokenize
1634
+
1635
+ ▸ **hfTokenize**(`source`, `options?`): `Token`[]
1636
+
1637
+ Generate a list of tokens from a source string.
1638
+
1639
+ #### Parameters
1640
+
1641
+ | Name | Type |
1642
+ | :------ | :------ |
1643
+ | `source` | `string` |
1644
+ | `options` | `PreprocessOptions` |
1645
+
1646
+ #### Returns
1647
+
1648
+ `Token`[]
1649
+
1650
+ #### Defined in
1651
+
1652
+ [packages/ai-tool/src/utils/prompt/template/jinja/src/lexer.ts:189](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/prompt/template/jinja/src/lexer.ts#L189)
1653
+
1654
+ ___
1655
+
1656
+ ### interpolateEnv
1657
+
1658
+ ▸ **interpolateEnv**(`value`, `processEnv`, `parsed`): `any`
1659
+
1660
+ #### Parameters
1661
+
1662
+ | Name | Type |
1663
+ | :------ | :------ |
1664
+ | `value` | `string` |
1665
+ | `processEnv` | `any` |
1666
+ | `parsed` | `any` |
1667
+
1668
+ #### Returns
1669
+
1670
+ `any`
1671
+
1672
+ #### Defined in
1673
+
1674
+ [packages/ai-tool/src/utils/prompt/template/env.ts:17](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/prompt/template/env.ts#L17)
1675
+
1676
+ ___
1677
+
1678
+ ### interpolateFString
1679
+
1680
+ ▸ **interpolateFString**(`nodes`, `values`): `string`
1681
+
1682
+ Type that represents a function that takes a template string and a set
1683
+ of input values, and returns a string where all variables in the
1684
+ template have been replaced with their corresponding values.
1685
+
1686
+ #### Parameters
1687
+
1688
+ | Name | Type |
1689
+ | :------ | :------ |
1690
+ | `nodes` | [`FStringPromptTemplateNode`](modules.md#fstringprompttemplatenode)[] |
1691
+ | `values` | `Record`\<`string`, `any`\> |
1692
+
1693
+ #### Returns
1694
+
1695
+ `string`
1696
+
1697
+ #### Defined in
1698
+
1699
+ [packages/ai-tool/src/utils/prompt/template/python.ts:71](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/prompt/template/python.ts#L71)
1700
+
1701
+ ___
1702
+
1703
+ ### interpolateGolangTemplate
1704
+
1705
+ ▸ **interpolateGolangTemplate**(`str`, `variables`, `initVars?`): `string`
1706
+
1707
+ Parse and interpolate template
1708
+
1709
+ #### Parameters
1710
+
1711
+ | Name | Type | Description |
1712
+ | :------ | :------ | :------ |
1713
+ | `str` | `string` | golang style template |
1714
+ | `variables` | `Record`\<`string`, `any`\> | object of variables to insert |
1715
+ | `initVars?` | `boolean` | - |
1716
+
1717
+ #### Returns
1718
+
1719
+ `string`
1720
+
1721
+ #### Defined in
1722
+
1723
+ [packages/ai-tool/src/utils/prompt/template/golang.ts:269](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/prompt/template/golang.ts#L269)
1724
+
1725
+ ___
1726
+
1727
+ ### isModelNameMatched
1728
+
1729
+ ▸ **isModelNameMatched**(`modelName`, `rule?`): `undefined` \| `string` \| `RegExpExecArray`
1730
+
1731
+ Checks if the provided model name matches the given rule.
1732
+
1733
+ #### Parameters
1734
+
1735
+ | Name | Type | Description |
1736
+ | :------ | :------ | :------ |
1737
+ | `modelName` | `string` | The name of the model to check. |
1738
+ | `rule?` | [`AIModelNameRules`](modules.md#aimodelnamerules) | An optional rule that can be a string, an array of strings, a regular expression, or a function. |
1739
+
1740
+ #### Returns
1741
+
1742
+ `undefined` \| `string` \| `RegExpExecArray`
1743
+
1744
+ matched result if the model name matches the rule, undefined otherwise.
1745
+
1746
+ **`Example`**
1747
+
1748
+ ```ts
1749
+ IsModelNameMatched("gpt-3", "gpt-3") // returns true
1750
+ IsModelNameMatched("GPT-3", "gpt-3") // returns true
1751
+ IsModelNameMatched("GPT-3", ["gpt-3", "gpt-4"]) // returns true
1752
+ IsModelNameMatched("gpt-3", /^gpt-\d+$/) // returns true
1753
+ IsModelNameMatched("gpt-3", (modelName) => modelName.startsWith("gpt-")) // returns true
1754
+ IsModelNameMatched("gpt-2", "gpt-3") // returns false
1755
+ IsModelNameMatched("gpt-2", ["gpt-3", "gpt-4"]) // returns false
1756
+ IsModelNameMatched("gpt-2", /^gpt-\d+$/) // returns false
1757
+ IsModelNameMatched("gpt-2", (modelName) => modelName.startsWith("gpt-")) // returns false
1758
+ ```
1759
+
1760
+ #### Defined in
1761
+
1762
+ [packages/ai-tool/src/utils/is-model-name-matched.ts:21](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/is-model-name-matched.ts#L21)
1763
+
1764
+ ___
1765
+
1766
+ ### isValidFilename
1767
+
1768
+ ▸ **isValidFilename**(`filename`): `boolean` \| ``""``
1769
+
1770
+ Validates if a given string is a valid filename.
1771
+
1772
+ #### Parameters
1773
+
1774
+ | Name | Type | Description |
1775
+ | :------ | :------ | :------ |
1776
+ | `filename` | `string` | The filename to be validated. |
1777
+
1778
+ #### Returns
1779
+
1780
+ `boolean` \| ``""``
1781
+
1782
+ True if the filename is valid, false otherwise.
1783
+
1784
+ **`Throws`**
1785
+
1786
+ If the input is not a string.
1787
+
1788
+ **`Example`**
1789
+
1790
+ ```ts
1791
+ isValidFilename('myFile.txt'); // Returns true
1792
+ isValidFilename('my<file.txt'); // Returns false
1793
+ ```
1794
+
1795
+ #### Defined in
1796
+
1797
+ [packages/ai-tool/src/utils/filename.ts:63](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/filename.ts#L63)
1798
+
1799
+ ___
1800
+
1801
+ ### isValidFilepath
1802
+
1803
+ ▸ **isValidFilepath**(`filepath`): `boolean`
1804
+
1805
+ Validates whether the given filepath is valid.
1806
+
1807
+ #### Parameters
1808
+
1809
+ | Name | Type | Description |
1810
+ | :------ | :------ | :------ |
1811
+ | `filepath` | `string` | The filepath to be checked, represented as a string. |
1812
+
1813
+ #### Returns
1814
+
1815
+ `boolean`
1816
+
1817
+ A boolean indicating whether the filepath is valid. Returns true if valid; false otherwise.
1818
+
1819
+ #### Defined in
1820
+
1821
+ [packages/ai-tool/src/utils/filename.ts:72](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/filename.ts#L72)
1822
+
1823
+ ___
1824
+
1825
+ ### jsonFilterToWhere
1826
+
1827
+ ▸ **jsonFilterToWhere**(`filter`, `wrapKey?`): `string`
1828
+
1829
+ Converts a filter object to a SQLite WHERE clause.
1830
+
1831
+ #### Parameters
1832
+
1833
+ | Name | Type | Description |
1834
+ | :------ | :------ | :------ |
1835
+ | `filter` | [`JsonFilter`](interfaces/JsonFilter.md) \| [`JsonFilter`](interfaces/JsonFilter.md)[] | The filter object to convert. |
1836
+ | `wrapKey?` | (`k`: `string`) => `string` | - |
1837
+
1838
+ #### Returns
1839
+
1840
+ `string`
1841
+
1842
+ The generated WHERE clause.
1843
+
1844
+ **`Example`**
1845
+
1846
+ ```ts
1847
+ const jsonFilter: Filter = {
1848
+ $and: [
1849
+ { age: { $gt: 18, $lt: 30 } },
1850
+ { name: { $like: 'John%', $nlike: 'Doe%' } },
1851
+ { hobbies: { $in: ['reading', 'writing'] } },
1852
+ { $or: [{ gender: 'male' }, { country: 'USA' }] },
1853
+ { $and: [{ status: 'active' }, { registered: new Date('2020-01-01') }] },
1854
+ ],
1855
+ };
1856
+
1857
+ console.log(jsonFilterToWhere(jsonFilter)); // Outputs a WHERE clause based on the given filter
1858
+ ```
1859
+
1860
+ #### Defined in
1861
+
1862
+ [packages/ai-tool/src/utils/json-filter.ts:118](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/json-filter.ts#L118)
1863
+
1864
+ ___
1865
+
1866
+ ### loadFileFromPaths
1867
+
1868
+ ▸ **loadFileFromPaths**(`filename`, `searchPaths?`, `extNames?`): `Buffer`
1869
+
1870
+ Loads a file from given paths, optionally searching for specific extensions.
1871
+
1872
+ #### Parameters
1873
+
1874
+ | Name | Type | Description |
1875
+ | :------ | :------ | :------ |
1876
+ | `filename` | `string` | The base filename to search for, without any file extension. |
1877
+ | `searchPaths?` | `string`[] | An array of directories to search for the file. Defaults to the current directory (`"."`) if not provided. |
1878
+ | `extNames?` | `string`[] | An array of file extensions to try, in order of preference. If not provided, the file will be searched for without any extension. |
1879
+
1880
+ #### Returns
1881
+
1882
+ `Buffer`
1883
+
1884
+ The contents of the found file as a Buffer.
1885
+
1886
+ **`Throws`**
1887
+
1888
+ If the file is not found in any of the search paths.
1889
+
1890
+ **`Example`**
1891
+
1892
+ ```typescript
1893
+ const content = loadFileFromPaths('config', ['/etc', '/usr/local/etc'], ['.json', '.yaml']);
1894
+ ```
1895
+
1896
+ #### Defined in
1897
+
1898
+ [packages/ai-tool/src/utils/load-file-from-paths.ts:22](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/load-file-from-paths.ts#L22)
1899
+
1900
+ ___
1901
+
1902
+ ### loadTextFromPaths
1903
+
1904
+ ▸ **loadTextFromPaths**(`filename`, `searchPaths?`, `extNames?`, `encoding?`): `string`
1905
+
1906
+ #### Parameters
1907
+
1908
+ | Name | Type | Default value |
1909
+ | :------ | :------ | :------ |
1910
+ | `filename` | `string` | `undefined` |
1911
+ | `searchPaths?` | `string`[] | `undefined` |
1912
+ | `extNames?` | `string`[] | `undefined` |
1913
+ | `encoding` | `BufferEncoding` | `'utf8'` |
1914
+
1915
+ #### Returns
1916
+
1917
+ `string`
1918
+
1919
+ #### Defined in
1920
+
1921
+ [packages/ai-tool/src/utils/load-file-from-paths.ts:63](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/load-file-from-paths.ts#L63)
1922
+
1923
+ ___
1924
+
1925
+ ### parseFString
1926
+
1927
+ ▸ **parseFString**(`template`): [`FStringPromptTemplateNode`](modules.md#fstringprompttemplatenode)[]
1928
+
1929
+ Type that represents a function that takes a template string and
1930
+ returns an array of `ParsedFStringNode`.
1931
+
1932
+ extract from langchain.js/langchain-core/src/prompts/template.ts
1933
+
1934
+ #### Parameters
1935
+
1936
+ | Name | Type |
1937
+ | :------ | :------ |
1938
+ | `template` | `string` |
1939
+
1940
+ #### Returns
1941
+
1942
+ [`FStringPromptTemplateNode`](modules.md#fstringprompttemplatenode)[]
1943
+
1944
+ #### Defined in
1945
+
1946
+ [packages/ai-tool/src/utils/prompt/template/python.ts:16](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/prompt/template/python.ts#L16)
1947
+
1948
+ ___
1949
+
1950
+ ### parseJsJson
1951
+
1952
+ ▸ **parseJsJson**(`input`): `any`
1953
+
1954
+ Parses a JavaScript string into a JSON object.
1955
+
1956
+ #### Parameters
1957
+
1958
+ | Name | Type | Description |
1959
+ | :------ | :------ | :------ |
1960
+ | `input` | `string` | The string to be parsed into JSON. |
1961
+
1962
+ #### Returns
1963
+
1964
+ `any`
1965
+
1966
+ The parsed JSON object. If parsing fails, undefined is returned.
1967
+
1968
+ **`Example`**
1969
+
1970
+ ```ts
1971
+ // This will return a JSON object with key 'name' and value 'John'.
1972
+ const jsonString = '({name: "John"})';
1973
+ const json = parseJsJson(jsonString);
1974
+ console.log(json); // { name: 'John' }
1975
+ ```
1976
+
1977
+ #### Defined in
1978
+
1979
+ [packages/ai-tool/src/utils/parse-js-json.ts:14](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/parse-js-json.ts#L14)
1980
+
1981
+ ___
1982
+
1983
+ ### parseYaml
1984
+
1985
+ ▸ **parseYaml**(`content`): `any`
1986
+
1987
+ #### Parameters
1988
+
1989
+ | Name | Type |
1990
+ | :------ | :------ |
1991
+ | `content` | `string` |
1992
+
1993
+ #### Returns
1994
+
1995
+ `any`
1996
+
1997
+ #### Defined in
1998
+
1999
+ [packages/ai-tool/src/utils/config.ts:25](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/config.ts#L25)
2000
+
2001
+ ___
2002
+
2003
+ ### reControlCharsRegex
2004
+
2005
+ ▸ **reControlCharsRegex**(): `RegExp`
2006
+
2007
+ Returns a new regular expression instance for control characters in a filename with the 'g' flag.
2008
+
2009
+ #### Returns
2010
+
2011
+ `RegExp`
2012
+
2013
+ A compiled regular expression for control characters in a filename.
2014
+
2015
+ #### Defined in
2016
+
2017
+ [packages/ai-tool/src/utils/filename.ts:50](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/filename.ts#L50)
2018
+
2019
+ ___
2020
+
2021
+ ### readableFromAsyncIterable
2022
+
2023
+ ▸ **readableFromAsyncIterable**\<`T`\>(`iterable`): `ReadableStream`\<`T`\>
2024
+
2025
+ Implements ReadableStream.from(asyncIterable), which isn't documented in MDN and isn't implemented in node.
2026
+ https://github.com/whatwg/streams/commit/8d7a0bf26eb2cc23e884ddbaac7c1da4b91cf2bc
2027
+
2028
+ #### Type parameters
2029
+
2030
+ | Name |
2031
+ | :------ |
2032
+ | `T` |
2033
+
2034
+ #### Parameters
2035
+
2036
+ | Name | Type |
2037
+ | :------ | :------ |
2038
+ | `iterable` | `AsyncIterable`\<`T`\> |
2039
+
2040
+ #### Returns
2041
+
2042
+ `ReadableStream`\<`T`\>
2043
+
2044
+ #### Defined in
2045
+
2046
+ [packages/ai-tool/src/utils/stream/ai-stream.ts:251](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/stream/ai-stream.ts#L251)
2047
+
2048
+ ___
2049
+
2050
+ ### registerCoreTools
2051
+
2052
+ ▸ **registerCoreTools**(): `void`
2053
+
2054
+ #### Returns
2055
+
2056
+ `void`
2057
+
2058
+ #### Defined in
2059
+
2060
+ [packages/ai-tool/src/funcs/index.ts:19](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/funcs/index.ts#L19)
2061
+
2062
+ ___
2063
+
2064
+ ### registerYamlTag
2065
+
2066
+ ▸ **registerYamlTag**(`tags`): `void`
2067
+
2068
+ #### Parameters
2069
+
2070
+ | Name | Type |
2071
+ | :------ | :------ |
2072
+ | `tags` | `any` |
2073
+
2074
+ #### Returns
2075
+
2076
+ `void`
2077
+
2078
+ #### Defined in
2079
+
2080
+ [packages/ai-tool/src/utils/config.ts:15](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/config.ts#L15)
2081
+
2082
+ ___
2083
+
2084
+ ### sanitizeFilename
2085
+
2086
+ ▸ **sanitizeFilename**(`filename`, `options?`): `string`
2087
+
2088
+ Sanitizes a given filename by replacing invalid characters with a specified replacement character or a default.
2089
+
2090
+ #### Parameters
2091
+
2092
+ | Name | Type | Description |
2093
+ | :------ | :------ | :------ |
2094
+ | `filename` | `string` | The filename to sanitize, represented as a string. |
2095
+ | `options` | [`SanitizeFilenameOptions`](interfaces/SanitizeFilenameOptions.md) | An optional object containing configuration options: - `replacement` {string} - The character to replace invalid characters with. Default is '!'. Cannot contain reserved filename characters. - `maxLength` {number} - The maximum length of the sanitized filename. Default is `MAX_FILENAME_LENGTH`. |
2096
+
2097
+ #### Returns
2098
+
2099
+ `string`
2100
+
2101
+ The sanitized filename.
2102
+
2103
+ **`Throws`**
2104
+
2105
+ - If the `replacement` contains reserved filename characters or control characters.
2106
+
2107
+ #### Defined in
2108
+
2109
+ [packages/ai-tool/src/utils/filename.ts:97](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/filename.ts#L97)
2110
+
2111
+ ___
2112
+
2113
+ ### sanitizeFilepath
2114
+
2115
+ ▸ **sanitizeFilepath**(`filepath`, `options?`): `string`
2116
+
2117
+ Sanitizes each part of a file path and reassembles it, ensuring the path is valid according to provided options.
2118
+
2119
+ #### Parameters
2120
+
2121
+ | Name | Type | Description |
2122
+ | :------ | :------ | :------ |
2123
+ | `filepath` | `string` | The file path to sanitize, represented as a string. |
2124
+ | `options` | [`SanitizeFilenameOptions`](interfaces/SanitizeFilenameOptions.md) | Optional settings for sanitization, extending `SanitizeFilenameOptions`. Allows customization of replacement characters and maximum filename length. |
2125
+
2126
+ #### Returns
2127
+
2128
+ `string`
2129
+
2130
+ The sanitized file path as a string.
2131
+
2132
+ #### Defined in
2133
+
2134
+ [packages/ai-tool/src/utils/filename.ts:149](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/filename.ts#L149)
2135
+
2136
+ ___
2137
+
2138
+ ### saveConfigFile
2139
+
2140
+ ▸ **saveConfigFile**(`filename`, `config`, `extLevel?`): `void`
2141
+
2142
+ #### Parameters
2143
+
2144
+ | Name | Type | Default value |
2145
+ | :------ | :------ | :------ |
2146
+ | `filename` | `string` | `undefined` |
2147
+ | `config` | `any` | `undefined` |
2148
+ | `extLevel` | `number` | `1` |
2149
+
2150
+ #### Returns
2151
+
2152
+ `void`
2153
+
2154
+ #### Defined in
2155
+
2156
+ [packages/ai-tool/src/utils/config.ts:68](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/config.ts#L68)
2157
+
2158
+ ___
2159
+
2160
+ ### sortedValues
2161
+
2162
+ ▸ **sortedValues**\<`T`\>(`values`): `T`[]
2163
+
2164
+ #### Type parameters
2165
+
2166
+ | Name |
2167
+ | :------ |
2168
+ | `T` |
2169
+
2170
+ #### Parameters
2171
+
2172
+ | Name | Type |
2173
+ | :------ | :------ |
2174
+ | `values` | `Record`\<`string`, `T`\> |
2175
+
2176
+ #### Returns
2177
+
2178
+ `T`[]
2179
+
2180
+ #### Defined in
2181
+
2182
+ [packages/ai-tool/src/utils/prompt/few-shot-prompt-template.ts:4](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/prompt/few-shot-prompt-template.ts#L4)
2183
+
2184
+ ___
2185
+
2186
+ ### splitSentence
2187
+
2188
+ ▸ **splitSentence**(`text`, `best?`): `string`[]
2189
+
2190
+ Splits a text into sentences.
2191
+ This function is used to split a text into separate sentences, based on punctuation marks such as '.', '?', or '!' and other rules.
2192
+
2193
+ #### Parameters
2194
+
2195
+ | Name | Type | Default value | Description |
2196
+ | :------ | :------ | :------ | :------ |
2197
+ | `text` | `string` | `undefined` | The input string that needs to be split into sentences. |
2198
+ | `best` | `boolean` | `true` | A boolean flag indicating if the function should use the best possible sentence splitting method (default is true). If set to false, it will not perform any additional processing and simply split on newline characters ('\n'). |
2199
+
2200
+ #### Returns
2201
+
2202
+ `string`[]
2203
+
2204
+ An array of strings where each string represents a sentence in the input text.
2205
+
2206
+ Example:
2207
+ const text = "Hello world! How are you today? I am fine.";
2208
+ console.log(splitSentence(text)); // returns ['Hello world!', 'How are you today?', 'I am fine.']
2209
+
2210
+ #### Defined in
2211
+
2212
+ [packages/ai-tool/src/utils/split-sentence.ts:29](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/split-sentence.ts#L29)
2213
+
2214
+ ___
2215
+
2216
+ ### stringifyYaml
2217
+
2218
+ ▸ **stringifyYaml**(`value`, `options?`): `string`
2219
+
2220
+ Stringify a value as a YAML document.
2221
+
2222
+ #### Parameters
2223
+
2224
+ | Name | Type |
2225
+ | :------ | :------ |
2226
+ | `value` | `any` |
2227
+ | `options?` | `DocumentOptions` & `SchemaOptions` & `ParseOptions` & `CreateNodeOptions` & `ToStringOptions` |
2228
+
2229
+ #### Returns
2230
+
2231
+ `string`
2232
+
2233
+ Will always include `\n` as the last character, as is expected of YAML documents.
2234
+
2235
+ #### Defined in
2236
+
2237
+ node_modules/.pnpm/yaml@2.4.3/node_modules/yaml/dist/public-api.d.ts:42
2238
+
2239
+ ▸ **stringifyYaml**(`value`, `replacer?`, `options?`): `string`
2240
+
2241
+ #### Parameters
2242
+
2243
+ | Name | Type |
2244
+ | :------ | :------ |
2245
+ | `value` | `any` |
2246
+ | `replacer?` | ``null`` \| `Replacer` |
2247
+ | `options?` | `string` \| `number` \| `DocumentOptions` & `SchemaOptions` & `ParseOptions` & `CreateNodeOptions` & `ToStringOptions` |
2248
+
2249
+ #### Returns
2250
+
2251
+ `string`
2252
+
2253
+ #### Defined in
2254
+
2255
+ node_modules/.pnpm/yaml@2.4.3/node_modules/yaml/dist/public-api.d.ts:43
2256
+
2257
+ ___
2258
+
2259
+ ### throwError
2260
+
2261
+ ▸ **throwError**(`message`, `name?`, `status?`): `void`
2262
+
2263
+ Throw an error
2264
+
2265
+ #### Parameters
2266
+
2267
+ | Name | Type | Default value | Description |
2268
+ | :------ | :------ | :------ | :------ |
2269
+ | `message` | `string` | `undefined` | Error message |
2270
+ | `name?` | `string` \| `Record`\<`string`, `any`\> | `undefined` | Error name, optional |
2271
+ | `status` | `string` \| `number` | `InternalErrorCode` | Error status code, default to 500 |
2272
+
2273
+ #### Returns
2274
+
2275
+ `void`
2276
+
2277
+ **`Throws`**
2278
+
2279
+ Throws a BaseError object
2280
+
2281
+ #### Defined in
2282
+
2283
+ [packages/ai-tool/src/utils/base-error.ts:232](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/base-error.ts#L232)
2284
+
2285
+ ___
2286
+
2287
+ ### trimStartOfStreamHelper
2288
+
2289
+ ▸ **trimStartOfStreamHelper**(): (`text`: `string`) => `string`
2290
+
2291
+ Returns a stateful function that, when invoked, trims leading whitespace
2292
+ from the input text. The trimming only occurs on the first invocation, ensuring that
2293
+ subsequent calls do not alter the input text. This is particularly useful in scenarios
2294
+ where a text stream is being processed and only the initial whitespace should be removed.
2295
+
2296
+ #### Returns
2297
+
2298
+ `fn`
2299
+
2300
+ A function that takes a string as input and returns a string
2301
+ with leading whitespace removed if it is the first invocation; otherwise, it returns the input unchanged.
2302
+
2303
+ ▸ (`text`): `string`
2304
+
2305
+ ##### Parameters
2306
+
2307
+ | Name | Type |
2308
+ | :------ | :------ |
2309
+ | `text` | `string` |
2310
+
2311
+ ##### Returns
2312
+
2313
+ `string`
2314
+
2315
+ **`Example`**
2316
+
2317
+ ```ts
2318
+ const trimStart = trimStartOfStreamHelper();
2319
+ const output1 = trimStart(" text"); // "text"
2320
+ const output2 = trimStart(" text"); // " text"
2321
+ ```
2322
+
2323
+ #### Defined in
2324
+
2325
+ [packages/ai-tool/src/utils/stream/ai-stream.ts:177](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/stream/ai-stream.ts#L177)
2326
+
2327
+ ___
2328
+
2329
+ ### truncTo
2330
+
2331
+ ▸ **truncTo**(`n`, `dec?`, `up?`): `number`
2332
+
2333
+ Truncates(Round) a number to a specified number of decimal places.
2334
+
2335
+ #### Parameters
2336
+
2337
+ | Name | Type | Default value | Description |
2338
+ | :------ | :------ | :------ | :------ |
2339
+ | `n` | `number` | `undefined` | The number to truncate. |
2340
+ | `dec` | `number` | `2` | The number of decimal places to truncate to (default is 2). |
2341
+ | `up` | `number` | `0.5` | The amount to round up by before truncating (default is 0.5). |
2342
+
2343
+ #### Returns
2344
+
2345
+ `number`
2346
+
2347
+ The truncated number.
2348
+
2349
+ **`Example`**
2350
+
2351
+ ```ts
2352
+ // returns 1.235
2353
+ truncTo(1.2345, 3)
2354
+ ```
2355
+
2356
+ **`Example`**
2357
+
2358
+ ```ts
2359
+ // returns 1.24
2360
+ truncTo(1.2345, 2, 0.6)
2361
+ ```
2362
+
2363
+ #### Defined in
2364
+
2365
+ [packages/ai-tool/src/utils/trunc-to.ts:19](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/trunc-to.ts#L19)
2366
+
2367
+ ___
2368
+
2369
+ ### uuid
2370
+
2371
+ ▸ **uuid**(`ver?`, `encode?`): `string`
2372
+
2373
+ #### Parameters
2374
+
2375
+ | Name | Type | Default value |
2376
+ | :------ | :------ | :------ |
2377
+ | `ver` | ``1`` \| ``4`` \| ``5`` | `1` |
2378
+ | `encode?` | `boolean` | `undefined` |
2379
+
2380
+ #### Returns
2381
+
2382
+ `string`
2383
+
2384
+ #### Defined in
2385
+
2386
+ [packages/ai-tool/src/utils/hash/uuid.ts:8](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/hash/uuid.ts#L8)
2387
+
2388
+ ___
2389
+
2390
+ ### uuidParse
2391
+
2392
+ ▸ **uuidParse**(`uuid`): `Uint8Array`
2393
+
2394
+ #### Parameters
2395
+
2396
+ | Name | Type |
2397
+ | :------ | :------ |
2398
+ | `uuid` | `string` |
2399
+
2400
+ #### Returns
2401
+
2402
+ `Uint8Array`
2403
+
2404
+ #### Defined in
2405
+
2406
+ node_modules/.pnpm/@types+uuid@9.0.8/node_modules/@types/uuid/index.d.ts:79
2407
+
2408
+ ___
2409
+
2410
+ ### uuidStringify
2411
+
2412
+ ▸ **uuidStringify**(`buffer`, `offset?`): `string`
2413
+
2414
+ #### Parameters
2415
+
2416
+ | Name | Type |
2417
+ | :------ | :------ |
2418
+ | `buffer` | `InputBuffer` |
2419
+ | `offset?` | `number` |
2420
+
2421
+ #### Returns
2422
+
2423
+ `string`
2424
+
2425
+ #### Defined in
2426
+
2427
+ node_modules/.pnpm/@types+uuid@9.0.8/node_modules/@types/uuid/index.d.ts:80
2428
+
2429
+ ___
2430
+
2431
+ ### uuidValidate
2432
+
2433
+ ▸ **uuidValidate**(`uuid`): `boolean`
2434
+
2435
+ #### Parameters
2436
+
2437
+ | Name | Type |
2438
+ | :------ | :------ |
2439
+ | `uuid` | `string` |
2440
+
2441
+ #### Returns
2442
+
2443
+ `boolean`
2444
+
2445
+ #### Defined in
2446
+
2447
+ node_modules/.pnpm/@types+uuid@9.0.8/node_modules/@types/uuid/index.d.ts:85
2448
+
2449
+ ___
2450
+
2451
+ ### uuidVersion
2452
+
2453
+ ▸ **uuidVersion**(`uuid`): `number`
2454
+
2455
+ #### Parameters
2456
+
2457
+ | Name | Type |
2458
+ | :------ | :------ |
2459
+ | `uuid` | `string` |
2460
+
2461
+ #### Returns
2462
+
2463
+ `number`
2464
+
2465
+ #### Defined in
2466
+
2467
+ node_modules/.pnpm/@types+uuid@9.0.8/node_modules/@types/uuid/index.d.ts:86
2468
+
2469
+ ___
2470
+
2471
+ ### uuidv1
2472
+
2473
+ ▸ **uuidv1**\<`T`\>(`options`, `buffer`, `offset?`): `T`
2474
+
2475
+ #### Type parameters
2476
+
2477
+ | Name | Type |
2478
+ | :------ | :------ |
2479
+ | `T` | extends `OutputBuffer` |
2480
+
2481
+ #### Parameters
2482
+
2483
+ | Name | Type |
2484
+ | :------ | :------ |
2485
+ | `options` | `undefined` \| ``null`` \| `V1Options` |
2486
+ | `buffer` | `T` |
2487
+ | `offset?` | `number` |
2488
+
2489
+ #### Returns
2490
+
2491
+ `T`
2492
+
2493
+ #### Defined in
2494
+
2495
+ node_modules/.pnpm/@types+uuid@9.0.8/node_modules/@types/uuid/index.d.ts:81
2496
+
2497
+ ▸ **uuidv1**(`options?`): `string`
2498
+
2499
+ #### Parameters
2500
+
2501
+ | Name | Type |
2502
+ | :------ | :------ |
2503
+ | `options?` | `V1Options` |
2504
+
2505
+ #### Returns
2506
+
2507
+ `string`
2508
+
2509
+ #### Defined in
2510
+
2511
+ node_modules/.pnpm/@types+uuid@9.0.8/node_modules/@types/uuid/index.d.ts:81
2512
+
2513
+ ___
2514
+
2515
+ ### uuidv4
2516
+
2517
+ ▸ **uuidv4**\<`T`\>(`options`, `buffer`, `offset?`): `T`
2518
+
2519
+ #### Type parameters
2520
+
2521
+ | Name | Type |
2522
+ | :------ | :------ |
2523
+ | `T` | extends `OutputBuffer` |
2524
+
2525
+ #### Parameters
2526
+
2527
+ | Name | Type |
2528
+ | :------ | :------ |
2529
+ | `options` | `undefined` \| ``null`` \| `V4Options` |
2530
+ | `buffer` | `T` |
2531
+ | `offset?` | `number` |
2532
+
2533
+ #### Returns
2534
+
2535
+ `T`
2536
+
2537
+ #### Defined in
2538
+
2539
+ node_modules/.pnpm/@types+uuid@9.0.8/node_modules/@types/uuid/index.d.ts:83
2540
+
2541
+ ▸ **uuidv4**(`options?`): `string`
2542
+
2543
+ #### Parameters
2544
+
2545
+ | Name | Type |
2546
+ | :------ | :------ |
2547
+ | `options?` | `V4Options` |
2548
+
2549
+ #### Returns
2550
+
2551
+ `string`
2552
+
2553
+ #### Defined in
2554
+
2555
+ node_modules/.pnpm/@types+uuid@9.0.8/node_modules/@types/uuid/index.d.ts:83
2556
+
2557
+ ___
2558
+
2559
+ ### uuidv5
2560
+
2561
+ ▸ **uuidv5**\<`T`\>(`name`, `namespace`, `buffer`, `offset?`): `T`
2562
+
2563
+ #### Type parameters
2564
+
2565
+ | Name | Type |
2566
+ | :------ | :------ |
2567
+ | `T` | extends `OutputBuffer` |
2568
+
2569
+ #### Parameters
2570
+
2571
+ | Name | Type |
2572
+ | :------ | :------ |
2573
+ | `name` | `string` \| `InputBuffer` |
2574
+ | `namespace` | `string` \| `InputBuffer` |
2575
+ | `buffer` | `T` |
2576
+ | `offset?` | `number` |
2577
+
2578
+ #### Returns
2579
+
2580
+ `T`
2581
+
2582
+ #### Defined in
2583
+
2584
+ node_modules/.pnpm/@types+uuid@9.0.8/node_modules/@types/uuid/index.d.ts:84
2585
+
2586
+ ▸ **uuidv5**(`name`, `namespace`): `string`
2587
+
2588
+ #### Parameters
2589
+
2590
+ | Name | Type |
2591
+ | :------ | :------ |
2592
+ | `name` | `string` \| `InputBuffer` |
2593
+ | `namespace` | `string` \| `InputBuffer` |
2594
+
2595
+ #### Returns
2596
+
2597
+ `string`
2598
+
2599
+ #### Defined in
2600
+
2601
+ node_modules/.pnpm/@types+uuid@9.0.8/node_modules/@types/uuid/index.d.ts:84
2602
+
2603
+ ___
2604
+
2605
+ ### wait
2606
+
2607
+ ▸ **wait**(`ms`): `Promise`\<`void`\>
2608
+
2609
+ #### Parameters
2610
+
2611
+ | Name | Type |
2612
+ | :------ | :------ |
2613
+ | `ms` | `number` |
2614
+
2615
+ #### Returns
2616
+
2617
+ `Promise`\<`void`\>
2618
+
2619
+ #### Defined in
2620
+
2621
+ [packages/ai-tool/src/utils/wait.ts:1](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/wait.ts#L1)
2622
+
2623
+ ___
2624
+
2625
+ ### xxhash
2626
+
2627
+ ▸ **xxhash**(`value`, `hashAlgo?`, `seed?`): `Uint8Array`
2628
+
2629
+ #### Parameters
2630
+
2631
+ | Name | Type | Default value |
2632
+ | :------ | :------ | :------ |
2633
+ | `value` | `HashValue` | `undefined` |
2634
+ | `hashAlgo` | [`XXHashAlgorithm`](enums/XXHashAlgorithm.md) | `XXHashAlgorithm.xxhash64` |
2635
+ | `seed` | `number` | `SEED` |
2636
+
2637
+ #### Returns
2638
+
2639
+ `Uint8Array`
2640
+
2641
+ #### Defined in
2642
+
2643
+ [packages/ai-tool/src/utils/hash/xxhash.ts:32](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/hash/xxhash.ts#L32)
2644
+
2645
+ ___
2646
+
2647
+ ### xxhash32
2648
+
2649
+ ▸ **xxhash32**(`value`, `radix?`): `string`
2650
+
2651
+ #### Parameters
2652
+
2653
+ | Name | Type | Default value |
2654
+ | :------ | :------ | :------ |
2655
+ | `value` | `string` \| `object` | `undefined` |
2656
+ | `radix` | `number` | `16` |
2657
+
2658
+ #### Returns
2659
+
2660
+ `string`
2661
+
2662
+ #### Defined in
2663
+
2664
+ [packages/ai-tool/src/utils/hash/xxhash.ts:11](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/hash/xxhash.ts#L11)
2665
+
2666
+ ___
2667
+
2668
+ ### xxhash64
2669
+
2670
+ ▸ **xxhash64**(`value`, `radix?`): `string`
2671
+
2672
+ #### Parameters
2673
+
2674
+ | Name | Type | Default value |
2675
+ | :------ | :------ | :------ |
2676
+ | `value` | `string` \| `object` | `undefined` |
2677
+ | `radix` | `number` | `16` |
2678
+
2679
+ #### Returns
2680
+
2681
+ `string`
2682
+
2683
+ #### Defined in
2684
+
2685
+ [packages/ai-tool/src/utils/hash/xxhash.ts:18](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/hash/xxhash.ts#L18)
2686
+
2687
+ ___
2688
+
2689
+ ### xxhashAsStr
2690
+
2691
+ ▸ **xxhashAsStr**(`value`, `hashAlgo?`, `seed?`): `string`
2692
+
2693
+ #### Parameters
2694
+
2695
+ | Name | Type | Default value |
2696
+ | :------ | :------ | :------ |
2697
+ | `value` | `string` \| `Uint8Array` | `undefined` |
2698
+ | `hashAlgo` | [`XXHashAlgorithm`](enums/XXHashAlgorithm.md) | `XXHashAlgorithm.xxhash64` |
2699
+ | `seed` | `number` | `SEED` |
2700
+
2701
+ #### Returns
2702
+
2703
+ `string`
2704
+
2705
+ #### Defined in
2706
+
2707
+ [packages/ai-tool/src/utils/hash/xxhash.ts:48](https://github.com/isdk/ai-tool.js/blob/e7fb80e8b32da0eb475b223017e88d973ef7af19/src/utils/hash/xxhash.ts#L48)