@isdk/ai-tool 0.0.6 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-B7IE5ATQ.mjs +1 -0
- package/dist/chunk-U5DDQYSF.mjs +1 -22
- package/dist/funcs.d.mts +2 -2
- package/dist/funcs.d.ts +2 -2
- package/dist/funcs.js +1 -5020
- package/dist/funcs.mjs +1 -37
- package/dist/{index-D4KjfAKl.d.mts → index-Dgo3ZXPQ.d.mts} +29 -14
- package/dist/{index-D4KjfAKl.d.ts → index-Dgo3ZXPQ.d.ts} +29 -14
- package/dist/index.d.mts +372 -56
- package/dist/index.d.ts +372 -56
- package/dist/index.js +1 -5245
- package/dist/index.mjs +1 -402
- package/dist/test/util.js +1 -97
- package/dist/test/util.mjs +1 -60
- package/docs/classes/AbortError.md +8 -8
- package/docs/classes/AlreadyExistsError.md +8 -8
- package/docs/classes/BaseError.md +8 -8
- package/docs/classes/CancelableAbility.md +431 -0
- package/docs/classes/ClientTools.md +101 -51
- package/docs/classes/CommonError.md +8 -8
- package/docs/classes/EventClient.md +123 -73
- package/docs/classes/EventServer.md +121 -71
- package/docs/classes/EventToolFunc.md +91 -41
- package/docs/classes/FStringPromptTemplate.md +18 -18
- package/docs/classes/FewShotPromptTemplate.md +22 -22
- package/docs/classes/GolangPromptTemplate.md +18 -18
- package/docs/classes/HFEnvironment.md +9 -9
- package/docs/classes/HFInterpreter.md +17 -17
- package/docs/classes/HFTemplate.md +4 -4
- package/docs/classes/HfPromptTemplate.md +18 -18
- package/docs/classes/IntSet.md +249 -0
- package/docs/classes/NotFoundError.md +8 -8
- package/docs/classes/NotImplementationError.md +8 -8
- package/docs/classes/PromptExampleSelector.md +8 -8
- package/docs/classes/PromptTemplate.md +17 -17
- package/docs/classes/ReadableStreamError.md +8 -8
- package/docs/classes/ResClientTools.md +107 -57
- package/docs/classes/ResServerTools.md +105 -55
- package/docs/classes/SSEChannel.md +15 -15
- package/docs/classes/Semaphore.md +273 -0
- package/docs/classes/ServerTools.md +98 -48
- package/docs/classes/TaskAbortController.md +157 -0
- package/docs/classes/ToolFunc.md +80 -38
- package/docs/enums/AsyncFeatureBits.md +41 -0
- package/docs/enums/AsyncFeatures.md +41 -0
- package/docs/enums/ErrorCode.md +41 -19
- package/docs/enums/XXHashAlgorithm.md +2 -2
- package/docs/interfaces/AIChatAssistantMessageParam.md +6 -6
- package/docs/interfaces/AIChatContentPartImage.md +2 -2
- package/docs/interfaces/AIChatContentPartText.md +2 -2
- package/docs/interfaces/AIChatMessageParamBase.md +1 -1
- package/docs/interfaces/AIChatMessageToolCall.md +3 -3
- package/docs/interfaces/AIChatSystemMessageParam.md +3 -3
- package/docs/interfaces/AIChatToolMessageParam.md +4 -4
- package/docs/interfaces/AIChatUserMessageParam.md +7 -7
- package/docs/interfaces/AIResult.md +16 -5
- package/docs/interfaces/AIStreamParser.md +1 -1
- package/docs/interfaces/AIStreamParserOptions.md +1 -1
- package/docs/interfaces/BaseFunc.md +7 -7
- package/docs/interfaces/BaseFuncItem.md +6 -6
- package/docs/interfaces/CancelableAbilityOptions.md +126 -0
- package/docs/interfaces/ClientFuncItem.md +10 -10
- package/docs/interfaces/DotenvExpandOptions.md +3 -3
- package/docs/interfaces/DotenvExpandOutput.md +2 -2
- package/docs/interfaces/EventClientFuncParams.md +4 -4
- package/docs/interfaces/EventServerFuncParams.md +5 -5
- package/docs/interfaces/FewShotPromptTemplateOptions.md +11 -11
- package/docs/interfaces/FuncItem.md +7 -7
- package/docs/interfaces/FuncParam.md +16 -5
- package/docs/interfaces/PromptExampleSelectorOptions.md +2 -2
- package/docs/interfaces/PromptTemplateOptions.md +6 -6
- package/docs/interfaces/RemoteFuncItem.md +10 -10
- package/docs/interfaces/ResClientFuncParams.md +2 -2
- package/docs/interfaces/ResServerFuncParams.md +5 -5
- package/docs/interfaces/SanitizeFilenameOptions.md +2 -2
- package/docs/interfaces/ServerFuncItem.md +11 -11
- package/docs/interfaces/ServerFuncParams.md +2 -2
- package/docs/interfaces/StreamCallbacksAndOptions.md +124 -0
- package/docs/interfaces/TaskAbortControllers.md +7 -0
- package/docs/interfaces/TaskPromise.md +151 -0
- package/docs/interfaces/ToolFuncPackage.md +63 -0
- package/docs/modules.md +1156 -225
- package/package.json +5 -6
- package/dist/chunk-6AXCY6TJ.mjs +0 -5090
- package/docs/interfaces/AIStreamCallbacksAndOptions.md +0 -158
package/docs/modules.md
CHANGED
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
### Enumerations
|
|
8
8
|
|
|
9
|
+
- [AsyncFeatureBits](enums/AsyncFeatureBits.md)
|
|
10
|
+
- [AsyncFeatures](enums/AsyncFeatures.md)
|
|
9
11
|
- [ErrorCode](enums/ErrorCode.md)
|
|
10
12
|
- [XXHashAlgorithm](enums/XXHashAlgorithm.md)
|
|
11
13
|
|
|
@@ -14,6 +16,7 @@
|
|
|
14
16
|
- [AbortError](classes/AbortError.md)
|
|
15
17
|
- [AlreadyExistsError](classes/AlreadyExistsError.md)
|
|
16
18
|
- [BaseError](classes/BaseError.md)
|
|
19
|
+
- [CancelableAbility](classes/CancelableAbility.md)
|
|
17
20
|
- [ClientTools](classes/ClientTools.md)
|
|
18
21
|
- [CommonError](classes/CommonError.md)
|
|
19
22
|
- [ConfigFile](classes/ConfigFile.md)
|
|
@@ -27,6 +30,7 @@
|
|
|
27
30
|
- [HFInterpreter](classes/HFInterpreter.md)
|
|
28
31
|
- [HFTemplate](classes/HFTemplate.md)
|
|
29
32
|
- [HfPromptTemplate](classes/HfPromptTemplate.md)
|
|
33
|
+
- [IntSet](classes/IntSet.md)
|
|
30
34
|
- [NotFoundError](classes/NotFoundError.md)
|
|
31
35
|
- [NotImplementationError](classes/NotImplementationError.md)
|
|
32
36
|
- [PromptExampleSelector](classes/PromptExampleSelector.md)
|
|
@@ -35,7 +39,9 @@
|
|
|
35
39
|
- [ResClientTools](classes/ResClientTools.md)
|
|
36
40
|
- [ResServerTools](classes/ResServerTools.md)
|
|
37
41
|
- [SSEChannel](classes/SSEChannel.md)
|
|
42
|
+
- [Semaphore](classes/Semaphore.md)
|
|
38
43
|
- [ServerTools](classes/ServerTools.md)
|
|
44
|
+
- [TaskAbortController](classes/TaskAbortController.md)
|
|
39
45
|
- [ToolFunc](classes/ToolFunc.md)
|
|
40
46
|
|
|
41
47
|
### Interfaces
|
|
@@ -49,11 +55,11 @@
|
|
|
49
55
|
- [AIChatToolMessageParam](interfaces/AIChatToolMessageParam.md)
|
|
50
56
|
- [AIChatUserMessageParam](interfaces/AIChatUserMessageParam.md)
|
|
51
57
|
- [AIResult](interfaces/AIResult.md)
|
|
52
|
-
- [AIStreamCallbacksAndOptions](interfaces/AIStreamCallbacksAndOptions.md)
|
|
53
58
|
- [AIStreamParser](interfaces/AIStreamParser.md)
|
|
54
59
|
- [AIStreamParserOptions](interfaces/AIStreamParserOptions.md)
|
|
55
60
|
- [BaseFunc](interfaces/BaseFunc.md)
|
|
56
61
|
- [BaseFuncItem](interfaces/BaseFuncItem.md)
|
|
62
|
+
- [CancelableAbilityOptions](interfaces/CancelableAbilityOptions.md)
|
|
57
63
|
- [ClientFuncItem](interfaces/ClientFuncItem.md)
|
|
58
64
|
- [DotenvExpandOptions](interfaces/DotenvExpandOptions.md)
|
|
59
65
|
- [DotenvExpandOutput](interfaces/DotenvExpandOutput.md)
|
|
@@ -77,6 +83,10 @@
|
|
|
77
83
|
- [SanitizeFilenameOptions](interfaces/SanitizeFilenameOptions.md)
|
|
78
84
|
- [ServerFuncItem](interfaces/ServerFuncItem.md)
|
|
79
85
|
- [ServerFuncParams](interfaces/ServerFuncParams.md)
|
|
86
|
+
- [StreamCallbacksAndOptions](interfaces/StreamCallbacksAndOptions.md)
|
|
87
|
+
- [TaskAbortControllers](interfaces/TaskAbortControllers.md)
|
|
88
|
+
- [TaskPromise](interfaces/TaskPromise.md)
|
|
89
|
+
- [ToolFuncPackage](interfaces/ToolFuncPackage.md)
|
|
80
90
|
|
|
81
91
|
### Type Aliases
|
|
82
92
|
|
|
@@ -89,6 +99,7 @@
|
|
|
89
99
|
- [AIModelNameRules](modules.md#aimodelnamerules)
|
|
90
100
|
- [AITextGenerationFinishReason](modules.md#aitextgenerationfinishreason)
|
|
91
101
|
- [ActionName](modules.md#actionname)
|
|
102
|
+
- [AsyncTaskId](modules.md#asynctaskid)
|
|
92
103
|
- [ErrorCodeType](modules.md#errorcodetype)
|
|
93
104
|
- [EventErrorListenerFn](modules.md#eventerrorlistenerfn)
|
|
94
105
|
- [EventListenerFn](modules.md#eventlistenerfn)
|
|
@@ -108,6 +119,7 @@
|
|
|
108
119
|
- [ActionNames](modules.md#actionnames)
|
|
109
120
|
- [AlreadyExistsErrorCode](modules.md#alreadyexistserrorcode)
|
|
110
121
|
- [ClientToolFuncSchema](modules.md#clienttoolfuncschema)
|
|
122
|
+
- [DefaultAsyncSemaphoreCapacity](modules.md#defaultasyncsemaphorecapacity)
|
|
111
123
|
- [EventBusName](modules.md#eventbusname)
|
|
112
124
|
- [EventName](modules.md#eventname)
|
|
113
125
|
- [FilenameReservedRegex](modules.md#filenamereservedregex)
|
|
@@ -125,6 +137,9 @@
|
|
|
125
137
|
- [ResponseRStreamErrCode](modules.md#responserstreamerrcode)
|
|
126
138
|
- [SSEChannelAlreadyClosedErrCode](modules.md#ssechannelalreadyclosederrcode)
|
|
127
139
|
- [ServerToolFuncSchema](modules.md#servertoolfuncschema)
|
|
140
|
+
- [ToolAsyncCancelableBit](modules.md#toolasynccancelablebit)
|
|
141
|
+
- [ToolAsyncMultiTaskBit](modules.md#toolasyncmultitaskbit)
|
|
142
|
+
- [ToolAsyncPriorityBit](modules.md#toolasyncprioritybit)
|
|
128
143
|
- [ToolFuncSchema](modules.md#toolfuncschema)
|
|
129
144
|
- [WindowsReservedNameRegex](modules.md#windowsreservednameregex)
|
|
130
145
|
- [base32768](modules.md#base32768)
|
|
@@ -132,22 +147,19 @@
|
|
|
132
147
|
- [event](modules.md#event)
|
|
133
148
|
- [eventClient](modules.md#eventclient)
|
|
134
149
|
- [eventServer](modules.md#eventserver)
|
|
135
|
-
- [isSimilar](modules.md#issimilar)
|
|
136
150
|
- [lrucache](modules.md#lrucache)
|
|
137
|
-
- [mergeSegments](modules.md#mergesegments)
|
|
138
151
|
- [mimeType](modules.md#mimetype)
|
|
139
|
-
- [segments](modules.md#segments)
|
|
140
|
-
- [similarity](modules.md#similarity)
|
|
141
|
-
- [splitSegments](modules.md#splitsegments)
|
|
142
152
|
- [uuidNIL](modules.md#uuidnil)
|
|
143
153
|
|
|
144
154
|
### Functions
|
|
145
155
|
|
|
146
156
|
- [AIStream](modules.md#aistream)
|
|
157
|
+
- [RateLimit](modules.md#ratelimit)
|
|
147
158
|
- [\_lrucache](modules.md#_lrucache)
|
|
148
159
|
- [backendEventable](modules.md#backendeventable)
|
|
149
160
|
- [canonicalize](modules.md#canonicalize)
|
|
150
161
|
- [canonicalizeEx](modules.md#canonicalizeex)
|
|
162
|
+
- [createAbilityInjector](modules.md#createabilityinjector)
|
|
151
163
|
- [createCallbacksTransformer](modules.md#createcallbackstransformer)
|
|
152
164
|
- [createEmptyReadableStream](modules.md#createemptyreadablestream)
|
|
153
165
|
- [createEndWithRepetitionDetector](modules.md#createendwithrepetitiondetector)
|
|
@@ -155,16 +167,18 @@
|
|
|
155
167
|
- [createEventStreamTransformer](modules.md#createeventstreamtransformer)
|
|
156
168
|
- [createHfValueFunc](modules.md#createhfvaluefunc)
|
|
157
169
|
- [createLRUCache](modules.md#createlrucache)
|
|
170
|
+
- [dateToText](modules.md#datetotext)
|
|
158
171
|
- [expandEnv](modules.md#expandenv)
|
|
159
172
|
- [expandObjEnv](modules.md#expandobjenv)
|
|
160
173
|
- [extNameLevel](modules.md#extnamelevel)
|
|
161
174
|
- [filenameReservedRegex](modules.md#filenamereservedregex-1)
|
|
175
|
+
- [formatISO](modules.md#formatiso)
|
|
162
176
|
- [getAllEnumKeys](modules.md#getallenumkeys)
|
|
163
177
|
- [getConfigFileNames](modules.md#getconfigfilenames)
|
|
164
178
|
- [getConfigs](modules.md#getconfigs)
|
|
165
|
-
- [getDefaultSimilarPassingScore](modules.md#getdefaultsimilarpassingscore)
|
|
166
179
|
- [getKeysPath](modules.md#getkeyspath)
|
|
167
180
|
- [getMultiLevelExtname](modules.md#getmultilevelextname)
|
|
181
|
+
- [getRealFilepath](modules.md#getrealfilepath)
|
|
168
182
|
- [getResponseErrorReadableStream](modules.md#getresponseerrorreadablestream)
|
|
169
183
|
- [hfParse](modules.md#hfparse)
|
|
170
184
|
- [hfTokenize](modules.md#hftokenize)
|
|
@@ -174,24 +188,36 @@
|
|
|
174
188
|
- [isModelNameMatched](modules.md#ismodelnamematched)
|
|
175
189
|
- [isValidFilename](modules.md#isvalidfilename)
|
|
176
190
|
- [isValidFilepath](modules.md#isvalidfilepath)
|
|
191
|
+
- [isWebStream](modules.md#iswebstream)
|
|
177
192
|
- [jsonFilterToWhere](modules.md#jsonfiltertowhere)
|
|
193
|
+
- [jsonToMarkdownStr](modules.md#jsontomarkdownstr)
|
|
178
194
|
- [loadFileFromPaths](modules.md#loadfilefrompaths)
|
|
179
195
|
- [loadTextFromPaths](modules.md#loadtextfrompaths)
|
|
196
|
+
- [makeToolFuncCancelable](modules.md#maketoolfunccancelable)
|
|
180
197
|
- [matchUrlProtocol](modules.md#matchurlprotocol)
|
|
198
|
+
- [messagesToText](modules.md#messagestotext)
|
|
199
|
+
- [paramsSizeToScaleStr](modules.md#paramssizetoscalestr)
|
|
200
|
+
- [parseDateFormat](modules.md#parsedateformat)
|
|
181
201
|
- [parseFString](modules.md#parsefstring)
|
|
202
|
+
- [parseISO](modules.md#parseiso)
|
|
182
203
|
- [parseJsJson](modules.md#parsejsjson)
|
|
183
204
|
- [parseYaml](modules.md#parseyaml)
|
|
184
205
|
- [reControlCharsRegex](modules.md#recontrolcharsregex)
|
|
206
|
+
- [readFilenamesRecursiveSync](modules.md#readfilenamesrecursivesync)
|
|
185
207
|
- [readableFromAsyncIterable](modules.md#readablefromasynciterable)
|
|
186
208
|
- [registerCoreTools](modules.md#registercoretools)
|
|
187
209
|
- [registerYamlTag](modules.md#registeryamltag)
|
|
188
210
|
- [sanitizeFilename](modules.md#sanitizefilename)
|
|
189
211
|
- [sanitizeFilepath](modules.md#sanitizefilepath)
|
|
190
212
|
- [saveConfigFile](modules.md#saveconfigfile)
|
|
213
|
+
- [scaleStrToParamsSize](modules.md#scalestrtoparamssize)
|
|
191
214
|
- [sortedValues](modules.md#sortedvalues)
|
|
192
215
|
- [splitSentence](modules.md#splitsentence)
|
|
193
216
|
- [stringifyYaml](modules.md#stringifyyaml)
|
|
217
|
+
- [textToDate](modules.md#texttodate)
|
|
194
218
|
- [throwError](modules.md#throwerror)
|
|
219
|
+
- [toDate](modules.md#todate)
|
|
220
|
+
- [toDateTime](modules.md#todatetime)
|
|
195
221
|
- [trimStartOfStreamHelper](modules.md#trimstartofstreamhelper)
|
|
196
222
|
- [truncTo](modules.md#truncto)
|
|
197
223
|
- [uuid](modules.md#uuid)
|
|
@@ -208,7 +234,550 @@
|
|
|
208
234
|
- [xxhash64](modules.md#xxhash64)
|
|
209
235
|
- [xxhashAsStr](modules.md#xxhashasstr)
|
|
210
236
|
|
|
211
|
-
##
|
|
237
|
+
## Common Helpers
|
|
238
|
+
|
|
239
|
+
### formatISO
|
|
240
|
+
|
|
241
|
+
▸ **formatISO**\<`DateType`\>(`date`, `options?`): `string`
|
|
242
|
+
|
|
243
|
+
#### Type parameters
|
|
244
|
+
|
|
245
|
+
| Name | Type | Description |
|
|
246
|
+
| :------ | :------ | :------ |
|
|
247
|
+
| `DateType` | extends `Date` | The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). |
|
|
248
|
+
|
|
249
|
+
#### Parameters
|
|
250
|
+
|
|
251
|
+
| Name | Type | Description |
|
|
252
|
+
| :------ | :------ | :------ |
|
|
253
|
+
| `date` | `string` \| `number` \| `DateType` | The original date |
|
|
254
|
+
| `options?` | `FormatISOOptions` | An object with options. |
|
|
255
|
+
|
|
256
|
+
#### Returns
|
|
257
|
+
|
|
258
|
+
`string`
|
|
259
|
+
|
|
260
|
+
The formatted date string (in loca.l time zone)
|
|
261
|
+
|
|
262
|
+
**`Name`**
|
|
263
|
+
|
|
264
|
+
formatISO
|
|
265
|
+
|
|
266
|
+
**`Summary`**
|
|
267
|
+
|
|
268
|
+
Format the date according to the ISO 8601 standard (https://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a003169814.htm).
|
|
269
|
+
|
|
270
|
+
**`Description`**
|
|
271
|
+
|
|
272
|
+
Return the formatted date string in ISO 8601 format. Options may be passed to control the parts and notations of the date.
|
|
273
|
+
|
|
274
|
+
**`Throws`**
|
|
275
|
+
|
|
276
|
+
`date` must not be Invalid Date
|
|
277
|
+
|
|
278
|
+
**`Example`**
|
|
279
|
+
|
|
280
|
+
```ts
|
|
281
|
+
// Represent 18 September 2019 in ISO 8601 format (local time zone is UTC):
|
|
282
|
+
const result = formatISO(new Date(2019, 8, 18, 19, 0, 52))
|
|
283
|
+
//=> '2019-09-18T19:00:52Z'
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
**`Example`**
|
|
287
|
+
|
|
288
|
+
```ts
|
|
289
|
+
// Represent 18 September 2019 in ISO 8601, short format (local time zone is UTC):
|
|
290
|
+
const result = formatISO(new Date(2019, 8, 18, 19, 0, 52), { format: 'basic' })
|
|
291
|
+
//=> '20190918T190052'
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
**`Example`**
|
|
295
|
+
|
|
296
|
+
```ts
|
|
297
|
+
// Represent 18 September 2019 in ISO 8601 format, date only:
|
|
298
|
+
const result = formatISO(new Date(2019, 8, 18, 19, 0, 52), { representation: 'date' })
|
|
299
|
+
//=> '2019-09-18'
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
**`Example`**
|
|
303
|
+
|
|
304
|
+
```ts
|
|
305
|
+
// Represent 18 September 2019 in ISO 8601 format, time only (local time zone is UTC):
|
|
306
|
+
const result = formatISO(new Date(2019, 8, 18, 19, 0, 52), { representation: 'time' })
|
|
307
|
+
//=> '19:00:52Z'
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
#### Defined in
|
|
311
|
+
|
|
312
|
+
node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/formatISO.d.ts:43
|
|
313
|
+
|
|
314
|
+
___
|
|
315
|
+
|
|
316
|
+
### parseDateFormat
|
|
317
|
+
|
|
318
|
+
▸ **parseDateFormat**\<`DateType`\>(`dateStr`, `formatStr`, `referenceDate`, `options?`): `DateType`
|
|
319
|
+
|
|
320
|
+
#### Type parameters
|
|
321
|
+
|
|
322
|
+
| Name | Type | Description |
|
|
323
|
+
| :------ | :------ | :------ |
|
|
324
|
+
| `DateType` | extends `Date` | The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). |
|
|
325
|
+
|
|
326
|
+
#### Parameters
|
|
327
|
+
|
|
328
|
+
| Name | Type | Description |
|
|
329
|
+
| :------ | :------ | :------ |
|
|
330
|
+
| `dateStr` | `string` | The string to parse |
|
|
331
|
+
| `formatStr` | `string` | The string of tokens |
|
|
332
|
+
| `referenceDate` | `string` \| `number` \| `DateType` | defines values missing from the parsed dateString |
|
|
333
|
+
| `options?` | `ParseOptions` | An object with options. see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md |
|
|
334
|
+
|
|
335
|
+
#### Returns
|
|
336
|
+
|
|
337
|
+
`DateType`
|
|
338
|
+
|
|
339
|
+
The parsed date
|
|
340
|
+
|
|
341
|
+
**`Name`**
|
|
342
|
+
|
|
343
|
+
parse
|
|
344
|
+
|
|
345
|
+
**`Summary`**
|
|
346
|
+
|
|
347
|
+
Parse the date.
|
|
348
|
+
|
|
349
|
+
**`Description`**
|
|
350
|
+
|
|
351
|
+
Return the date parsed from string using the given format string.
|
|
352
|
+
|
|
353
|
+
> ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.
|
|
354
|
+
> See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
355
|
+
|
|
356
|
+
The characters in the format string wrapped between two single quotes characters (') are escaped.
|
|
357
|
+
Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.
|
|
358
|
+
|
|
359
|
+
Format of the format string is based on Unicode Technical Standard #35:
|
|
360
|
+
https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
|
|
361
|
+
with a few additions (see note 5 below the table).
|
|
362
|
+
|
|
363
|
+
Not all tokens are compatible. Combinations that don't make sense or could lead to bugs are prohibited
|
|
364
|
+
and will throw `RangeError`. For example usage of 24-hour format token with AM/PM token will throw an exception:
|
|
365
|
+
|
|
366
|
+
```javascript
|
|
367
|
+
parse('23 AM', 'HH a', new Date())
|
|
368
|
+
//=> RangeError: The format string mustn't contain `HH` and `a` at the same time
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
See the compatibility table: https://docs.google.com/spreadsheets/d/e/2PACX-1vQOPU3xUhplll6dyoMmVUXHKl_8CRDs6_ueLmex3SoqwhuolkuN3O05l4rqx5h1dKX8eb46Ul-CCSrq/pubhtml?gid=0&single=true
|
|
372
|
+
|
|
373
|
+
Accepted format string patterns:
|
|
374
|
+
| Unit |Prior| Pattern | Result examples | Notes |
|
|
375
|
+
|---------------------------------|-----|---------|-----------------------------------|-------|
|
|
376
|
+
| Era | 140 | G..GGG | AD, BC | |
|
|
377
|
+
| | | GGGG | Anno Domini, Before Christ | 2 |
|
|
378
|
+
| | | GGGGG | A, B | |
|
|
379
|
+
| Calendar year | 130 | y | 44, 1, 1900, 2017, 9999 | 4 |
|
|
380
|
+
| | | yo | 44th, 1st, 1900th, 9999999th | 4,5 |
|
|
381
|
+
| | | yy | 44, 01, 00, 17 | 4 |
|
|
382
|
+
| | | yyy | 044, 001, 123, 999 | 4 |
|
|
383
|
+
| | | yyyy | 0044, 0001, 1900, 2017 | 4 |
|
|
384
|
+
| | | yyyyy | ... | 2,4 |
|
|
385
|
+
| Local week-numbering year | 130 | Y | 44, 1, 1900, 2017, 9000 | 4 |
|
|
386
|
+
| | | Yo | 44th, 1st, 1900th, 9999999th | 4,5 |
|
|
387
|
+
| | | YY | 44, 01, 00, 17 | 4,6 |
|
|
388
|
+
| | | YYY | 044, 001, 123, 999 | 4 |
|
|
389
|
+
| | | YYYY | 0044, 0001, 1900, 2017 | 4,6 |
|
|
390
|
+
| | | YYYYY | ... | 2,4 |
|
|
391
|
+
| ISO week-numbering year | 130 | R | -43, 1, 1900, 2017, 9999, -9999 | 4,5 |
|
|
392
|
+
| | | RR | -43, 01, 00, 17 | 4,5 |
|
|
393
|
+
| | | RRR | -043, 001, 123, 999, -999 | 4,5 |
|
|
394
|
+
| | | RRRR | -0043, 0001, 2017, 9999, -9999 | 4,5 |
|
|
395
|
+
| | | RRRRR | ... | 2,4,5 |
|
|
396
|
+
| Extended year | 130 | u | -43, 1, 1900, 2017, 9999, -999 | 4 |
|
|
397
|
+
| | | uu | -43, 01, 99, -99 | 4 |
|
|
398
|
+
| | | uuu | -043, 001, 123, 999, -999 | 4 |
|
|
399
|
+
| | | uuuu | -0043, 0001, 2017, 9999, -9999 | 4 |
|
|
400
|
+
| | | uuuuu | ... | 2,4 |
|
|
401
|
+
| Quarter (formatting) | 120 | Q | 1, 2, 3, 4 | |
|
|
402
|
+
| | | Qo | 1st, 2nd, 3rd, 4th | 5 |
|
|
403
|
+
| | | QQ | 01, 02, 03, 04 | |
|
|
404
|
+
| | | QQQ | Q1, Q2, Q3, Q4 | |
|
|
405
|
+
| | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |
|
|
406
|
+
| | | QQQQQ | 1, 2, 3, 4 | 4 |
|
|
407
|
+
| Quarter (stand-alone) | 120 | q | 1, 2, 3, 4 | |
|
|
408
|
+
| | | qo | 1st, 2nd, 3rd, 4th | 5 |
|
|
409
|
+
| | | qq | 01, 02, 03, 04 | |
|
|
410
|
+
| | | qqq | Q1, Q2, Q3, Q4 | |
|
|
411
|
+
| | | qqqq | 1st quarter, 2nd quarter, ... | 2 |
|
|
412
|
+
| | | qqqqq | 1, 2, 3, 4 | 3 |
|
|
413
|
+
| Month (formatting) | 110 | M | 1, 2, ..., 12 | |
|
|
414
|
+
| | | Mo | 1st, 2nd, ..., 12th | 5 |
|
|
415
|
+
| | | MM | 01, 02, ..., 12 | |
|
|
416
|
+
| | | MMM | Jan, Feb, ..., Dec | |
|
|
417
|
+
| | | MMMM | January, February, ..., December | 2 |
|
|
418
|
+
| | | MMMMM | J, F, ..., D | |
|
|
419
|
+
| Month (stand-alone) | 110 | L | 1, 2, ..., 12 | |
|
|
420
|
+
| | | Lo | 1st, 2nd, ..., 12th | 5 |
|
|
421
|
+
| | | LL | 01, 02, ..., 12 | |
|
|
422
|
+
| | | LLL | Jan, Feb, ..., Dec | |
|
|
423
|
+
| | | LLLL | January, February, ..., December | 2 |
|
|
424
|
+
| | | LLLLL | J, F, ..., D | |
|
|
425
|
+
| Local week of year | 100 | w | 1, 2, ..., 53 | |
|
|
426
|
+
| | | wo | 1st, 2nd, ..., 53th | 5 |
|
|
427
|
+
| | | ww | 01, 02, ..., 53 | |
|
|
428
|
+
| ISO week of year | 100 | I | 1, 2, ..., 53 | 5 |
|
|
429
|
+
| | | Io | 1st, 2nd, ..., 53th | 5 |
|
|
430
|
+
| | | II | 01, 02, ..., 53 | 5 |
|
|
431
|
+
| Day of month | 90 | d | 1, 2, ..., 31 | |
|
|
432
|
+
| | | do | 1st, 2nd, ..., 31st | 5 |
|
|
433
|
+
| | | dd | 01, 02, ..., 31 | |
|
|
434
|
+
| Day of year | 90 | D | 1, 2, ..., 365, 366 | 7 |
|
|
435
|
+
| | | Do | 1st, 2nd, ..., 365th, 366th | 5 |
|
|
436
|
+
| | | DD | 01, 02, ..., 365, 366 | 7 |
|
|
437
|
+
| | | DDD | 001, 002, ..., 365, 366 | |
|
|
438
|
+
| | | DDDD | ... | 2 |
|
|
439
|
+
| Day of week (formatting) | 90 | E..EEE | Mon, Tue, Wed, ..., Sun | |
|
|
440
|
+
| | | EEEE | Monday, Tuesday, ..., Sunday | 2 |
|
|
441
|
+
| | | EEEEE | M, T, W, T, F, S, S | |
|
|
442
|
+
| | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | |
|
|
443
|
+
| ISO day of week (formatting) | 90 | i | 1, 2, 3, ..., 7 | 5 |
|
|
444
|
+
| | | io | 1st, 2nd, ..., 7th | 5 |
|
|
445
|
+
| | | ii | 01, 02, ..., 07 | 5 |
|
|
446
|
+
| | | iii | Mon, Tue, Wed, ..., Sun | 5 |
|
|
447
|
+
| | | iiii | Monday, Tuesday, ..., Sunday | 2,5 |
|
|
448
|
+
| | | iiiii | M, T, W, T, F, S, S | 5 |
|
|
449
|
+
| | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 5 |
|
|
450
|
+
| Local day of week (formatting) | 90 | e | 2, 3, 4, ..., 1 | |
|
|
451
|
+
| | | eo | 2nd, 3rd, ..., 1st | 5 |
|
|
452
|
+
| | | ee | 02, 03, ..., 01 | |
|
|
453
|
+
| | | eee | Mon, Tue, Wed, ..., Sun | |
|
|
454
|
+
| | | eeee | Monday, Tuesday, ..., Sunday | 2 |
|
|
455
|
+
| | | eeeee | M, T, W, T, F, S, S | |
|
|
456
|
+
| | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | |
|
|
457
|
+
| Local day of week (stand-alone) | 90 | c | 2, 3, 4, ..., 1 | |
|
|
458
|
+
| | | co | 2nd, 3rd, ..., 1st | 5 |
|
|
459
|
+
| | | cc | 02, 03, ..., 01 | |
|
|
460
|
+
| | | ccc | Mon, Tue, Wed, ..., Sun | |
|
|
461
|
+
| | | cccc | Monday, Tuesday, ..., Sunday | 2 |
|
|
462
|
+
| | | ccccc | M, T, W, T, F, S, S | |
|
|
463
|
+
| | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | |
|
|
464
|
+
| AM, PM | 80 | a..aaa | AM, PM | |
|
|
465
|
+
| | | aaaa | a.m., p.m. | 2 |
|
|
466
|
+
| | | aaaaa | a, p | |
|
|
467
|
+
| AM, PM, noon, midnight | 80 | b..bbb | AM, PM, noon, midnight | |
|
|
468
|
+
| | | bbbb | a.m., p.m., noon, midnight | 2 |
|
|
469
|
+
| | | bbbbb | a, p, n, mi | |
|
|
470
|
+
| Flexible day period | 80 | B..BBB | at night, in the morning, ... | |
|
|
471
|
+
| | | BBBB | at night, in the morning, ... | 2 |
|
|
472
|
+
| | | BBBBB | at night, in the morning, ... | |
|
|
473
|
+
| Hour [1-12] | 70 | h | 1, 2, ..., 11, 12 | |
|
|
474
|
+
| | | ho | 1st, 2nd, ..., 11th, 12th | 5 |
|
|
475
|
+
| | | hh | 01, 02, ..., 11, 12 | |
|
|
476
|
+
| Hour [0-23] | 70 | H | 0, 1, 2, ..., 23 | |
|
|
477
|
+
| | | Ho | 0th, 1st, 2nd, ..., 23rd | 5 |
|
|
478
|
+
| | | HH | 00, 01, 02, ..., 23 | |
|
|
479
|
+
| Hour [0-11] | 70 | K | 1, 2, ..., 11, 0 | |
|
|
480
|
+
| | | Ko | 1st, 2nd, ..., 11th, 0th | 5 |
|
|
481
|
+
| | | KK | 01, 02, ..., 11, 00 | |
|
|
482
|
+
| Hour [1-24] | 70 | k | 24, 1, 2, ..., 23 | |
|
|
483
|
+
| | | ko | 24th, 1st, 2nd, ..., 23rd | 5 |
|
|
484
|
+
| | | kk | 24, 01, 02, ..., 23 | |
|
|
485
|
+
| Minute | 60 | m | 0, 1, ..., 59 | |
|
|
486
|
+
| | | mo | 0th, 1st, ..., 59th | 5 |
|
|
487
|
+
| | | mm | 00, 01, ..., 59 | |
|
|
488
|
+
| Second | 50 | s | 0, 1, ..., 59 | |
|
|
489
|
+
| | | so | 0th, 1st, ..., 59th | 5 |
|
|
490
|
+
| | | ss | 00, 01, ..., 59 | |
|
|
491
|
+
| Seconds timestamp | 40 | t | 512969520 | |
|
|
492
|
+
| | | tt | ... | 2 |
|
|
493
|
+
| Fraction of second | 30 | S | 0, 1, ..., 9 | |
|
|
494
|
+
| | | SS | 00, 01, ..., 99 | |
|
|
495
|
+
| | | SSS | 000, 001, ..., 999 | |
|
|
496
|
+
| | | SSSS | ... | 2 |
|
|
497
|
+
| Milliseconds timestamp | 20 | T | 512969520900 | |
|
|
498
|
+
| | | TT | ... | 2 |
|
|
499
|
+
| Timezone (ISO-8601 w/ Z) | 10 | X | -08, +0530, Z | |
|
|
500
|
+
| | | XX | -0800, +0530, Z | |
|
|
501
|
+
| | | XXX | -08:00, +05:30, Z | |
|
|
502
|
+
| | | XXXX | -0800, +0530, Z, +123456 | 2 |
|
|
503
|
+
| | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |
|
|
504
|
+
| Timezone (ISO-8601 w/o Z) | 10 | x | -08, +0530, +00 | |
|
|
505
|
+
| | | xx | -0800, +0530, +0000 | |
|
|
506
|
+
| | | xxx | -08:00, +05:30, +00:00 | 2 |
|
|
507
|
+
| | | xxxx | -0800, +0530, +0000, +123456 | |
|
|
508
|
+
| | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |
|
|
509
|
+
| Long localized date | NA | P | 05/29/1453 | 5,8 |
|
|
510
|
+
| | | PP | May 29, 1453 | |
|
|
511
|
+
| | | PPP | May 29th, 1453 | |
|
|
512
|
+
| | | PPPP | Sunday, May 29th, 1453 | 2,5,8 |
|
|
513
|
+
| Long localized time | NA | p | 12:00 AM | 5,8 |
|
|
514
|
+
| | | pp | 12:00:00 AM | |
|
|
515
|
+
| Combination of date and time | NA | Pp | 05/29/1453, 12:00 AM | |
|
|
516
|
+
| | | PPpp | May 29, 1453, 12:00:00 AM | |
|
|
517
|
+
| | | PPPpp | May 29th, 1453 at ... | |
|
|
518
|
+
| | | PPPPpp | Sunday, May 29th, 1453 at ... | 2,5,8 |
|
|
519
|
+
Notes:
|
|
520
|
+
1. "Formatting" units (e.g. formatting quarter) in the default en-US locale
|
|
521
|
+
are the same as "stand-alone" units, but are different in some languages.
|
|
522
|
+
"Formatting" units are declined according to the rules of the language
|
|
523
|
+
in the context of a date. "Stand-alone" units are always nominative singular.
|
|
524
|
+
In `format` function, they will produce different result:
|
|
525
|
+
|
|
526
|
+
`format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`
|
|
527
|
+
|
|
528
|
+
`format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`
|
|
529
|
+
|
|
530
|
+
`parse` will try to match both formatting and stand-alone units interchangably.
|
|
531
|
+
|
|
532
|
+
2. Any sequence of the identical letters is a pattern, unless it is escaped by
|
|
533
|
+
the single quote characters (see below).
|
|
534
|
+
If the sequence is longer than listed in table:
|
|
535
|
+
- for numerical units (`yyyyyyyy`) `parse` will try to match a number
|
|
536
|
+
as wide as the sequence
|
|
537
|
+
- for text units (`MMMMMMMM`) `parse` will try to match the widest variation of the unit.
|
|
538
|
+
These variations are marked with "2" in the last column of the table.
|
|
539
|
+
|
|
540
|
+
3. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.
|
|
541
|
+
These tokens represent the shortest form of the quarter.
|
|
542
|
+
|
|
543
|
+
4. The main difference between `y` and `u` patterns are B.C. years:
|
|
544
|
+
|
|
545
|
+
| Year | `y` | `u` |
|
|
546
|
+
|------|-----|-----|
|
|
547
|
+
| AC 1 | 1 | 1 |
|
|
548
|
+
| BC 1 | 1 | 0 |
|
|
549
|
+
| BC 2 | 2 | -1 |
|
|
550
|
+
|
|
551
|
+
Also `yy` will try to guess the century of two digit year by proximity with `referenceDate`:
|
|
552
|
+
|
|
553
|
+
`parse('50', 'yy', new Date(2018, 0, 1)) //=> Sat Jan 01 2050 00:00:00`
|
|
554
|
+
|
|
555
|
+
`parse('75', 'yy', new Date(2018, 0, 1)) //=> Wed Jan 01 1975 00:00:00`
|
|
556
|
+
|
|
557
|
+
while `uu` will just assign the year as is:
|
|
558
|
+
|
|
559
|
+
`parse('50', 'uu', new Date(2018, 0, 1)) //=> Sat Jan 01 0050 00:00:00`
|
|
560
|
+
|
|
561
|
+
`parse('75', 'uu', new Date(2018, 0, 1)) //=> Tue Jan 01 0075 00:00:00`
|
|
562
|
+
|
|
563
|
+
The same difference is true for local and ISO week-numbering years (`Y` and `R`),
|
|
564
|
+
except local week-numbering years are dependent on `options.weekStartsOn`
|
|
565
|
+
and `options.firstWeekContainsDate` (compare [setISOWeekYear](https://date-fns.org/docs/setISOWeekYear)
|
|
566
|
+
and [setWeekYear](https://date-fns.org/docs/setWeekYear)).
|
|
567
|
+
|
|
568
|
+
5. These patterns are not in the Unicode Technical Standard #35:
|
|
569
|
+
- `i`: ISO day of week
|
|
570
|
+
- `I`: ISO week of year
|
|
571
|
+
- `R`: ISO week-numbering year
|
|
572
|
+
- `o`: ordinal number modifier
|
|
573
|
+
- `P`: long localized date
|
|
574
|
+
- `p`: long localized time
|
|
575
|
+
|
|
576
|
+
6. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.
|
|
577
|
+
You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
578
|
+
|
|
579
|
+
7. `D` and `DD` tokens represent days of the year but they are ofthen confused with days of the month.
|
|
580
|
+
You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
581
|
+
|
|
582
|
+
8. `P+` tokens do not have a defined priority since they are merely aliases to other tokens based
|
|
583
|
+
on the given locale.
|
|
584
|
+
|
|
585
|
+
using `en-US` locale: `P` => `MM/dd/yyyy`
|
|
586
|
+
using `en-US` locale: `p` => `hh:mm a`
|
|
587
|
+
using `pt-BR` locale: `P` => `dd/MM/yyyy`
|
|
588
|
+
using `pt-BR` locale: `p` => `HH:mm`
|
|
589
|
+
|
|
590
|
+
Values will be assigned to the date in the descending order of its unit's priority.
|
|
591
|
+
Units of an equal priority overwrite each other in the order of appearance.
|
|
592
|
+
|
|
593
|
+
If no values of higher priority are parsed (e.g. when parsing string 'January 1st' without a year),
|
|
594
|
+
the values will be taken from 3rd argument `referenceDate` which works as a context of parsing.
|
|
595
|
+
|
|
596
|
+
`referenceDate` must be passed for correct work of the function.
|
|
597
|
+
If you're not sure which `referenceDate` to supply, create a new instance of Date:
|
|
598
|
+
`parse('02/11/2014', 'MM/dd/yyyy', new Date())`
|
|
599
|
+
In this case parsing will be done in the context of the current date.
|
|
600
|
+
If `referenceDate` is `Invalid Date` or a value not convertible to valid `Date`,
|
|
601
|
+
then `Invalid Date` will be returned.
|
|
602
|
+
|
|
603
|
+
The result may vary by locale.
|
|
604
|
+
|
|
605
|
+
If `formatString` matches with `dateString` but does not provides tokens, `referenceDate` will be returned.
|
|
606
|
+
|
|
607
|
+
If parsing failed, `Invalid Date` will be returned.
|
|
608
|
+
Invalid Date is a Date, whose time value is NaN.
|
|
609
|
+
Time value of Date: http://es5.github.io/#x15.9.1.1
|
|
610
|
+
|
|
611
|
+
**`Throws`**
|
|
612
|
+
|
|
613
|
+
`options.locale` must contain `match` property
|
|
614
|
+
|
|
615
|
+
**`Throws`**
|
|
616
|
+
|
|
617
|
+
use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
618
|
+
|
|
619
|
+
**`Throws`**
|
|
620
|
+
|
|
621
|
+
use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
622
|
+
|
|
623
|
+
**`Throws`**
|
|
624
|
+
|
|
625
|
+
use `d` instead of `D` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
626
|
+
|
|
627
|
+
**`Throws`**
|
|
628
|
+
|
|
629
|
+
use `dd` instead of `DD` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
630
|
+
|
|
631
|
+
**`Throws`**
|
|
632
|
+
|
|
633
|
+
format string contains an unescaped latin alphabet character
|
|
634
|
+
|
|
635
|
+
**`Example`**
|
|
636
|
+
|
|
637
|
+
```ts
|
|
638
|
+
// Parse 11 February 2014 from middle-endian format:
|
|
639
|
+
var result = parse('02/11/2014', 'MM/dd/yyyy', new Date())
|
|
640
|
+
//=> Tue Feb 11 2014 00:00:00
|
|
641
|
+
```
|
|
642
|
+
|
|
643
|
+
**`Example`**
|
|
644
|
+
|
|
645
|
+
```ts
|
|
646
|
+
// Parse 28th of February in Esperanto locale in the context of 2010 year:
|
|
647
|
+
import eo from 'date-fns/locale/eo'
|
|
648
|
+
var result = parse('28-a de februaro', "do 'de' MMMM", new Date(2010, 0, 1), {
|
|
649
|
+
locale: eo
|
|
650
|
+
})
|
|
651
|
+
//=> Sun Feb 28 2010 00:00:00
|
|
652
|
+
```
|
|
653
|
+
|
|
654
|
+
#### Defined in
|
|
655
|
+
|
|
656
|
+
node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/parse.d.ts:315
|
|
657
|
+
|
|
658
|
+
___
|
|
659
|
+
|
|
660
|
+
### parseISO
|
|
661
|
+
|
|
662
|
+
▸ **parseISO**(`argument`, `options?`): `Date`
|
|
663
|
+
|
|
664
|
+
#### Parameters
|
|
665
|
+
|
|
666
|
+
| Name | Type | Description |
|
|
667
|
+
| :------ | :------ | :------ |
|
|
668
|
+
| `argument` | `string` | The value to convert |
|
|
669
|
+
| `options?` | `ParseISOOptions` | An object with options |
|
|
670
|
+
|
|
671
|
+
#### Returns
|
|
672
|
+
|
|
673
|
+
`Date`
|
|
674
|
+
|
|
675
|
+
The parsed date in the local time zone
|
|
676
|
+
|
|
677
|
+
**`Name`**
|
|
678
|
+
|
|
679
|
+
parseISO
|
|
680
|
+
|
|
681
|
+
**`Summary`**
|
|
682
|
+
|
|
683
|
+
Parse ISO string
|
|
684
|
+
|
|
685
|
+
**`Description`**
|
|
686
|
+
|
|
687
|
+
Parse the given string in ISO 8601 format and return an instance of Date.
|
|
688
|
+
|
|
689
|
+
Function accepts complete ISO 8601 formats as well as partial implementations.
|
|
690
|
+
ISO 8601: http://en.wikipedia.org/wiki/ISO_8601
|
|
691
|
+
|
|
692
|
+
If the argument isn't a string, the function cannot parse the string or
|
|
693
|
+
the values are invalid, it returns Invalid Date.
|
|
694
|
+
|
|
695
|
+
**`Example`**
|
|
696
|
+
|
|
697
|
+
```ts
|
|
698
|
+
// Convert string '2014-02-11T11:30:30' to date:
|
|
699
|
+
const result = parseISO('2014-02-11T11:30:30')
|
|
700
|
+
//=> Tue Feb 11 2014 11:30:30
|
|
701
|
+
```
|
|
702
|
+
|
|
703
|
+
**`Example`**
|
|
704
|
+
|
|
705
|
+
```ts
|
|
706
|
+
// Convert string '+02014101' to date,
|
|
707
|
+
// if the additional number of digits in the extended year format is 1:
|
|
708
|
+
const result = parseISO('+02014101', { additionalDigits: 1 })
|
|
709
|
+
//=> Fri Apr 11 2014 00:00:00
|
|
710
|
+
```
|
|
711
|
+
|
|
712
|
+
#### Defined in
|
|
713
|
+
|
|
714
|
+
node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/parseISO.d.ts:40
|
|
715
|
+
|
|
716
|
+
___
|
|
717
|
+
|
|
718
|
+
### toDate
|
|
719
|
+
|
|
720
|
+
▸ **toDate**\<`DateType`\>(`argument`): `DateType`
|
|
721
|
+
|
|
722
|
+
#### Type parameters
|
|
723
|
+
|
|
724
|
+
| Name | Type | Description |
|
|
725
|
+
| :------ | :------ | :------ |
|
|
726
|
+
| `DateType` | extends `Date` | The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). |
|
|
727
|
+
|
|
728
|
+
#### Parameters
|
|
729
|
+
|
|
730
|
+
| Name | Type | Description |
|
|
731
|
+
| :------ | :------ | :------ |
|
|
732
|
+
| `argument` | `string` \| `number` \| `DateType` | The value to convert |
|
|
733
|
+
|
|
734
|
+
#### Returns
|
|
735
|
+
|
|
736
|
+
`DateType`
|
|
737
|
+
|
|
738
|
+
The parsed date in the local time zone
|
|
739
|
+
|
|
740
|
+
**`Name`**
|
|
741
|
+
|
|
742
|
+
toDate
|
|
743
|
+
|
|
744
|
+
**`Summary`**
|
|
745
|
+
|
|
746
|
+
Convert the given argument to an instance of Date.
|
|
747
|
+
|
|
748
|
+
**`Description`**
|
|
749
|
+
|
|
750
|
+
Convert the given argument to an instance of Date.
|
|
751
|
+
|
|
752
|
+
If the argument is an instance of Date, the function returns its clone.
|
|
753
|
+
|
|
754
|
+
If the argument is a number, it is treated as a timestamp.
|
|
755
|
+
|
|
756
|
+
If the argument is none of the above, the function returns Invalid Date.
|
|
757
|
+
|
|
758
|
+
**Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
|
|
759
|
+
|
|
760
|
+
**`Example`**
|
|
761
|
+
|
|
762
|
+
```ts
|
|
763
|
+
// Clone the date:
|
|
764
|
+
const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
|
|
765
|
+
//=> Tue Feb 11 2014 11:30:30
|
|
766
|
+
```
|
|
767
|
+
|
|
768
|
+
**`Example`**
|
|
769
|
+
|
|
770
|
+
```ts
|
|
771
|
+
// Convert the timestamp to date:
|
|
772
|
+
const result = toDate(1392098430000)
|
|
773
|
+
//=> Tue Feb 11 2014 11:30:30
|
|
774
|
+
```
|
|
775
|
+
|
|
776
|
+
#### Defined in
|
|
777
|
+
|
|
778
|
+
node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/toDate.d.ts:33
|
|
779
|
+
|
|
780
|
+
## Other
|
|
212
781
|
|
|
213
782
|
### AIChatContentPart
|
|
214
783
|
|
|
@@ -216,7 +785,7 @@
|
|
|
216
785
|
|
|
217
786
|
#### Defined in
|
|
218
787
|
|
|
219
|
-
[packages/ai-tool/src/utils/chat.ts:
|
|
788
|
+
[packages/ai-tool/src/utils/chat.ts:74](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/chat.ts#L74)
|
|
220
789
|
|
|
221
790
|
___
|
|
222
791
|
|
|
@@ -226,7 +795,7 @@ ___
|
|
|
226
795
|
|
|
227
796
|
#### Defined in
|
|
228
797
|
|
|
229
|
-
[packages/ai-tool/src/utils/chat.ts:
|
|
798
|
+
[packages/ai-tool/src/utils/chat.ts:44](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/chat.ts#L44)
|
|
230
799
|
|
|
231
800
|
___
|
|
232
801
|
|
|
@@ -236,7 +805,7 @@ ___
|
|
|
236
805
|
|
|
237
806
|
#### Defined in
|
|
238
807
|
|
|
239
|
-
[packages/ai-tool/src/utils/chat.ts:
|
|
808
|
+
[packages/ai-tool/src/utils/chat.ts:42](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/chat.ts#L42)
|
|
240
809
|
|
|
241
810
|
___
|
|
242
811
|
|
|
@@ -246,7 +815,7 @@ ___
|
|
|
246
815
|
|
|
247
816
|
#### Defined in
|
|
248
817
|
|
|
249
|
-
[packages/ai-tool/src/utils/chat.ts:
|
|
818
|
+
[packages/ai-tool/src/utils/chat.ts:36](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/chat.ts#L36)
|
|
250
819
|
|
|
251
820
|
___
|
|
252
821
|
|
|
@@ -256,7 +825,7 @@ ___
|
|
|
256
825
|
|
|
257
826
|
#### Defined in
|
|
258
827
|
|
|
259
|
-
[packages/ai-tool/src/utils/consts.ts:10](https://github.com/isdk/ai-tool.js/blob/
|
|
828
|
+
[packages/ai-tool/src/utils/consts.ts:10](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/consts.ts#L10)
|
|
260
829
|
|
|
261
830
|
___
|
|
262
831
|
|
|
@@ -280,7 +849,7 @@ ___
|
|
|
280
849
|
|
|
281
850
|
#### Defined in
|
|
282
851
|
|
|
283
|
-
[packages/ai-tool/src/utils/consts.ts:8](https://github.com/isdk/ai-tool.js/blob/
|
|
852
|
+
[packages/ai-tool/src/utils/consts.ts:8](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/consts.ts#L8)
|
|
284
853
|
|
|
285
854
|
___
|
|
286
855
|
|
|
@@ -290,7 +859,7 @@ ___
|
|
|
290
859
|
|
|
291
860
|
#### Defined in
|
|
292
861
|
|
|
293
|
-
[packages/ai-tool/src/utils/consts.ts:11](https://github.com/isdk/ai-tool.js/blob/
|
|
862
|
+
[packages/ai-tool/src/utils/consts.ts:11](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/consts.ts#L11)
|
|
294
863
|
|
|
295
864
|
___
|
|
296
865
|
|
|
@@ -300,7 +869,7 @@ ___
|
|
|
300
869
|
|
|
301
870
|
#### Defined in
|
|
302
871
|
|
|
303
|
-
[packages/ai-tool/src/utils/chat.ts:
|
|
872
|
+
[packages/ai-tool/src/utils/chat.ts:13](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/chat.ts#L13)
|
|
304
873
|
|
|
305
874
|
___
|
|
306
875
|
|
|
@@ -310,7 +879,17 @@ ___
|
|
|
310
879
|
|
|
311
880
|
#### Defined in
|
|
312
881
|
|
|
313
|
-
[packages/ai-tool/src/utils/consts.ts:6](https://github.com/isdk/ai-tool.js/blob/
|
|
882
|
+
[packages/ai-tool/src/utils/consts.ts:6](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/consts.ts#L6)
|
|
883
|
+
|
|
884
|
+
___
|
|
885
|
+
|
|
886
|
+
### AsyncTaskId
|
|
887
|
+
|
|
888
|
+
Ƭ **AsyncTaskId**: `string` \| `number`
|
|
889
|
+
|
|
890
|
+
#### Defined in
|
|
891
|
+
|
|
892
|
+
[packages/ai-tool/src/utils/cancelable-ability.ts:8](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/cancelable-ability.ts#L8)
|
|
314
893
|
|
|
315
894
|
___
|
|
316
895
|
|
|
@@ -320,7 +899,7 @@ ___
|
|
|
320
899
|
|
|
321
900
|
#### Defined in
|
|
322
901
|
|
|
323
|
-
[packages/ai-tool/src/utils/base-error.ts:3](https://github.com/isdk/ai-tool.js/blob/
|
|
902
|
+
[packages/ai-tool/src/utils/base-error.ts:3](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/base-error.ts#L3)
|
|
324
903
|
|
|
325
904
|
___
|
|
326
905
|
|
|
@@ -347,7 +926,7 @@ ___
|
|
|
347
926
|
|
|
348
927
|
#### Defined in
|
|
349
928
|
|
|
350
|
-
[packages/ai-tool/src/utils/event/event-ability.ts:9](https://github.com/isdk/ai-tool.js/blob/
|
|
929
|
+
[packages/ai-tool/src/utils/event/event-ability.ts:9](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/event/event-ability.ts#L9)
|
|
351
930
|
|
|
352
931
|
___
|
|
353
932
|
|
|
@@ -373,7 +952,7 @@ ___
|
|
|
373
952
|
|
|
374
953
|
#### Defined in
|
|
375
954
|
|
|
376
|
-
[packages/ai-tool/src/utils/event/event-ability.ts:8](https://github.com/isdk/ai-tool.js/blob/
|
|
955
|
+
[packages/ai-tool/src/utils/event/event-ability.ts:8](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/event/event-ability.ts#L8)
|
|
377
956
|
|
|
378
957
|
___
|
|
379
958
|
|
|
@@ -386,7 +965,7 @@ a literal text or a variable name.
|
|
|
386
965
|
|
|
387
966
|
#### Defined in
|
|
388
967
|
|
|
389
|
-
[packages/ai-tool/src/utils/prompt/template/python.ts:6](https://github.com/isdk/ai-tool.js/blob/
|
|
968
|
+
[packages/ai-tool/src/utils/prompt/template/python.ts:6](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/prompt/template/python.ts#L6)
|
|
390
969
|
|
|
391
970
|
___
|
|
392
971
|
|
|
@@ -396,7 +975,7 @@ ___
|
|
|
396
975
|
|
|
397
976
|
#### Defined in
|
|
398
977
|
|
|
399
|
-
[packages/ai-tool/src/tool-func.ts:
|
|
978
|
+
[packages/ai-tool/src/tool-func.ts:24](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/tool-func.ts#L24)
|
|
400
979
|
|
|
401
980
|
___
|
|
402
981
|
|
|
@@ -412,7 +991,7 @@ ___
|
|
|
412
991
|
|
|
413
992
|
#### Defined in
|
|
414
993
|
|
|
415
|
-
[packages/ai-tool/src/utils/prompt/prompt-example-selector.ts:3](https://github.com/isdk/ai-tool.js/blob/
|
|
994
|
+
[packages/ai-tool/src/utils/prompt/prompt-example-selector.ts:3](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/prompt/prompt-example-selector.ts#L3)
|
|
416
995
|
|
|
417
996
|
___
|
|
418
997
|
|
|
@@ -422,7 +1001,7 @@ ___
|
|
|
422
1001
|
|
|
423
1002
|
#### Defined in
|
|
424
1003
|
|
|
425
|
-
[packages/ai-tool/src/utils/prompt/consts.ts:17](https://github.com/isdk/ai-tool.js/blob/
|
|
1004
|
+
[packages/ai-tool/src/utils/prompt/consts.ts:17](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/prompt/consts.ts#L17)
|
|
426
1005
|
|
|
427
1006
|
___
|
|
428
1007
|
|
|
@@ -432,7 +1011,7 @@ ___
|
|
|
432
1011
|
|
|
433
1012
|
#### Defined in
|
|
434
1013
|
|
|
435
|
-
[packages/ai-tool/src/utils/prompt/consts.ts:10](https://github.com/isdk/ai-tool.js/blob/
|
|
1014
|
+
[packages/ai-tool/src/utils/prompt/consts.ts:10](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/prompt/consts.ts#L10)
|
|
436
1015
|
|
|
437
1016
|
___
|
|
438
1017
|
|
|
@@ -457,9 +1036,9 @@ ___
|
|
|
457
1036
|
|
|
458
1037
|
#### Defined in
|
|
459
1038
|
|
|
460
|
-
[packages/ai-tool/src/tool-func.ts:
|
|
1039
|
+
[packages/ai-tool/src/tool-func.ts:38](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/tool-func.ts#L38)
|
|
461
1040
|
|
|
462
|
-
|
|
1041
|
+
___
|
|
463
1042
|
|
|
464
1043
|
### AIChatRoles
|
|
465
1044
|
|
|
@@ -467,7 +1046,7 @@ ___
|
|
|
467
1046
|
|
|
468
1047
|
#### Defined in
|
|
469
1048
|
|
|
470
|
-
[packages/ai-tool/src/utils/chat.ts:
|
|
1049
|
+
[packages/ai-tool/src/utils/chat.ts:41](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/chat.ts#L41)
|
|
471
1050
|
|
|
472
1051
|
___
|
|
473
1052
|
|
|
@@ -477,7 +1056,7 @@ ___
|
|
|
477
1056
|
|
|
478
1057
|
#### Defined in
|
|
479
1058
|
|
|
480
|
-
[packages/ai-tool/src/utils/chat.ts:
|
|
1059
|
+
[packages/ai-tool/src/utils/chat.ts:35](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/chat.ts#L35)
|
|
481
1060
|
|
|
482
1061
|
___
|
|
483
1062
|
|
|
@@ -487,7 +1066,7 @@ ___
|
|
|
487
1066
|
|
|
488
1067
|
#### Defined in
|
|
489
1068
|
|
|
490
|
-
[packages/ai-tool/src/utils/chat.ts:
|
|
1069
|
+
[packages/ai-tool/src/utils/chat.ts:4](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/chat.ts#L4)
|
|
491
1070
|
|
|
492
1071
|
___
|
|
493
1072
|
|
|
@@ -497,7 +1076,7 @@ ___
|
|
|
497
1076
|
|
|
498
1077
|
#### Defined in
|
|
499
1078
|
|
|
500
|
-
[packages/ai-tool/src/utils/base-error.ts:
|
|
1079
|
+
[packages/ai-tool/src/utils/base-error.ts:33](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/base-error.ts#L33)
|
|
501
1080
|
|
|
502
1081
|
___
|
|
503
1082
|
|
|
@@ -507,7 +1086,7 @@ ___
|
|
|
507
1086
|
|
|
508
1087
|
#### Defined in
|
|
509
1088
|
|
|
510
|
-
[packages/ai-tool/src/utils/consts.ts:5](https://github.com/isdk/ai-tool.js/blob/
|
|
1089
|
+
[packages/ai-tool/src/utils/consts.ts:5](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/consts.ts#L5)
|
|
511
1090
|
|
|
512
1091
|
___
|
|
513
1092
|
|
|
@@ -517,7 +1096,7 @@ ___
|
|
|
517
1096
|
|
|
518
1097
|
#### Defined in
|
|
519
1098
|
|
|
520
|
-
[packages/ai-tool/src/utils/base-error.ts:
|
|
1099
|
+
[packages/ai-tool/src/utils/base-error.ts:32](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/base-error.ts#L32)
|
|
521
1100
|
|
|
522
1101
|
___
|
|
523
1102
|
|
|
@@ -545,7 +1124,17 @@ ___
|
|
|
545
1124
|
|
|
546
1125
|
#### Defined in
|
|
547
1126
|
|
|
548
|
-
[packages/ai-tool/src/client-tools.ts:153](https://github.com/isdk/ai-tool.js/blob/
|
|
1127
|
+
[packages/ai-tool/src/client-tools.ts:153](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/client-tools.ts#L153)
|
|
1128
|
+
|
|
1129
|
+
___
|
|
1130
|
+
|
|
1131
|
+
### DefaultAsyncSemaphoreCapacity
|
|
1132
|
+
|
|
1133
|
+
• `Const` **DefaultAsyncSemaphoreCapacity**: ``32``
|
|
1134
|
+
|
|
1135
|
+
#### Defined in
|
|
1136
|
+
|
|
1137
|
+
[packages/ai-tool/src/utils/async-semaphore.ts:6](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/async-semaphore.ts#L6)
|
|
549
1138
|
|
|
550
1139
|
___
|
|
551
1140
|
|
|
@@ -555,7 +1144,7 @@ ___
|
|
|
555
1144
|
|
|
556
1145
|
#### Defined in
|
|
557
1146
|
|
|
558
|
-
[packages/ai-tool/src/utils/event/event-ability.ts:7](https://github.com/isdk/ai-tool.js/blob/
|
|
1147
|
+
[packages/ai-tool/src/utils/event/event-ability.ts:7](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/event/event-ability.ts#L7)
|
|
559
1148
|
|
|
560
1149
|
___
|
|
561
1150
|
|
|
@@ -565,7 +1154,7 @@ ___
|
|
|
565
1154
|
|
|
566
1155
|
#### Defined in
|
|
567
1156
|
|
|
568
|
-
[packages/ai-tool/src/utils/event/event-ability.ts:6](https://github.com/isdk/ai-tool.js/blob/
|
|
1157
|
+
[packages/ai-tool/src/utils/event/event-ability.ts:6](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/event/event-ability.ts#L6)
|
|
569
1158
|
|
|
570
1159
|
___
|
|
571
1160
|
|
|
@@ -578,7 +1167,7 @@ do not use /g global option here: when the regex is executed multiple times, it
|
|
|
578
1167
|
|
|
579
1168
|
#### Defined in
|
|
580
1169
|
|
|
581
|
-
[packages/ai-tool/src/utils/filename.ts:8](https://github.com/isdk/ai-tool.js/blob/
|
|
1170
|
+
[packages/ai-tool/src/utils/filename.ts:8](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/filename.ts#L8)
|
|
582
1171
|
|
|
583
1172
|
___
|
|
584
1173
|
|
|
@@ -595,7 +1184,7 @@ ___
|
|
|
595
1184
|
|
|
596
1185
|
#### Defined in
|
|
597
1186
|
|
|
598
|
-
[packages/ai-tool/src/utils/prompt/template/jinja/src/builtins.ts:52](https://github.com/isdk/ai-tool.js/blob/
|
|
1187
|
+
[packages/ai-tool/src/utils/prompt/template/jinja/src/builtins.ts:52](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/prompt/template/jinja/src/builtins.ts#L52)
|
|
599
1188
|
|
|
600
1189
|
___
|
|
601
1190
|
|
|
@@ -605,7 +1194,7 @@ ___
|
|
|
605
1194
|
|
|
606
1195
|
#### Defined in
|
|
607
1196
|
|
|
608
|
-
[packages/ai-tool/src/utils/base-error.ts:
|
|
1197
|
+
[packages/ai-tool/src/utils/base-error.ts:29](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/base-error.ts#L29)
|
|
609
1198
|
|
|
610
1199
|
___
|
|
611
1200
|
|
|
@@ -615,7 +1204,7 @@ ___
|
|
|
615
1204
|
|
|
616
1205
|
#### Defined in
|
|
617
1206
|
|
|
618
|
-
[packages/ai-tool/src/utils/base-error.ts:
|
|
1207
|
+
[packages/ai-tool/src/utils/base-error.ts:31](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/base-error.ts#L31)
|
|
619
1208
|
|
|
620
1209
|
___
|
|
621
1210
|
|
|
@@ -625,7 +1214,7 @@ ___
|
|
|
625
1214
|
|
|
626
1215
|
#### Defined in
|
|
627
1216
|
|
|
628
|
-
[packages/ai-tool/src/utils/base-error.ts:
|
|
1217
|
+
[packages/ai-tool/src/utils/base-error.ts:30](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/base-error.ts#L30)
|
|
629
1218
|
|
|
630
1219
|
___
|
|
631
1220
|
|
|
@@ -635,7 +1224,7 @@ ___
|
|
|
635
1224
|
|
|
636
1225
|
#### Defined in
|
|
637
1226
|
|
|
638
|
-
[packages/ai-tool/src/utils/consts.ts:3](https://github.com/isdk/ai-tool.js/blob/
|
|
1227
|
+
[packages/ai-tool/src/utils/consts.ts:3](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/consts.ts#L3)
|
|
639
1228
|
|
|
640
1229
|
___
|
|
641
1230
|
|
|
@@ -645,7 +1234,7 @@ ___
|
|
|
645
1234
|
|
|
646
1235
|
#### Defined in
|
|
647
1236
|
|
|
648
|
-
[packages/ai-tool/src/utils/prompt/consts.ts:12](https://github.com/isdk/ai-tool.js/blob/
|
|
1237
|
+
[packages/ai-tool/src/utils/prompt/consts.ts:12](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/prompt/consts.ts#L12)
|
|
649
1238
|
|
|
650
1239
|
___
|
|
651
1240
|
|
|
@@ -658,7 +1247,7 @@ defaults to `chat`
|
|
|
658
1247
|
|
|
659
1248
|
#### Defined in
|
|
660
1249
|
|
|
661
|
-
[packages/ai-tool/src/utils/prompt/consts.ts:5](https://github.com/isdk/ai-tool.js/blob/
|
|
1250
|
+
[packages/ai-tool/src/utils/prompt/consts.ts:5](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/prompt/consts.ts#L5)
|
|
662
1251
|
|
|
663
1252
|
___
|
|
664
1253
|
|
|
@@ -668,7 +1257,7 @@ ___
|
|
|
668
1257
|
|
|
669
1258
|
#### Defined in
|
|
670
1259
|
|
|
671
|
-
[packages/ai-tool/src/utils/stream/error-readable-stream.ts:3](https://github.com/isdk/ai-tool.js/blob/
|
|
1260
|
+
[packages/ai-tool/src/utils/stream/error-readable-stream.ts:3](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/stream/error-readable-stream.ts#L3)
|
|
672
1261
|
|
|
673
1262
|
___
|
|
674
1263
|
|
|
@@ -696,7 +1285,7 @@ ___
|
|
|
696
1285
|
|
|
697
1286
|
#### Defined in
|
|
698
1287
|
|
|
699
|
-
[packages/ai-tool/src/utils/consts.ts:13](https://github.com/isdk/ai-tool.js/blob/
|
|
1288
|
+
[packages/ai-tool/src/utils/consts.ts:13](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/consts.ts#L13)
|
|
700
1289
|
|
|
701
1290
|
___
|
|
702
1291
|
|
|
@@ -714,7 +1303,7 @@ ___
|
|
|
714
1303
|
|
|
715
1304
|
#### Defined in
|
|
716
1305
|
|
|
717
|
-
[packages/ai-tool/src/res-client-tools.ts:68](https://github.com/isdk/ai-tool.js/blob/
|
|
1306
|
+
[packages/ai-tool/src/res-client-tools.ts:68](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/res-client-tools.ts#L68)
|
|
718
1307
|
|
|
719
1308
|
___
|
|
720
1309
|
|
|
@@ -731,7 +1320,7 @@ ___
|
|
|
731
1320
|
|
|
732
1321
|
#### Defined in
|
|
733
1322
|
|
|
734
|
-
[packages/ai-tool/src/res-server-tools.ts:77](https://github.com/isdk/ai-tool.js/blob/
|
|
1323
|
+
[packages/ai-tool/src/res-server-tools.ts:77](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/res-server-tools.ts#L77)
|
|
735
1324
|
|
|
736
1325
|
___
|
|
737
1326
|
|
|
@@ -741,7 +1330,7 @@ ___
|
|
|
741
1330
|
|
|
742
1331
|
#### Defined in
|
|
743
1332
|
|
|
744
|
-
[packages/ai-tool/src/utils/stream/error-readable-stream.ts:4](https://github.com/isdk/ai-tool.js/blob/
|
|
1333
|
+
[packages/ai-tool/src/utils/stream/error-readable-stream.ts:4](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/stream/error-readable-stream.ts#L4)
|
|
745
1334
|
|
|
746
1335
|
___
|
|
747
1336
|
|
|
@@ -751,7 +1340,7 @@ ___
|
|
|
751
1340
|
|
|
752
1341
|
#### Defined in
|
|
753
1342
|
|
|
754
|
-
[packages/ai-tool/src/utils/event/sse-channel.ts:17](https://github.com/isdk/ai-tool.js/blob/
|
|
1343
|
+
[packages/ai-tool/src/utils/event/sse-channel.ts:17](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/event/sse-channel.ts#L17)
|
|
755
1344
|
|
|
756
1345
|
___
|
|
757
1346
|
|
|
@@ -779,7 +1368,37 @@ ___
|
|
|
779
1368
|
|
|
780
1369
|
#### Defined in
|
|
781
1370
|
|
|
782
|
-
[packages/ai-tool/src/server-tools.ts:66](https://github.com/isdk/ai-tool.js/blob/
|
|
1371
|
+
[packages/ai-tool/src/server-tools.ts:66](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/server-tools.ts#L66)
|
|
1372
|
+
|
|
1373
|
+
___
|
|
1374
|
+
|
|
1375
|
+
### ToolAsyncCancelableBit
|
|
1376
|
+
|
|
1377
|
+
• `Const` **ToolAsyncCancelableBit**: ``1``
|
|
1378
|
+
|
|
1379
|
+
#### Defined in
|
|
1380
|
+
|
|
1381
|
+
[packages/ai-tool/src/tool-func.ts:8](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/tool-func.ts#L8)
|
|
1382
|
+
|
|
1383
|
+
___
|
|
1384
|
+
|
|
1385
|
+
### ToolAsyncMultiTaskBit
|
|
1386
|
+
|
|
1387
|
+
• `Const` **ToolAsyncMultiTaskBit**: ``0``
|
|
1388
|
+
|
|
1389
|
+
#### Defined in
|
|
1390
|
+
|
|
1391
|
+
[packages/ai-tool/src/tool-func.ts:7](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/tool-func.ts#L7)
|
|
1392
|
+
|
|
1393
|
+
___
|
|
1394
|
+
|
|
1395
|
+
### ToolAsyncPriorityBit
|
|
1396
|
+
|
|
1397
|
+
• `Const` **ToolAsyncPriorityBit**: ``2``
|
|
1398
|
+
|
|
1399
|
+
#### Defined in
|
|
1400
|
+
|
|
1401
|
+
[packages/ai-tool/src/tool-func.ts:9](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/tool-func.ts#L9)
|
|
783
1402
|
|
|
784
1403
|
___
|
|
785
1404
|
|
|
@@ -791,6 +1410,8 @@ ___
|
|
|
791
1410
|
|
|
792
1411
|
| Name | Type |
|
|
793
1412
|
| :------ | :------ |
|
|
1413
|
+
| `asyncFeatures` | \{ `type`: `string` = 'number' } |
|
|
1414
|
+
| `asyncFeatures.type` | `string` |
|
|
794
1415
|
| `depends` | \{ `exported`: `boolean` = false; `type`: `string` = 'object' } |
|
|
795
1416
|
| `depends.exported` | `boolean` |
|
|
796
1417
|
| `depends.type` | `string` |
|
|
@@ -812,7 +1433,7 @@ ___
|
|
|
812
1433
|
|
|
813
1434
|
#### Defined in
|
|
814
1435
|
|
|
815
|
-
[packages/ai-tool/src/tool-func.ts:
|
|
1436
|
+
[packages/ai-tool/src/tool-func.ts:342](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/tool-func.ts#L342)
|
|
816
1437
|
|
|
817
1438
|
___
|
|
818
1439
|
|
|
@@ -824,7 +1445,7 @@ Regular expression pattern for reserved names on Windows systems.
|
|
|
824
1445
|
|
|
825
1446
|
#### Defined in
|
|
826
1447
|
|
|
827
|
-
[packages/ai-tool/src/utils/filename.ts:13](https://github.com/isdk/ai-tool.js/blob/
|
|
1448
|
+
[packages/ai-tool/src/utils/filename.ts:13](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/filename.ts#L13)
|
|
828
1449
|
|
|
829
1450
|
___
|
|
830
1451
|
|
|
@@ -834,7 +1455,7 @@ ___
|
|
|
834
1455
|
|
|
835
1456
|
#### Defined in
|
|
836
1457
|
|
|
837
|
-
[packages/ai-tool/src/utils/hash/xxhash.ts:5](https://github.com/isdk/ai-tool.js/blob/
|
|
1458
|
+
[packages/ai-tool/src/utils/hash/xxhash.ts:5](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/hash/xxhash.ts#L5)
|
|
838
1459
|
|
|
839
1460
|
___
|
|
840
1461
|
|
|
@@ -844,7 +1465,7 @@ ___
|
|
|
844
1465
|
|
|
845
1466
|
#### Defined in
|
|
846
1467
|
|
|
847
|
-
[packages/ai-tool/src/utils/prompt/prompt-template.ts:8](https://github.com/isdk/ai-tool.js/blob/
|
|
1468
|
+
[packages/ai-tool/src/utils/prompt/prompt-template.ts:8](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/prompt/prompt-template.ts#L8)
|
|
848
1469
|
|
|
849
1470
|
___
|
|
850
1471
|
|
|
@@ -854,7 +1475,7 @@ ___
|
|
|
854
1475
|
|
|
855
1476
|
#### Defined in
|
|
856
1477
|
|
|
857
|
-
[packages/ai-tool/src/funcs/event.ts:22](https://github.com/isdk/ai-tool.js/blob/
|
|
1478
|
+
[packages/ai-tool/src/funcs/event.ts:22](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/funcs/event.ts#L22)
|
|
858
1479
|
|
|
859
1480
|
___
|
|
860
1481
|
|
|
@@ -864,7 +1485,7 @@ ___
|
|
|
864
1485
|
|
|
865
1486
|
#### Defined in
|
|
866
1487
|
|
|
867
|
-
[packages/ai-tool/src/funcs/event-client.ts:180](https://github.com/isdk/ai-tool.js/blob/
|
|
1488
|
+
[packages/ai-tool/src/funcs/event-client.ts:180](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/funcs/event-client.ts#L180)
|
|
868
1489
|
|
|
869
1490
|
___
|
|
870
1491
|
|
|
@@ -874,17 +1495,7 @@ ___
|
|
|
874
1495
|
|
|
875
1496
|
#### Defined in
|
|
876
1497
|
|
|
877
|
-
[packages/ai-tool/src/funcs/event-server.ts:133](https://github.com/isdk/ai-tool.js/blob/
|
|
878
|
-
|
|
879
|
-
___
|
|
880
|
-
|
|
881
|
-
### isSimilar
|
|
882
|
-
|
|
883
|
-
• `Const` **isSimilar**: [`ServerTools`](classes/ServerTools.md)
|
|
884
|
-
|
|
885
|
-
#### Defined in
|
|
886
|
-
|
|
887
|
-
[packages/ai-tool/src/funcs/is-similar.ts:33](https://github.com/isdk/ai-tool.js/blob/c377a1408daee78a2484142b6d99ef7fbbec7c7c/src/funcs/is-similar.ts#L33)
|
|
1498
|
+
[packages/ai-tool/src/funcs/event-server.ts:133](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/funcs/event-server.ts#L133)
|
|
888
1499
|
|
|
889
1500
|
___
|
|
890
1501
|
|
|
@@ -894,17 +1505,7 @@ ___
|
|
|
894
1505
|
|
|
895
1506
|
#### Defined in
|
|
896
1507
|
|
|
897
|
-
[packages/ai-tool/src/funcs/lrucache.ts:40](https://github.com/isdk/ai-tool.js/blob/
|
|
898
|
-
|
|
899
|
-
___
|
|
900
|
-
|
|
901
|
-
### mergeSegments
|
|
902
|
-
|
|
903
|
-
• `Const` **mergeSegments**: [`ServerTools`](classes/ServerTools.md)
|
|
904
|
-
|
|
905
|
-
#### Defined in
|
|
906
|
-
|
|
907
|
-
[packages/ai-tool/src/funcs/merge-segments.ts:34](https://github.com/isdk/ai-tool.js/blob/c377a1408daee78a2484142b6d99ef7fbbec7c7c/src/funcs/merge-segments.ts#L34)
|
|
1508
|
+
[packages/ai-tool/src/funcs/lrucache.ts:40](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/funcs/lrucache.ts#L40)
|
|
908
1509
|
|
|
909
1510
|
___
|
|
910
1511
|
|
|
@@ -918,36 +1519,6 @@ node_modules/.pnpm/mime-type@5.0.0-alpha.2/node_modules/mime-type/src/with-db.d.
|
|
|
918
1519
|
|
|
919
1520
|
___
|
|
920
1521
|
|
|
921
|
-
### segments
|
|
922
|
-
|
|
923
|
-
• `Const` **segments**: [`ServerTools`](classes/ServerTools.md)
|
|
924
|
-
|
|
925
|
-
#### Defined in
|
|
926
|
-
|
|
927
|
-
[packages/ai-tool/src/funcs/segments.ts:15](https://github.com/isdk/ai-tool.js/blob/c377a1408daee78a2484142b6d99ef7fbbec7c7c/src/funcs/segments.ts#L15)
|
|
928
|
-
|
|
929
|
-
___
|
|
930
|
-
|
|
931
|
-
### similarity
|
|
932
|
-
|
|
933
|
-
• `Const` **similarity**: [`ServerTools`](classes/ServerTools.md)
|
|
934
|
-
|
|
935
|
-
#### Defined in
|
|
936
|
-
|
|
937
|
-
[packages/ai-tool/src/funcs/similarity.ts:47](https://github.com/isdk/ai-tool.js/blob/c377a1408daee78a2484142b6d99ef7fbbec7c7c/src/funcs/similarity.ts#L47)
|
|
938
|
-
|
|
939
|
-
___
|
|
940
|
-
|
|
941
|
-
### splitSegments
|
|
942
|
-
|
|
943
|
-
• `Const` **splitSegments**: [`ServerTools`](classes/ServerTools.md)
|
|
944
|
-
|
|
945
|
-
#### Defined in
|
|
946
|
-
|
|
947
|
-
[packages/ai-tool/src/funcs/split-segments.ts:41](https://github.com/isdk/ai-tool.js/blob/c377a1408daee78a2484142b6d99ef7fbbec7c7c/src/funcs/split-segments.ts#L41)
|
|
948
|
-
|
|
949
|
-
___
|
|
950
|
-
|
|
951
1522
|
### uuidNIL
|
|
952
1523
|
|
|
953
1524
|
• `Const` **uuidNIL**: `NIL`
|
|
@@ -956,7 +1527,7 @@ ___
|
|
|
956
1527
|
|
|
957
1528
|
node_modules/.pnpm/@types+uuid@9.0.8/node_modules/@types/uuid/index.d.ts:78
|
|
958
1529
|
|
|
959
|
-
|
|
1530
|
+
___
|
|
960
1531
|
|
|
961
1532
|
### AIStream
|
|
962
1533
|
|
|
@@ -999,118 +1570,232 @@ Will throw an error if the response is not OK.
|
|
|
999
1570
|
|
|
1000
1571
|
#### Defined in
|
|
1001
1572
|
|
|
1002
|
-
[packages/ai-tool/src/utils/stream/ai-stream.ts:
|
|
1573
|
+
[packages/ai-tool/src/utils/stream/ai-stream.ts:122](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/stream/ai-stream.ts#L122)
|
|
1574
|
+
|
|
1575
|
+
___
|
|
1576
|
+
|
|
1577
|
+
### RateLimit
|
|
1578
|
+
|
|
1579
|
+
▸ **RateLimit**(`rps`, `«destructured»?`): () => `Promise`\<`void`\>
|
|
1580
|
+
|
|
1581
|
+
Creates a rate limiter function that blocks with a promise whenever the rate limit is hit and resolves the promise once the call rate is within the limit set by rps. The second argument is optional.
|
|
1582
|
+
|
|
1583
|
+
#### Parameters
|
|
1584
|
+
|
|
1585
|
+
| Name | Type | Default value |
|
|
1586
|
+
| :------ | :------ | :------ |
|
|
1587
|
+
| `rps` | `number` | `undefined` |
|
|
1588
|
+
| `«destructured»` | `Object` | `{}` |
|
|
1589
|
+
| › `timeUnit?` | `number` | `1000` |
|
|
1590
|
+
| › `uniformDistribution?` | `boolean` | `false` |
|
|
1591
|
+
|
|
1592
|
+
#### Returns
|
|
1593
|
+
|
|
1594
|
+
`fn`
|
|
1595
|
+
|
|
1596
|
+
▸ (): `Promise`\<`void`\>
|
|
1597
|
+
|
|
1598
|
+
##### Returns
|
|
1599
|
+
|
|
1600
|
+
`Promise`\<`void`\>
|
|
1601
|
+
|
|
1602
|
+
#### Defined in
|
|
1603
|
+
|
|
1604
|
+
[packages/ai-tool/src/utils/async-semaphore.ts:347](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/async-semaphore.ts#L347)
|
|
1605
|
+
|
|
1606
|
+
___
|
|
1607
|
+
|
|
1608
|
+
### \_lrucache
|
|
1609
|
+
|
|
1610
|
+
▸ **_lrucache**(`this`, `«destructured»?`): `_Cache`
|
|
1611
|
+
|
|
1612
|
+
#### Parameters
|
|
1613
|
+
|
|
1614
|
+
| Name | Type |
|
|
1615
|
+
| :------ | :------ |
|
|
1616
|
+
| `this` | [`ToolFunc`](classes/ToolFunc.md) |
|
|
1617
|
+
| `«destructured»` | `Object` |
|
|
1618
|
+
| › `key?` | `string` |
|
|
1619
|
+
| › `options?` | `number` \| `ICacheOptions` |
|
|
1620
|
+
| › `value?` | `any` |
|
|
1621
|
+
|
|
1622
|
+
#### Returns
|
|
1623
|
+
|
|
1624
|
+
`_Cache`
|
|
1625
|
+
|
|
1626
|
+
#### Defined in
|
|
1627
|
+
|
|
1628
|
+
[packages/ai-tool/src/funcs/lrucache.ts:6](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/funcs/lrucache.ts#L6)
|
|
1629
|
+
|
|
1630
|
+
___
|
|
1631
|
+
|
|
1632
|
+
### backendEventable
|
|
1633
|
+
|
|
1634
|
+
▸ **backendEventable**(`targetClass?`, `options?`): `Function`
|
|
1635
|
+
|
|
1636
|
+
#### Parameters
|
|
1637
|
+
|
|
1638
|
+
| Name | Type |
|
|
1639
|
+
| :------ | :------ |
|
|
1640
|
+
| `targetClass?` | `Function` |
|
|
1641
|
+
| `options?` | `AbilityOptions` |
|
|
1642
|
+
|
|
1643
|
+
#### Returns
|
|
1644
|
+
|
|
1645
|
+
`Function`
|
|
1646
|
+
|
|
1647
|
+
#### Defined in
|
|
1648
|
+
|
|
1649
|
+
[packages/ai-tool/src/utils/event/event-ability.ts:80](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/event/event-ability.ts#L80)
|
|
1650
|
+
|
|
1651
|
+
___
|
|
1652
|
+
|
|
1653
|
+
### canonicalize
|
|
1654
|
+
|
|
1655
|
+
▸ **canonicalize**(`obj`): `string`
|
|
1656
|
+
|
|
1657
|
+
#### Parameters
|
|
1658
|
+
|
|
1659
|
+
| Name | Type |
|
|
1660
|
+
| :------ | :------ |
|
|
1661
|
+
| `obj` | `any` |
|
|
1662
|
+
|
|
1663
|
+
#### Returns
|
|
1664
|
+
|
|
1665
|
+
`string`
|
|
1666
|
+
|
|
1667
|
+
#### Defined in
|
|
1668
|
+
|
|
1669
|
+
node_modules/.pnpm/json-canonicalize@1.0.6/node_modules/json-canonicalize/types/canonicalize.d.ts:1
|
|
1003
1670
|
|
|
1004
1671
|
___
|
|
1005
1672
|
|
|
1006
|
-
###
|
|
1673
|
+
### canonicalizeEx
|
|
1007
1674
|
|
|
1008
|
-
▸ **
|
|
1675
|
+
▸ **canonicalizeEx**(`obj`, `options?`): `string`
|
|
1009
1676
|
|
|
1010
1677
|
#### Parameters
|
|
1011
1678
|
|
|
1012
1679
|
| Name | Type |
|
|
1013
1680
|
| :------ | :------ |
|
|
1014
|
-
| `
|
|
1015
|
-
|
|
|
1016
|
-
| › `key?` | `string` |
|
|
1017
|
-
| › `options?` | `number` \| `ICacheOptions` |
|
|
1018
|
-
| › `value?` | `any` |
|
|
1681
|
+
| `obj` | `any` |
|
|
1682
|
+
| `options?` | [`IOptions`](interfaces/IOptions.md) |
|
|
1019
1683
|
|
|
1020
1684
|
#### Returns
|
|
1021
1685
|
|
|
1022
|
-
`
|
|
1686
|
+
`string`
|
|
1023
1687
|
|
|
1024
1688
|
#### Defined in
|
|
1025
1689
|
|
|
1026
|
-
|
|
1690
|
+
node_modules/.pnpm/json-canonicalize@1.0.6/node_modules/json-canonicalize/types/canonicalize-ex.d.ts:5
|
|
1027
1691
|
|
|
1028
1692
|
___
|
|
1029
1693
|
|
|
1030
|
-
###
|
|
1694
|
+
### createAbilityInjector
|
|
1031
1695
|
|
|
1032
|
-
▸ **
|
|
1696
|
+
▸ **createAbilityInjector**(`abilityClass`, `isGetClassFunc?`, `injectorOpts?`): `AbilityFn`
|
|
1033
1697
|
|
|
1034
1698
|
#### Parameters
|
|
1035
1699
|
|
|
1036
1700
|
| Name | Type |
|
|
1037
1701
|
| :------ | :------ |
|
|
1038
|
-
| `
|
|
1039
|
-
| `
|
|
1702
|
+
| `abilityClass` | `Function` |
|
|
1703
|
+
| `isGetClassFunc?` | `boolean` |
|
|
1704
|
+
| `injectorOpts?` | `AbilityInjectorOptions` |
|
|
1040
1705
|
|
|
1041
1706
|
#### Returns
|
|
1042
1707
|
|
|
1043
|
-
`
|
|
1708
|
+
`AbilityFn`
|
|
1044
1709
|
|
|
1045
1710
|
#### Defined in
|
|
1046
1711
|
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
___
|
|
1050
|
-
|
|
1051
|
-
### canonicalize
|
|
1712
|
+
node_modules/.pnpm/custom-ability@2.0.0-alpha.7/node_modules/custom-ability/lib/custom-ability.d.ts:29
|
|
1052
1713
|
|
|
1053
|
-
▸ **
|
|
1714
|
+
▸ **createAbilityInjector**(`abilityClass`, `aCoreMethod?`, `isGetClassFunc?`, `injectorOpts?`): `AbilityFn`
|
|
1054
1715
|
|
|
1055
1716
|
#### Parameters
|
|
1056
1717
|
|
|
1057
1718
|
| Name | Type |
|
|
1058
1719
|
| :------ | :------ |
|
|
1059
|
-
| `
|
|
1720
|
+
| `abilityClass` | `Function` |
|
|
1721
|
+
| `aCoreMethod?` | `string` \| `string`[] |
|
|
1722
|
+
| `isGetClassFunc?` | `boolean` |
|
|
1723
|
+
| `injectorOpts?` | `AbilityInjectorOptions` |
|
|
1060
1724
|
|
|
1061
1725
|
#### Returns
|
|
1062
1726
|
|
|
1063
|
-
`
|
|
1727
|
+
`AbilityFn`
|
|
1064
1728
|
|
|
1065
1729
|
#### Defined in
|
|
1066
1730
|
|
|
1067
|
-
node_modules/.pnpm/
|
|
1731
|
+
node_modules/.pnpm/custom-ability@2.0.0-alpha.7/node_modules/custom-ability/lib/custom-ability.d.ts:30
|
|
1068
1732
|
|
|
1069
|
-
|
|
1733
|
+
▸ **createAbilityInjector**(`abilityClass`, `aCoreMethod?`, `injectorOpts?`): `AbilityFn`
|
|
1070
1734
|
|
|
1071
|
-
|
|
1735
|
+
#### Parameters
|
|
1072
1736
|
|
|
1073
|
-
|
|
1737
|
+
| Name | Type |
|
|
1738
|
+
| :------ | :------ |
|
|
1739
|
+
| `abilityClass` | `Function` |
|
|
1740
|
+
| `aCoreMethod?` | `string` \| `string`[] |
|
|
1741
|
+
| `injectorOpts?` | `AbilityInjectorOptions` |
|
|
1742
|
+
|
|
1743
|
+
#### Returns
|
|
1744
|
+
|
|
1745
|
+
`AbilityFn`
|
|
1746
|
+
|
|
1747
|
+
#### Defined in
|
|
1748
|
+
|
|
1749
|
+
node_modules/.pnpm/custom-ability@2.0.0-alpha.7/node_modules/custom-ability/lib/custom-ability.d.ts:31
|
|
1750
|
+
|
|
1751
|
+
▸ **createAbilityInjector**(`abilityClass`, `injectorOpts?`): `AbilityFn`
|
|
1074
1752
|
|
|
1075
1753
|
#### Parameters
|
|
1076
1754
|
|
|
1077
1755
|
| Name | Type |
|
|
1078
1756
|
| :------ | :------ |
|
|
1079
|
-
| `
|
|
1080
|
-
| `
|
|
1757
|
+
| `abilityClass` | `Function` |
|
|
1758
|
+
| `injectorOpts?` | `AbilityInjectorOptions` |
|
|
1081
1759
|
|
|
1082
1760
|
#### Returns
|
|
1083
1761
|
|
|
1084
|
-
`
|
|
1762
|
+
`AbilityFn`
|
|
1085
1763
|
|
|
1086
1764
|
#### Defined in
|
|
1087
1765
|
|
|
1088
|
-
node_modules/.pnpm/
|
|
1766
|
+
node_modules/.pnpm/custom-ability@2.0.0-alpha.7/node_modules/custom-ability/lib/custom-ability.d.ts:32
|
|
1089
1767
|
|
|
1090
1768
|
___
|
|
1091
1769
|
|
|
1092
1770
|
### createCallbacksTransformer
|
|
1093
1771
|
|
|
1094
|
-
▸ **createCallbacksTransformer
|
|
1772
|
+
▸ **createCallbacksTransformer**\<`I`, `O`\>(`cb`): `TransformStream`\<`I`, `O`\>
|
|
1095
1773
|
|
|
1096
|
-
Creates a transform stream that
|
|
1774
|
+
Creates a transform stream that invokes optional callback functions.
|
|
1097
1775
|
The transform stream uses the provided callbacks to execute custom logic at different stages of the stream's lifecycle.
|
|
1098
1776
|
- `onStart`: Called once when the stream is initialized.
|
|
1099
|
-
- `
|
|
1777
|
+
- `onTransform`: Called for each tokenized message.
|
|
1100
1778
|
- `onCompletion`: Called every time an AIStream completion message is received. This can occur multiple times when using e.g. OpenAI functions
|
|
1101
1779
|
- `onFinal`: Called once when the stream is closed with the final completion message.
|
|
1102
1780
|
|
|
1103
1781
|
This function is useful when you want to process a stream of messages and perform specific actions during the stream's lifecycle.
|
|
1104
1782
|
|
|
1783
|
+
#### Type parameters
|
|
1784
|
+
|
|
1785
|
+
| Name | Type |
|
|
1786
|
+
| :------ | :------ |
|
|
1787
|
+
| `I` | `any` |
|
|
1788
|
+
| `O` | `any` |
|
|
1789
|
+
|
|
1105
1790
|
#### Parameters
|
|
1106
1791
|
|
|
1107
1792
|
| Name | Type |
|
|
1108
1793
|
| :------ | :------ |
|
|
1109
|
-
| `cb` | `undefined` \| [`
|
|
1794
|
+
| `cb` | `undefined` \| [`StreamCallbacksAndOptions`](interfaces/StreamCallbacksAndOptions.md)\<`I`, `O`\> |
|
|
1110
1795
|
|
|
1111
1796
|
#### Returns
|
|
1112
1797
|
|
|
1113
|
-
`TransformStream
|
|
1798
|
+
`TransformStream`\<`I`, `O`\>
|
|
1114
1799
|
|
|
1115
1800
|
A transform stream that encodes input messages as Uint8Array and allows the execution of custom logic through callbacks.
|
|
1116
1801
|
|
|
@@ -1119,8 +1804,7 @@ A transform stream that encodes input messages as Uint8Array and allows the exec
|
|
|
1119
1804
|
```ts
|
|
1120
1805
|
const callbacks = {
|
|
1121
1806
|
onStart: async () => console.log('Stream started'),
|
|
1122
|
-
|
|
1123
|
-
onCompletion: async (completion) => console.log(`Completion: ${completion}`)
|
|
1807
|
+
onTransform: async (chunk) => console.log('Token:',chunk),
|
|
1124
1808
|
onFinal: async () => data.close()
|
|
1125
1809
|
};
|
|
1126
1810
|
const transformer = createCallbacksTransformer(callbacks);
|
|
@@ -1128,7 +1812,7 @@ const transformer = createCallbacksTransformer(callbacks);
|
|
|
1128
1812
|
|
|
1129
1813
|
#### Defined in
|
|
1130
1814
|
|
|
1131
|
-
[packages/ai-tool/src/utils/stream/
|
|
1815
|
+
[packages/ai-tool/src/utils/stream/create-callbacks-stream.ts:36](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/stream/create-callbacks-stream.ts#L36)
|
|
1132
1816
|
|
|
1133
1817
|
___
|
|
1134
1818
|
|
|
@@ -1148,13 +1832,13 @@ An empty and closed ReadableStream instance.
|
|
|
1148
1832
|
|
|
1149
1833
|
#### Defined in
|
|
1150
1834
|
|
|
1151
|
-
[packages/ai-tool/src/utils/stream/create-empty-stream.ts:8](https://github.com/isdk/ai-tool.js/blob/
|
|
1835
|
+
[packages/ai-tool/src/utils/stream/create-empty-stream.ts:8](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/stream/create-empty-stream.ts#L8)
|
|
1152
1836
|
|
|
1153
1837
|
___
|
|
1154
1838
|
|
|
1155
1839
|
### createEndWithRepetitionDetector
|
|
1156
1840
|
|
|
1157
|
-
▸ **createEndWithRepetitionDetector**(`repetitionThreshold`): (`value`: `string`) => `
|
|
1841
|
+
▸ **createEndWithRepetitionDetector**(`repetitionThreshold`): (`value`: `string`) => ``null`` \| `RegExpExecArray`
|
|
1158
1842
|
|
|
1159
1843
|
#### Parameters
|
|
1160
1844
|
|
|
@@ -1166,7 +1850,7 @@ ___
|
|
|
1166
1850
|
|
|
1167
1851
|
`fn`
|
|
1168
1852
|
|
|
1169
|
-
▸ (`value`): `
|
|
1853
|
+
▸ (`value`): ``null`` \| `RegExpExecArray`
|
|
1170
1854
|
|
|
1171
1855
|
##### Parameters
|
|
1172
1856
|
|
|
@@ -1176,11 +1860,11 @@ ___
|
|
|
1176
1860
|
|
|
1177
1861
|
##### Returns
|
|
1178
1862
|
|
|
1179
|
-
`
|
|
1863
|
+
``null`` \| `RegExpExecArray`
|
|
1180
1864
|
|
|
1181
1865
|
#### Defined in
|
|
1182
1866
|
|
|
1183
|
-
[packages/ai-tool/src/utils/end-with-repeated-sequence.ts:3](https://github.com/isdk/ai-tool.js/blob/
|
|
1867
|
+
[packages/ai-tool/src/utils/end-with-repeated-sequence.ts:3](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/end-with-repeated-sequence.ts#L3)
|
|
1184
1868
|
|
|
1185
1869
|
___
|
|
1186
1870
|
|
|
@@ -1206,7 +1890,7 @@ Error object
|
|
|
1206
1890
|
|
|
1207
1891
|
#### Defined in
|
|
1208
1892
|
|
|
1209
|
-
[packages/ai-tool/src/utils/base-error.ts:
|
|
1893
|
+
[packages/ai-tool/src/utils/base-error.ts:220](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/base-error.ts#L220)
|
|
1210
1894
|
|
|
1211
1895
|
___
|
|
1212
1896
|
|
|
@@ -1237,7 +1921,7 @@ TransformStream parsing events.
|
|
|
1237
1921
|
|
|
1238
1922
|
#### Defined in
|
|
1239
1923
|
|
|
1240
|
-
[packages/ai-tool/src/utils/stream/ai-stream.ts:
|
|
1924
|
+
[packages/ai-tool/src/utils/stream/ai-stream.ts:37](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/stream/ai-stream.ts#L37)
|
|
1241
1925
|
|
|
1242
1926
|
___
|
|
1243
1927
|
|
|
@@ -1269,7 +1953,7 @@ ___
|
|
|
1269
1953
|
|
|
1270
1954
|
#### Defined in
|
|
1271
1955
|
|
|
1272
|
-
[packages/ai-tool/src/utils/prompt/hf-prompt-template.ts:148](https://github.com/isdk/ai-tool.js/blob/
|
|
1956
|
+
[packages/ai-tool/src/utils/prompt/hf-prompt-template.ts:148](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/prompt/hf-prompt-template.ts#L148)
|
|
1273
1957
|
|
|
1274
1958
|
___
|
|
1275
1959
|
|
|
@@ -1290,7 +1974,28 @@ ___
|
|
|
1290
1974
|
|
|
1291
1975
|
#### Defined in
|
|
1292
1976
|
|
|
1293
|
-
[packages/ai-tool/src/funcs/lrucache.ts:22](https://github.com/isdk/ai-tool.js/blob/
|
|
1977
|
+
[packages/ai-tool/src/funcs/lrucache.ts:22](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/funcs/lrucache.ts#L22)
|
|
1978
|
+
|
|
1979
|
+
___
|
|
1980
|
+
|
|
1981
|
+
### dateToText
|
|
1982
|
+
|
|
1983
|
+
▸ **dateToText**(`date`, `format?`): `string`
|
|
1984
|
+
|
|
1985
|
+
#### Parameters
|
|
1986
|
+
|
|
1987
|
+
| Name | Type | Default value |
|
|
1988
|
+
| :------ | :------ | :------ |
|
|
1989
|
+
| `date` | `Date` | `undefined` |
|
|
1990
|
+
| `format` | `string` | `FormatDateStr` |
|
|
1991
|
+
|
|
1992
|
+
#### Returns
|
|
1993
|
+
|
|
1994
|
+
`string`
|
|
1995
|
+
|
|
1996
|
+
#### Defined in
|
|
1997
|
+
|
|
1998
|
+
[packages/ai-tool/src/utils/to-datetime.ts:29](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/to-datetime.ts#L29)
|
|
1294
1999
|
|
|
1295
2000
|
___
|
|
1296
2001
|
|
|
@@ -1329,7 +2034,7 @@ console.log(process.env.HELLO) // undefined
|
|
|
1329
2034
|
|
|
1330
2035
|
#### Defined in
|
|
1331
2036
|
|
|
1332
|
-
[packages/ai-tool/src/utils/prompt/template/env.ts:82](https://github.com/isdk/ai-tool.js/blob/
|
|
2037
|
+
[packages/ai-tool/src/utils/prompt/template/env.ts:82](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/prompt/template/env.ts#L82)
|
|
1333
2038
|
|
|
1334
2039
|
___
|
|
1335
2040
|
|
|
@@ -1373,7 +2078,7 @@ const expandedObj = expandObjEnv(obj, { processEnv: myCustomEnv }); // Assuming
|
|
|
1373
2078
|
|
|
1374
2079
|
#### Defined in
|
|
1375
2080
|
|
|
1376
|
-
[packages/ai-tool/src/utils/prompt/template/env.ts:142](https://github.com/isdk/ai-tool.js/blob/
|
|
2081
|
+
[packages/ai-tool/src/utils/prompt/template/env.ts:142](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/prompt/template/env.ts#L142)
|
|
1377
2082
|
|
|
1378
2083
|
___
|
|
1379
2084
|
|
|
@@ -1413,7 +2118,7 @@ extNameLevel(".json5");
|
|
|
1413
2118
|
|
|
1414
2119
|
#### Defined in
|
|
1415
2120
|
|
|
1416
|
-
[packages/ai-tool/src/utils/filename.ts:209](https://github.com/isdk/ai-tool.js/blob/
|
|
2121
|
+
[packages/ai-tool/src/utils/filename.ts:209](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/filename.ts#L209)
|
|
1417
2122
|
|
|
1418
2123
|
___
|
|
1419
2124
|
|
|
@@ -1432,7 +2137,7 @@ A compiled regular expression for reserved filename characters.
|
|
|
1432
2137
|
|
|
1433
2138
|
#### Defined in
|
|
1434
2139
|
|
|
1435
|
-
[packages/ai-tool/src/utils/filename.ts:42](https://github.com/isdk/ai-tool.js/blob/
|
|
2140
|
+
[packages/ai-tool/src/utils/filename.ts:42](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/filename.ts#L42)
|
|
1436
2141
|
|
|
1437
2142
|
___
|
|
1438
2143
|
|
|
@@ -1462,19 +2167,20 @@ An array containing all string keys of the specified enumeration.
|
|
|
1462
2167
|
|
|
1463
2168
|
#### Defined in
|
|
1464
2169
|
|
|
1465
|
-
[packages/ai-tool/src/utils/get-all-enum-keys.ts:7](https://github.com/isdk/ai-tool.js/blob/
|
|
2170
|
+
[packages/ai-tool/src/utils/get-all-enum-keys.ts:7](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/get-all-enum-keys.ts#L7)
|
|
1466
2171
|
|
|
1467
2172
|
___
|
|
1468
2173
|
|
|
1469
2174
|
### getConfigFileNames
|
|
1470
2175
|
|
|
1471
|
-
▸ **getConfigFileNames**(`directoryPath`): `string`[]
|
|
2176
|
+
▸ **getConfigFileNames**(`directoryPath`, `filter?`): `string`[]
|
|
1472
2177
|
|
|
1473
2178
|
#### Parameters
|
|
1474
2179
|
|
|
1475
2180
|
| Name | Type |
|
|
1476
2181
|
| :------ | :------ |
|
|
1477
2182
|
| `directoryPath` | `string` |
|
|
2183
|
+
| `filter?` | `ConfigFilesFilter` |
|
|
1478
2184
|
|
|
1479
2185
|
#### Returns
|
|
1480
2186
|
|
|
@@ -1482,19 +2188,20 @@ ___
|
|
|
1482
2188
|
|
|
1483
2189
|
#### Defined in
|
|
1484
2190
|
|
|
1485
|
-
[packages/ai-tool/src/utils/config.ts:
|
|
2191
|
+
[packages/ai-tool/src/utils/config.ts:56](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/config.ts#L56)
|
|
1486
2192
|
|
|
1487
2193
|
___
|
|
1488
2194
|
|
|
1489
2195
|
### getConfigs
|
|
1490
2196
|
|
|
1491
|
-
▸ **getConfigs**(`directoryPath`): `any`[]
|
|
2197
|
+
▸ **getConfigs**(`directoryPath`, `filter?`): `any`[]
|
|
1492
2198
|
|
|
1493
2199
|
#### Parameters
|
|
1494
2200
|
|
|
1495
2201
|
| Name | Type |
|
|
1496
2202
|
| :------ | :------ |
|
|
1497
2203
|
| `directoryPath` | `string` |
|
|
2204
|
+
| `filter?` | `ConfigFilesFilter` |
|
|
1498
2205
|
|
|
1499
2206
|
#### Returns
|
|
1500
2207
|
|
|
@@ -1502,27 +2209,7 @@ ___
|
|
|
1502
2209
|
|
|
1503
2210
|
#### Defined in
|
|
1504
2211
|
|
|
1505
|
-
[packages/ai-tool/src/utils/config.ts:
|
|
1506
|
-
|
|
1507
|
-
___
|
|
1508
|
-
|
|
1509
|
-
### getDefaultSimilarPassingScore
|
|
1510
|
-
|
|
1511
|
-
▸ **getDefaultSimilarPassingScore**(`modelId`): `number`
|
|
1512
|
-
|
|
1513
|
-
#### Parameters
|
|
1514
|
-
|
|
1515
|
-
| Name | Type |
|
|
1516
|
-
| :------ | :------ |
|
|
1517
|
-
| `modelId` | `string` |
|
|
1518
|
-
|
|
1519
|
-
#### Returns
|
|
1520
|
-
|
|
1521
|
-
`number`
|
|
1522
|
-
|
|
1523
|
-
#### Defined in
|
|
1524
|
-
|
|
1525
|
-
[packages/ai-tool/src/funcs/is-similar.ts:7](https://github.com/isdk/ai-tool.js/blob/c377a1408daee78a2484142b6d99ef7fbbec7c7c/src/funcs/is-similar.ts#L7)
|
|
2212
|
+
[packages/ai-tool/src/utils/config.ts:80](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/config.ts#L80)
|
|
1526
2213
|
|
|
1527
2214
|
___
|
|
1528
2215
|
|
|
@@ -1559,7 +2246,7 @@ console.log(getKeysPath(obj)); // Output: ['a.b.c', 'd[0]', 'd[1].e']
|
|
|
1559
2246
|
|
|
1560
2247
|
#### Defined in
|
|
1561
2248
|
|
|
1562
|
-
[packages/ai-tool/src/utils/get-keys-path.ts:16](https://github.com/isdk/ai-tool.js/blob/
|
|
2249
|
+
[packages/ai-tool/src/utils/get-keys-path.ts:16](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/get-keys-path.ts#L16)
|
|
1563
2250
|
|
|
1564
2251
|
___
|
|
1565
2252
|
|
|
@@ -1584,7 +2271,38 @@ Returns a concatenated string of multiple extensions, or an empty string if no e
|
|
|
1584
2271
|
|
|
1585
2272
|
#### Defined in
|
|
1586
2273
|
|
|
1587
|
-
[packages/ai-tool/src/utils/filename.ts:174](https://github.com/isdk/ai-tool.js/blob/
|
|
2274
|
+
[packages/ai-tool/src/utils/filename.ts:174](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/filename.ts#L174)
|
|
2275
|
+
|
|
2276
|
+
___
|
|
2277
|
+
|
|
2278
|
+
### getRealFilepath
|
|
2279
|
+
|
|
2280
|
+
▸ **getRealFilepath**(`filepath`): `string`
|
|
2281
|
+
|
|
2282
|
+
Resolves the real file path, handling symbolic links.
|
|
2283
|
+
|
|
2284
|
+
#### Parameters
|
|
2285
|
+
|
|
2286
|
+
| Name | Type | Description |
|
|
2287
|
+
| :------ | :------ | :------ |
|
|
2288
|
+
| `filepath` | `string` | The file path to resolve. |
|
|
2289
|
+
|
|
2290
|
+
#### Returns
|
|
2291
|
+
|
|
2292
|
+
`string`
|
|
2293
|
+
|
|
2294
|
+
The real file path.
|
|
2295
|
+
|
|
2296
|
+
**`Example`**
|
|
2297
|
+
|
|
2298
|
+
```typescript
|
|
2299
|
+
const realPath = getRealFilepath('/path/to/symbolic/link');
|
|
2300
|
+
console.log(realPath); // Outputs the resolved path.
|
|
2301
|
+
```
|
|
2302
|
+
|
|
2303
|
+
#### Defined in
|
|
2304
|
+
|
|
2305
|
+
[packages/ai-tool/src/utils/load-file-from-paths.ts:141](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/load-file-from-paths.ts#L141)
|
|
1588
2306
|
|
|
1589
2307
|
___
|
|
1590
2308
|
|
|
@@ -1604,7 +2322,7 @@ ___
|
|
|
1604
2322
|
|
|
1605
2323
|
#### Defined in
|
|
1606
2324
|
|
|
1607
|
-
[packages/ai-tool/src/utils/stream/error-readable-stream.ts:12](https://github.com/isdk/ai-tool.js/blob/
|
|
2325
|
+
[packages/ai-tool/src/utils/stream/error-readable-stream.ts:12](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/stream/error-readable-stream.ts#L12)
|
|
1608
2326
|
|
|
1609
2327
|
___
|
|
1610
2328
|
|
|
@@ -1627,7 +2345,7 @@ Operator precedence can be found here: https://developer.mozilla.org/en-US/docs/
|
|
|
1627
2345
|
|
|
1628
2346
|
#### Defined in
|
|
1629
2347
|
|
|
1630
|
-
[packages/ai-tool/src/utils/prompt/template/jinja/src/parser.ts:30](https://github.com/isdk/ai-tool.js/blob/
|
|
2348
|
+
[packages/ai-tool/src/utils/prompt/template/jinja/src/parser.ts:30](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/prompt/template/jinja/src/parser.ts#L30)
|
|
1631
2349
|
|
|
1632
2350
|
___
|
|
1633
2351
|
|
|
@@ -1650,7 +2368,7 @@ Generate a list of tokens from a source string.
|
|
|
1650
2368
|
|
|
1651
2369
|
#### Defined in
|
|
1652
2370
|
|
|
1653
|
-
[packages/ai-tool/src/utils/prompt/template/jinja/src/lexer.ts:189](https://github.com/isdk/ai-tool.js/blob/
|
|
2371
|
+
[packages/ai-tool/src/utils/prompt/template/jinja/src/lexer.ts:189](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/prompt/template/jinja/src/lexer.ts#L189)
|
|
1654
2372
|
|
|
1655
2373
|
___
|
|
1656
2374
|
|
|
@@ -1672,7 +2390,7 @@ ___
|
|
|
1672
2390
|
|
|
1673
2391
|
#### Defined in
|
|
1674
2392
|
|
|
1675
|
-
[packages/ai-tool/src/utils/prompt/template/env.ts:17](https://github.com/isdk/ai-tool.js/blob/
|
|
2393
|
+
[packages/ai-tool/src/utils/prompt/template/env.ts:17](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/prompt/template/env.ts#L17)
|
|
1676
2394
|
|
|
1677
2395
|
___
|
|
1678
2396
|
|
|
@@ -1697,7 +2415,7 @@ template have been replaced with their corresponding values.
|
|
|
1697
2415
|
|
|
1698
2416
|
#### Defined in
|
|
1699
2417
|
|
|
1700
|
-
[packages/ai-tool/src/utils/prompt/template/python.ts:71](https://github.com/isdk/ai-tool.js/blob/
|
|
2418
|
+
[packages/ai-tool/src/utils/prompt/template/python.ts:71](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/prompt/template/python.ts#L71)
|
|
1701
2419
|
|
|
1702
2420
|
___
|
|
1703
2421
|
|
|
@@ -1721,7 +2439,7 @@ Parse and interpolate template
|
|
|
1721
2439
|
|
|
1722
2440
|
#### Defined in
|
|
1723
2441
|
|
|
1724
|
-
[packages/ai-tool/src/utils/prompt/template/golang.ts:269](https://github.com/isdk/ai-tool.js/blob/
|
|
2442
|
+
[packages/ai-tool/src/utils/prompt/template/golang.ts:269](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/prompt/template/golang.ts#L269)
|
|
1725
2443
|
|
|
1726
2444
|
___
|
|
1727
2445
|
|
|
@@ -1760,7 +2478,7 @@ IsModelNameMatched("gpt-2", (modelName) => modelName.startsWith("gpt-")) // retu
|
|
|
1760
2478
|
|
|
1761
2479
|
#### Defined in
|
|
1762
2480
|
|
|
1763
|
-
[packages/ai-tool/src/utils/is-model-name-matched.ts:21](https://github.com/isdk/ai-tool.js/blob/
|
|
2481
|
+
[packages/ai-tool/src/utils/is-model-name-matched.ts:21](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/is-model-name-matched.ts#L21)
|
|
1764
2482
|
|
|
1765
2483
|
___
|
|
1766
2484
|
|
|
@@ -1795,7 +2513,7 @@ isValidFilename('my<file.txt'); // Returns false
|
|
|
1795
2513
|
|
|
1796
2514
|
#### Defined in
|
|
1797
2515
|
|
|
1798
|
-
[packages/ai-tool/src/utils/filename.ts:63](https://github.com/isdk/ai-tool.js/blob/
|
|
2516
|
+
[packages/ai-tool/src/utils/filename.ts:63](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/filename.ts#L63)
|
|
1799
2517
|
|
|
1800
2518
|
___
|
|
1801
2519
|
|
|
@@ -1819,7 +2537,27 @@ A boolean indicating whether the filepath is valid. Returns true if valid; false
|
|
|
1819
2537
|
|
|
1820
2538
|
#### Defined in
|
|
1821
2539
|
|
|
1822
|
-
[packages/ai-tool/src/utils/filename.ts:72](https://github.com/isdk/ai-tool.js/blob/
|
|
2540
|
+
[packages/ai-tool/src/utils/filename.ts:72](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/filename.ts#L72)
|
|
2541
|
+
|
|
2542
|
+
___
|
|
2543
|
+
|
|
2544
|
+
### isWebStream
|
|
2545
|
+
|
|
2546
|
+
▸ **isWebStream**(`val`): `boolean`
|
|
2547
|
+
|
|
2548
|
+
#### Parameters
|
|
2549
|
+
|
|
2550
|
+
| Name | Type |
|
|
2551
|
+
| :------ | :------ |
|
|
2552
|
+
| `val` | `any` |
|
|
2553
|
+
|
|
2554
|
+
#### Returns
|
|
2555
|
+
|
|
2556
|
+
`boolean`
|
|
2557
|
+
|
|
2558
|
+
#### Defined in
|
|
2559
|
+
|
|
2560
|
+
[packages/ai-tool/src/utils/stream/is-web-stream.ts:1](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/stream/is-web-stream.ts#L1)
|
|
1823
2561
|
|
|
1824
2562
|
___
|
|
1825
2563
|
|
|
@@ -1860,7 +2598,32 @@ console.log(jsonFilterToWhere(jsonFilter)); // Outputs a WHERE clause based on t
|
|
|
1860
2598
|
|
|
1861
2599
|
#### Defined in
|
|
1862
2600
|
|
|
1863
|
-
[packages/ai-tool/src/utils/json-filter.ts:
|
|
2601
|
+
[packages/ai-tool/src/utils/json-filter.ts:123](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/json-filter.ts#L123)
|
|
2602
|
+
|
|
2603
|
+
___
|
|
2604
|
+
|
|
2605
|
+
### jsonToMarkdownStr
|
|
2606
|
+
|
|
2607
|
+
▸ **jsonToMarkdownStr**(`mem`, `options?`): `string`
|
|
2608
|
+
|
|
2609
|
+
#### Parameters
|
|
2610
|
+
|
|
2611
|
+
| Name | Type |
|
|
2612
|
+
| :------ | :------ |
|
|
2613
|
+
| `mem` | `any` |
|
|
2614
|
+
| `options?` | `Object` |
|
|
2615
|
+
| `options.arrayTag?` | `string` |
|
|
2616
|
+
| `options.level?` | `number` |
|
|
2617
|
+
| `options.objectTag?` | `string` |
|
|
2618
|
+
| `options.visiting?` | `Set`\<`any`\> |
|
|
2619
|
+
|
|
2620
|
+
#### Returns
|
|
2621
|
+
|
|
2622
|
+
`string`
|
|
2623
|
+
|
|
2624
|
+
#### Defined in
|
|
2625
|
+
|
|
2626
|
+
[packages/ai-tool/src/utils/json-to-markdown-str.ts:2](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/json-to-markdown-str.ts#L2)
|
|
1864
2627
|
|
|
1865
2628
|
___
|
|
1866
2629
|
|
|
@@ -1878,6 +2641,7 @@ Loads a file from given paths, optionally searching for specific extensions.
|
|
|
1878
2641
|
| `searchPaths?` | `string`[] | An array of directories to search for the file. Defaults to the current directory (`"."`) if not provided. |
|
|
1879
2642
|
| `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. |
|
|
1880
2643
|
| `options?` | `Object` | - |
|
|
2644
|
+
| `options.exclude?` | `string` \| `string`[] | - |
|
|
1881
2645
|
| `options.filepath?` | `string` | - |
|
|
1882
2646
|
|
|
1883
2647
|
#### Returns
|
|
@@ -1898,13 +2662,13 @@ const content = loadFileFromPaths('config', ['/etc', '/usr/local/etc'], ['.json'
|
|
|
1898
2662
|
|
|
1899
2663
|
#### Defined in
|
|
1900
2664
|
|
|
1901
|
-
[packages/ai-tool/src/utils/load-file-from-paths.ts:22](https://github.com/isdk/ai-tool.js/blob/
|
|
2665
|
+
[packages/ai-tool/src/utils/load-file-from-paths.ts:22](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/load-file-from-paths.ts#L22)
|
|
1902
2666
|
|
|
1903
2667
|
___
|
|
1904
2668
|
|
|
1905
2669
|
### loadTextFromPaths
|
|
1906
2670
|
|
|
1907
|
-
▸ **loadTextFromPaths**(`filename`, `searchPaths?`, `extNames?`, `options?`): `string`
|
|
2671
|
+
▸ **loadTextFromPaths**(`filename`, `searchPaths?`, `extNames?`, `options?`, `exclude?`): `string`
|
|
1908
2672
|
|
|
1909
2673
|
#### Parameters
|
|
1910
2674
|
|
|
@@ -1914,6 +2678,7 @@ ___
|
|
|
1914
2678
|
| `searchPaths?` | `string`[] |
|
|
1915
2679
|
| `extNames?` | `string`[] |
|
|
1916
2680
|
| `options?` | `BufferEncoding` \| \{ `encoding?`: BufferEncoding \| undefined ; `filepath?`: `string` } |
|
|
2681
|
+
| `exclude?` | `string` \| `string`[] |
|
|
1917
2682
|
|
|
1918
2683
|
#### Returns
|
|
1919
2684
|
|
|
@@ -1921,7 +2686,28 @@ ___
|
|
|
1921
2686
|
|
|
1922
2687
|
#### Defined in
|
|
1923
2688
|
|
|
1924
|
-
[packages/ai-tool/src/utils/load-file-from-paths.ts:
|
|
2689
|
+
[packages/ai-tool/src/utils/load-file-from-paths.ts:75](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/load-file-from-paths.ts#L75)
|
|
2690
|
+
|
|
2691
|
+
___
|
|
2692
|
+
|
|
2693
|
+
### makeToolFuncCancelable
|
|
2694
|
+
|
|
2695
|
+
▸ **makeToolFuncCancelable**(`Tool`, `options?`): typeof [`ToolFunc`](classes/ToolFunc.md)
|
|
2696
|
+
|
|
2697
|
+
#### Parameters
|
|
2698
|
+
|
|
2699
|
+
| Name | Type |
|
|
2700
|
+
| :------ | :------ |
|
|
2701
|
+
| `Tool` | typeof [`ToolFunc`](classes/ToolFunc.md) |
|
|
2702
|
+
| `options?` | [`CancelableAbilityOptions`](interfaces/CancelableAbilityOptions.md) |
|
|
2703
|
+
|
|
2704
|
+
#### Returns
|
|
2705
|
+
|
|
2706
|
+
typeof [`ToolFunc`](classes/ToolFunc.md)
|
|
2707
|
+
|
|
2708
|
+
#### Defined in
|
|
2709
|
+
|
|
2710
|
+
[packages/ai-tool/src/utils/cancelable-ability.ts:340](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/cancelable-ability.ts#L340)
|
|
1925
2711
|
|
|
1926
2712
|
___
|
|
1927
2713
|
|
|
@@ -1970,7 +2756,53 @@ matchUrlProtocol("noProtocolHere");
|
|
|
1970
2756
|
|
|
1971
2757
|
#### Defined in
|
|
1972
2758
|
|
|
1973
|
-
[packages/ai-tool/src/utils/match-url-protocol.ts:23](https://github.com/isdk/ai-tool.js/blob/
|
|
2759
|
+
[packages/ai-tool/src/utils/match-url-protocol.ts:23](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/match-url-protocol.ts#L23)
|
|
2760
|
+
|
|
2761
|
+
___
|
|
2762
|
+
|
|
2763
|
+
### messagesToText
|
|
2764
|
+
|
|
2765
|
+
▸ **messagesToText**(`messages`): `string`
|
|
2766
|
+
|
|
2767
|
+
#### Parameters
|
|
2768
|
+
|
|
2769
|
+
| Name | Type |
|
|
2770
|
+
| :------ | :------ |
|
|
2771
|
+
| `messages` | [`AIChatMessageParamBase`](interfaces/AIChatMessageParamBase.md)[] |
|
|
2772
|
+
|
|
2773
|
+
#### Returns
|
|
2774
|
+
|
|
2775
|
+
`string`
|
|
2776
|
+
|
|
2777
|
+
#### Defined in
|
|
2778
|
+
|
|
2779
|
+
[packages/ai-tool/src/utils/chat.ts:116](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/chat.ts#L116)
|
|
2780
|
+
|
|
2781
|
+
___
|
|
2782
|
+
|
|
2783
|
+
### paramsSizeToScaleStr
|
|
2784
|
+
|
|
2785
|
+
▸ **paramsSizeToScaleStr**(`paramsSize`, `fractionDigits?`): `string`
|
|
2786
|
+
|
|
2787
|
+
Formats a parameter size in bytes into a string with an appropriate scale (T, B, M, or K),
|
|
2788
|
+
optionally specifying the number of fractional digits to display.
|
|
2789
|
+
|
|
2790
|
+
#### Parameters
|
|
2791
|
+
|
|
2792
|
+
| Name | Type | Default value | Description |
|
|
2793
|
+
| :------ | :------ | :------ | :------ |
|
|
2794
|
+
| `paramsSize` | `number` | `undefined` | The parameter size in bytes. |
|
|
2795
|
+
| `fractionDigits` | `number` | `0` | The number of fractional digits to include in the formatted output. Default is 0 (no fractional digits). |
|
|
2796
|
+
|
|
2797
|
+
#### Returns
|
|
2798
|
+
|
|
2799
|
+
`string`
|
|
2800
|
+
|
|
2801
|
+
A string representing the formatted parameter size with the appropriate scale unit and the specified number of fractional digits.
|
|
2802
|
+
|
|
2803
|
+
#### Defined in
|
|
2804
|
+
|
|
2805
|
+
[packages/ai-tool/src/utils/convert-params-size.ts:11](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/convert-params-size.ts#L11)
|
|
1974
2806
|
|
|
1975
2807
|
___
|
|
1976
2808
|
|
|
@@ -1995,13 +2827,13 @@ extract from langchain.js/langchain-core/src/prompts/template.ts
|
|
|
1995
2827
|
|
|
1996
2828
|
#### Defined in
|
|
1997
2829
|
|
|
1998
|
-
[packages/ai-tool/src/utils/prompt/template/python.ts:16](https://github.com/isdk/ai-tool.js/blob/
|
|
2830
|
+
[packages/ai-tool/src/utils/prompt/template/python.ts:16](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/prompt/template/python.ts#L16)
|
|
1999
2831
|
|
|
2000
2832
|
___
|
|
2001
2833
|
|
|
2002
2834
|
### parseJsJson
|
|
2003
2835
|
|
|
2004
|
-
▸ **parseJsJson**(`input`): `any`
|
|
2836
|
+
▸ **parseJsJson**(`input`, `scope?`): `any`
|
|
2005
2837
|
|
|
2006
2838
|
Parses a JavaScript string into a JSON object.
|
|
2007
2839
|
|
|
@@ -2010,6 +2842,7 @@ Parses a JavaScript string into a JSON object.
|
|
|
2010
2842
|
| Name | Type | Description |
|
|
2011
2843
|
| :------ | :------ | :------ |
|
|
2012
2844
|
| `input` | `string` | The string to be parsed into JSON. |
|
|
2845
|
+
| `scope?` | `Record`\<`string`, `any`\> | - |
|
|
2013
2846
|
|
|
2014
2847
|
#### Returns
|
|
2015
2848
|
|
|
@@ -2028,7 +2861,7 @@ console.log(json); // { name: 'John' }
|
|
|
2028
2861
|
|
|
2029
2862
|
#### Defined in
|
|
2030
2863
|
|
|
2031
|
-
[packages/ai-tool/src/utils/parse-js-json.ts:14](https://github.com/isdk/ai-tool.js/blob/
|
|
2864
|
+
[packages/ai-tool/src/utils/parse-js-json.ts:14](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/parse-js-json.ts#L14)
|
|
2032
2865
|
|
|
2033
2866
|
___
|
|
2034
2867
|
|
|
@@ -2048,7 +2881,7 @@ ___
|
|
|
2048
2881
|
|
|
2049
2882
|
#### Defined in
|
|
2050
2883
|
|
|
2051
|
-
[packages/ai-tool/src/utils/config.ts:25](https://github.com/isdk/ai-tool.js/blob/
|
|
2884
|
+
[packages/ai-tool/src/utils/config.ts:25](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/config.ts#L25)
|
|
2052
2885
|
|
|
2053
2886
|
___
|
|
2054
2887
|
|
|
@@ -2066,7 +2899,40 @@ A compiled regular expression for control characters in a filename.
|
|
|
2066
2899
|
|
|
2067
2900
|
#### Defined in
|
|
2068
2901
|
|
|
2069
|
-
[packages/ai-tool/src/utils/filename.ts:50](https://github.com/isdk/ai-tool.js/blob/
|
|
2902
|
+
[packages/ai-tool/src/utils/filename.ts:50](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/filename.ts#L50)
|
|
2903
|
+
|
|
2904
|
+
___
|
|
2905
|
+
|
|
2906
|
+
### readFilenamesRecursiveSync
|
|
2907
|
+
|
|
2908
|
+
▸ **readFilenamesRecursiveSync**(`dir`, `isFileMatched?`): `string`[]
|
|
2909
|
+
|
|
2910
|
+
Recursively reads all filenames in the given directory or directories.
|
|
2911
|
+
Optionally filters the results using a file matching callback.
|
|
2912
|
+
|
|
2913
|
+
#### Parameters
|
|
2914
|
+
|
|
2915
|
+
| Name | Type | Description |
|
|
2916
|
+
| :------ | :------ | :------ |
|
|
2917
|
+
| `dir` | `string` \| `string`[] | A single directory path or an array of directory paths to start the search from. |
|
|
2918
|
+
| `isFileMatched?` | (`filepath`: `string`) => `boolean` | An optional callback that determines whether a file should be included in the result. |
|
|
2919
|
+
|
|
2920
|
+
#### Returns
|
|
2921
|
+
|
|
2922
|
+
`string`[]
|
|
2923
|
+
|
|
2924
|
+
An array of file paths that match the criteria.
|
|
2925
|
+
|
|
2926
|
+
**`Example`**
|
|
2927
|
+
|
|
2928
|
+
```typescript
|
|
2929
|
+
const files = readFilenamesRecursiveSync('/path/to/directory', (filepath) => filepath.endsWith('.js'));
|
|
2930
|
+
console.log(files); // Outputs an array of JavaScript file paths.
|
|
2931
|
+
```
|
|
2932
|
+
|
|
2933
|
+
#### Defined in
|
|
2934
|
+
|
|
2935
|
+
[packages/ai-tool/src/utils/load-file-from-paths.ts:101](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/load-file-from-paths.ts#L101)
|
|
2070
2936
|
|
|
2071
2937
|
___
|
|
2072
2938
|
|
|
@@ -2095,7 +2961,7 @@ https://github.com/whatwg/streams/commit/8d7a0bf26eb2cc23e884ddbaac7c1da4b91cf2b
|
|
|
2095
2961
|
|
|
2096
2962
|
#### Defined in
|
|
2097
2963
|
|
|
2098
|
-
[packages/ai-tool/src/utils/stream/ai-stream.ts:
|
|
2964
|
+
[packages/ai-tool/src/utils/stream/ai-stream.ts:166](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/stream/ai-stream.ts#L166)
|
|
2099
2965
|
|
|
2100
2966
|
___
|
|
2101
2967
|
|
|
@@ -2109,7 +2975,7 @@ ___
|
|
|
2109
2975
|
|
|
2110
2976
|
#### Defined in
|
|
2111
2977
|
|
|
2112
|
-
[packages/ai-tool/src/funcs/index.ts:
|
|
2978
|
+
[packages/ai-tool/src/funcs/index.ts:9](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/funcs/index.ts#L9)
|
|
2113
2979
|
|
|
2114
2980
|
___
|
|
2115
2981
|
|
|
@@ -2129,7 +2995,7 @@ ___
|
|
|
2129
2995
|
|
|
2130
2996
|
#### Defined in
|
|
2131
2997
|
|
|
2132
|
-
[packages/ai-tool/src/utils/config.ts:15](https://github.com/isdk/ai-tool.js/blob/
|
|
2998
|
+
[packages/ai-tool/src/utils/config.ts:15](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/config.ts#L15)
|
|
2133
2999
|
|
|
2134
3000
|
___
|
|
2135
3001
|
|
|
@@ -2158,7 +3024,7 @@ The sanitized filename.
|
|
|
2158
3024
|
|
|
2159
3025
|
#### Defined in
|
|
2160
3026
|
|
|
2161
|
-
[packages/ai-tool/src/utils/filename.ts:97](https://github.com/isdk/ai-tool.js/blob/
|
|
3027
|
+
[packages/ai-tool/src/utils/filename.ts:97](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/filename.ts#L97)
|
|
2162
3028
|
|
|
2163
3029
|
___
|
|
2164
3030
|
|
|
@@ -2183,7 +3049,7 @@ The sanitized file path as a string.
|
|
|
2183
3049
|
|
|
2184
3050
|
#### Defined in
|
|
2185
3051
|
|
|
2186
|
-
[packages/ai-tool/src/utils/filename.ts:149](https://github.com/isdk/ai-tool.js/blob/
|
|
3052
|
+
[packages/ai-tool/src/utils/filename.ts:149](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/filename.ts#L149)
|
|
2187
3053
|
|
|
2188
3054
|
___
|
|
2189
3055
|
|
|
@@ -2205,7 +3071,31 @@ ___
|
|
|
2205
3071
|
|
|
2206
3072
|
#### Defined in
|
|
2207
3073
|
|
|
2208
|
-
[packages/ai-tool/src/utils/config.ts:
|
|
3074
|
+
[packages/ai-tool/src/utils/config.ts:85](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/config.ts#L85)
|
|
3075
|
+
|
|
3076
|
+
___
|
|
3077
|
+
|
|
3078
|
+
### scaleStrToParamsSize
|
|
3079
|
+
|
|
3080
|
+
▸ **scaleStrToParamsSize**(`scale`): `number`
|
|
3081
|
+
|
|
3082
|
+
Converts a formatted parameters size string (with units T, B, M, or K) back to its byte value.
|
|
3083
|
+
|
|
3084
|
+
#### Parameters
|
|
3085
|
+
|
|
3086
|
+
| Name | Type | Description |
|
|
3087
|
+
| :------ | :------ | :------ |
|
|
3088
|
+
| `scale` | `string` | The formatted parameter size string (e.g., "1.23B", "456M", "789K", or "123"). |
|
|
3089
|
+
|
|
3090
|
+
#### Returns
|
|
3091
|
+
|
|
3092
|
+
`number`
|
|
3093
|
+
|
|
3094
|
+
The parameter size in bytes.
|
|
3095
|
+
|
|
3096
|
+
#### Defined in
|
|
3097
|
+
|
|
3098
|
+
[packages/ai-tool/src/utils/convert-params-size.ts:44](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/convert-params-size.ts#L44)
|
|
2209
3099
|
|
|
2210
3100
|
___
|
|
2211
3101
|
|
|
@@ -2231,7 +3121,7 @@ ___
|
|
|
2231
3121
|
|
|
2232
3122
|
#### Defined in
|
|
2233
3123
|
|
|
2234
|
-
[packages/ai-tool/src/utils/prompt/few-shot-prompt-template.ts:4](https://github.com/isdk/ai-tool.js/blob/
|
|
3124
|
+
[packages/ai-tool/src/utils/prompt/few-shot-prompt-template.ts:4](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/prompt/few-shot-prompt-template.ts#L4)
|
|
2235
3125
|
|
|
2236
3126
|
___
|
|
2237
3127
|
|
|
@@ -2261,7 +3151,7 @@ console.log(splitSentence(text)); // returns ['Hello world!', 'How are you toda
|
|
|
2261
3151
|
|
|
2262
3152
|
#### Defined in
|
|
2263
3153
|
|
|
2264
|
-
[packages/ai-tool/src/utils/split-sentence.ts:29](https://github.com/isdk/ai-tool.js/blob/
|
|
3154
|
+
[packages/ai-tool/src/utils/split-sentence.ts:29](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/split-sentence.ts#L29)
|
|
2265
3155
|
|
|
2266
3156
|
___
|
|
2267
3157
|
|
|
@@ -2308,6 +3198,27 @@ node_modules/.pnpm/yaml@2.4.3/node_modules/yaml/dist/public-api.d.ts:43
|
|
|
2308
3198
|
|
|
2309
3199
|
___
|
|
2310
3200
|
|
|
3201
|
+
### textToDate
|
|
3202
|
+
|
|
3203
|
+
▸ **textToDate**(`date`, `format?`): `Date`
|
|
3204
|
+
|
|
3205
|
+
#### Parameters
|
|
3206
|
+
|
|
3207
|
+
| Name | Type | Default value |
|
|
3208
|
+
| :------ | :------ | :------ |
|
|
3209
|
+
| `date` | `string` | `undefined` |
|
|
3210
|
+
| `format` | `string` | `FormatDateStr` |
|
|
3211
|
+
|
|
3212
|
+
#### Returns
|
|
3213
|
+
|
|
3214
|
+
`Date`
|
|
3215
|
+
|
|
3216
|
+
#### Defined in
|
|
3217
|
+
|
|
3218
|
+
[packages/ai-tool/src/utils/to-datetime.ts:25](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/to-datetime.ts#L25)
|
|
3219
|
+
|
|
3220
|
+
___
|
|
3221
|
+
|
|
2311
3222
|
### throwError
|
|
2312
3223
|
|
|
2313
3224
|
▸ **throwError**(`message`, `name?`, `status?`): `void`
|
|
@@ -2332,7 +3243,27 @@ Throws a BaseError object
|
|
|
2332
3243
|
|
|
2333
3244
|
#### Defined in
|
|
2334
3245
|
|
|
2335
|
-
[packages/ai-tool/src/utils/base-error.ts:
|
|
3246
|
+
[packages/ai-tool/src/utils/base-error.ts:235](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/base-error.ts#L235)
|
|
3247
|
+
|
|
3248
|
+
___
|
|
3249
|
+
|
|
3250
|
+
### toDateTime
|
|
3251
|
+
|
|
3252
|
+
▸ **toDateTime**(`date`): `undefined` \| `Date`
|
|
3253
|
+
|
|
3254
|
+
#### Parameters
|
|
3255
|
+
|
|
3256
|
+
| Name | Type |
|
|
3257
|
+
| :------ | :------ |
|
|
3258
|
+
| `date` | `string` \| `number` \| `Date` |
|
|
3259
|
+
|
|
3260
|
+
#### Returns
|
|
3261
|
+
|
|
3262
|
+
`undefined` \| `Date`
|
|
3263
|
+
|
|
3264
|
+
#### Defined in
|
|
3265
|
+
|
|
3266
|
+
[packages/ai-tool/src/utils/to-datetime.ts:9](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/to-datetime.ts#L9)
|
|
2336
3267
|
|
|
2337
3268
|
___
|
|
2338
3269
|
|
|
@@ -2374,7 +3305,7 @@ const output2 = trimStart(" text"); // " text"
|
|
|
2374
3305
|
|
|
2375
3306
|
#### Defined in
|
|
2376
3307
|
|
|
2377
|
-
[packages/ai-tool/src/utils/stream/ai-stream.ts:
|
|
3308
|
+
[packages/ai-tool/src/utils/stream/ai-stream.ts:92](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/stream/ai-stream.ts#L92)
|
|
2378
3309
|
|
|
2379
3310
|
___
|
|
2380
3311
|
|
|
@@ -2414,7 +3345,7 @@ truncTo(1.2345, 2, 0.6)
|
|
|
2414
3345
|
|
|
2415
3346
|
#### Defined in
|
|
2416
3347
|
|
|
2417
|
-
[packages/ai-tool/src/utils/trunc-to.ts:19](https://github.com/isdk/ai-tool.js/blob/
|
|
3348
|
+
[packages/ai-tool/src/utils/trunc-to.ts:19](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/trunc-to.ts#L19)
|
|
2418
3349
|
|
|
2419
3350
|
___
|
|
2420
3351
|
|
|
@@ -2435,7 +3366,7 @@ ___
|
|
|
2435
3366
|
|
|
2436
3367
|
#### Defined in
|
|
2437
3368
|
|
|
2438
|
-
[packages/ai-tool/src/utils/hash/uuid.ts:8](https://github.com/isdk/ai-tool.js/blob/
|
|
3369
|
+
[packages/ai-tool/src/utils/hash/uuid.ts:8](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/hash/uuid.ts#L8)
|
|
2439
3370
|
|
|
2440
3371
|
___
|
|
2441
3372
|
|
|
@@ -2670,7 +3601,7 @@ ___
|
|
|
2670
3601
|
|
|
2671
3602
|
#### Defined in
|
|
2672
3603
|
|
|
2673
|
-
[packages/ai-tool/src/utils/wait.ts:1](https://github.com/isdk/ai-tool.js/blob/
|
|
3604
|
+
[packages/ai-tool/src/utils/wait.ts:1](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/wait.ts#L1)
|
|
2674
3605
|
|
|
2675
3606
|
___
|
|
2676
3607
|
|
|
@@ -2692,7 +3623,7 @@ ___
|
|
|
2692
3623
|
|
|
2693
3624
|
#### Defined in
|
|
2694
3625
|
|
|
2695
|
-
[packages/ai-tool/src/utils/hash/xxhash.ts:32](https://github.com/isdk/ai-tool.js/blob/
|
|
3626
|
+
[packages/ai-tool/src/utils/hash/xxhash.ts:32](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/hash/xxhash.ts#L32)
|
|
2696
3627
|
|
|
2697
3628
|
___
|
|
2698
3629
|
|
|
@@ -2713,7 +3644,7 @@ ___
|
|
|
2713
3644
|
|
|
2714
3645
|
#### Defined in
|
|
2715
3646
|
|
|
2716
|
-
[packages/ai-tool/src/utils/hash/xxhash.ts:11](https://github.com/isdk/ai-tool.js/blob/
|
|
3647
|
+
[packages/ai-tool/src/utils/hash/xxhash.ts:11](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/hash/xxhash.ts#L11)
|
|
2717
3648
|
|
|
2718
3649
|
___
|
|
2719
3650
|
|
|
@@ -2734,7 +3665,7 @@ ___
|
|
|
2734
3665
|
|
|
2735
3666
|
#### Defined in
|
|
2736
3667
|
|
|
2737
|
-
[packages/ai-tool/src/utils/hash/xxhash.ts:18](https://github.com/isdk/ai-tool.js/blob/
|
|
3668
|
+
[packages/ai-tool/src/utils/hash/xxhash.ts:18](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/hash/xxhash.ts#L18)
|
|
2738
3669
|
|
|
2739
3670
|
___
|
|
2740
3671
|
|
|
@@ -2756,4 +3687,4 @@ ___
|
|
|
2756
3687
|
|
|
2757
3688
|
#### Defined in
|
|
2758
3689
|
|
|
2759
|
-
[packages/ai-tool/src/utils/hash/xxhash.ts:48](https://github.com/isdk/ai-tool.js/blob/
|
|
3690
|
+
[packages/ai-tool/src/utils/hash/xxhash.ts:48](https://github.com/isdk/ai-tool.js/blob/787e914a1f5dab2d24312399a6f123f0e8360403/src/utils/hash/xxhash.ts#L48)
|