@isdk/ai-tool 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (296) hide show
  1. package/dist/chunk-VIG2GB47.mjs +39 -1
  2. package/dist/chunk-VJ45JQBR.mjs +7829 -0
  3. package/dist/funcs.d.mts +3 -2
  4. package/dist/funcs.d.ts +3 -2
  5. package/dist/funcs.js +5156 -1
  6. package/dist/funcs.mjs +29 -1
  7. package/dist/index-Br-4ZYgE.d.mts +892 -0
  8. package/dist/index-Br-4ZYgE.d.ts +892 -0
  9. package/dist/index.d.mts +206 -238
  10. package/dist/index.d.ts +206 -238
  11. package/dist/index.js +8132 -1
  12. package/dist/index.mjs +476 -1
  13. package/dist/test/util.js +101 -1
  14. package/dist/test/util.mjs +30 -1
  15. package/package.json +31 -31
  16. package/dist/chunk-JHHFTTVE.mjs +0 -1
  17. package/dist/index-BC3GQn6-.d.mts +0 -488
  18. package/dist/index-BC3GQn6-.d.ts +0 -488
  19. package/docs/README.md +0 -250
  20. package/docs/_media/CONTRIBUTING.md +0 -18
  21. package/docs/_media/LICENSE-MIT +0 -22
  22. package/docs/classes/AbortError.md +0 -368
  23. package/docs/classes/AlreadyExistsError.md +0 -348
  24. package/docs/classes/BaseError.md +0 -359
  25. package/docs/classes/CancelableAbility.md +0 -379
  26. package/docs/classes/ClientTools.md +0 -2691
  27. package/docs/classes/CommonError.md +0 -377
  28. package/docs/classes/ConfigFile.md +0 -333
  29. package/docs/classes/EventClient.md +0 -3119
  30. package/docs/classes/EventServer.md +0 -3149
  31. package/docs/classes/EventToolFunc.md +0 -2533
  32. package/docs/classes/FStringPromptTemplate.md +0 -1150
  33. package/docs/classes/FewShotPromptTemplate.md +0 -1186
  34. package/docs/classes/GolangPromptTemplate.md +0 -1150
  35. package/docs/classes/HFEnvironment.md +0 -186
  36. package/docs/classes/HFInterpreter.md +0 -75
  37. package/docs/classes/HFTemplate.md +0 -67
  38. package/docs/classes/HfPromptTemplate.md +0 -1150
  39. package/docs/classes/IntSet.md +0 -216
  40. package/docs/classes/NotFoundError.md +0 -348
  41. package/docs/classes/NotImplementationError.md +0 -348
  42. package/docs/classes/PromptExampleSelector.md +0 -195
  43. package/docs/classes/PromptTemplate.md +0 -1079
  44. package/docs/classes/ReadableStreamError.md +0 -368
  45. package/docs/classes/ResClientTools.md +0 -2399
  46. package/docs/classes/ResServerTools.md +0 -2385
  47. package/docs/classes/SSEChannel.md +0 -270
  48. package/docs/classes/Semaphore.md +0 -177
  49. package/docs/classes/ServerTools.md +0 -2609
  50. package/docs/classes/TaskAbortController.md +0 -137
  51. package/docs/classes/ToolFunc.md +0 -2147
  52. package/docs/classes/YamlTypeBaseObject.md +0 -29
  53. package/docs/enumerations/AsyncFeatureBits.md +0 -37
  54. package/docs/enumerations/AsyncFeatures.md +0 -37
  55. package/docs/enumerations/ErrorCode.md +0 -217
  56. package/docs/enumerations/HashAlgorithm.md +0 -117
  57. package/docs/functions/AIArgProcessor.md +0 -27
  58. package/docs/functions/AIStream.md +0 -50
  59. package/docs/functions/ChoiceArgProcessor.md +0 -27
  60. package/docs/functions/RateLimit.md +0 -33
  61. package/docs/functions/TemplateArgProcessor.md +0 -27
  62. package/docs/functions/backendEventable.md +0 -23
  63. package/docs/functions/canonicalize.md +0 -21
  64. package/docs/functions/completeSentences.md +0 -23
  65. package/docs/functions/concatText.md +0 -23
  66. package/docs/functions/countLLMTokens.md +0 -23
  67. package/docs/functions/countRegexMatches.md +0 -33
  68. package/docs/functions/createAbilityInjector.md +0 -87
  69. package/docs/functions/createCallbacksTransformer.md +0 -49
  70. package/docs/functions/createEmptyReadableStream.md +0 -23
  71. package/docs/functions/createEndWithRepetitionDetector.md +0 -29
  72. package/docs/functions/createError.md +0 -35
  73. package/docs/functions/createEventStreamTransformer.md +0 -33
  74. package/docs/functions/createHfValueFunc.md +0 -29
  75. package/docs/functions/createLRUCache.md +0 -23
  76. package/docs/functions/createYamlObjectTag.md +0 -23
  77. package/docs/functions/dateToText.md +0 -23
  78. package/docs/functions/decodeCharset.md +0 -23
  79. package/docs/functions/detectCharset.md +0 -23
  80. package/docs/functions/encodeLLMTokens.md +0 -23
  81. package/docs/functions/expandEnv.md +0 -40
  82. package/docs/functions/expandObjEnv.md +0 -54
  83. package/docs/functions/extNameLevel.md +0 -43
  84. package/docs/functions/fileIsExists.md +0 -34
  85. package/docs/functions/filenameReservedRegex.md +0 -22
  86. package/docs/functions/filterValidFnScope.md +0 -21
  87. package/docs/functions/findIndexNonEmptyFrom.md +0 -23
  88. package/docs/functions/findPort.md +0 -23
  89. package/docs/functions/formatISO.md +0 -71
  90. package/docs/functions/formatTextWithSpace.md +0 -59
  91. package/docs/functions/getAllEnumKeys.md +0 -31
  92. package/docs/functions/getConfigFileNames.md +0 -23
  93. package/docs/functions/getConfigs.md +0 -23
  94. package/docs/functions/getFileMetaInfo.md +0 -21
  95. package/docs/functions/getHashAlgoBySize.md +0 -21
  96. package/docs/functions/getKeysPath.md +0 -38
  97. package/docs/functions/getLLMTokenizer.md +0 -21
  98. package/docs/functions/getMultiLevelExtname.md +0 -31
  99. package/docs/functions/getPackageDir.md +0 -39
  100. package/docs/functions/getRealFilepath.md +0 -34
  101. package/docs/functions/getResponseErrorReadableStream.md +0 -21
  102. package/docs/functions/hasDirectoryIn.md +0 -38
  103. package/docs/functions/hashFile.md +0 -23
  104. package/docs/functions/hashStream.md +0 -23
  105. package/docs/functions/hfParse.md +0 -24
  106. package/docs/functions/hfTokenize.md +0 -25
  107. package/docs/functions/interpolateEnv.md +0 -25
  108. package/docs/functions/interpolateFString.md +0 -27
  109. package/docs/functions/interpolateGolangTemplate.md +0 -31
  110. package/docs/functions/isLangUsingSpaces.md +0 -21
  111. package/docs/functions/isListItemString.md +0 -21
  112. package/docs/functions/isModelNameMatched.md +0 -45
  113. package/docs/functions/isPunctuationChar.md +0 -36
  114. package/docs/functions/isRegExp.md +0 -21
  115. package/docs/functions/isSectionString.md +0 -23
  116. package/docs/functions/isSentenceEnding.md +0 -21
  117. package/docs/functions/isSepLineString.md +0 -21
  118. package/docs/functions/isSubdirectory.md +0 -39
  119. package/docs/functions/isTitleString.md +0 -23
  120. package/docs/functions/isValidFilename.md +0 -38
  121. package/docs/functions/isValidFilepath.md +0 -27
  122. package/docs/functions/isWebStream.md +0 -21
  123. package/docs/functions/jsonFilterToWhere.md +0 -45
  124. package/docs/functions/jsonToMarkdownStr.md +0 -31
  125. package/docs/functions/loadFileFromPaths.md +0 -54
  126. package/docs/functions/loadTextFromPaths.md +0 -29
  127. package/docs/functions/lrucache.md +0 -29
  128. package/docs/functions/makeToolFuncCancelable.md +0 -23
  129. package/docs/functions/matchUrlProtocol.md +0 -48
  130. package/docs/functions/memoize.md +0 -27
  131. package/docs/functions/messagesToText.md +0 -21
  132. package/docs/functions/paramsSizeToScaleStr.md +0 -32
  133. package/docs/functions/parseCommand.md +0 -33
  134. package/docs/functions/parseDateFormat.md +0 -360
  135. package/docs/functions/parseFString.md +0 -26
  136. package/docs/functions/parseISO.md +0 -72
  137. package/docs/functions/parseJsJson.md +0 -38
  138. package/docs/functions/parseJsJsonSimpleSync.md +0 -23
  139. package/docs/functions/parseObjectArgInfo.md +0 -27
  140. package/docs/functions/parseObjectArgumentInfos.md +0 -25
  141. package/docs/functions/parseObjectArguments.md +0 -68
  142. package/docs/functions/parseObjectArgumentsAsArgInfos.md +0 -42
  143. package/docs/functions/parseYaml.md +0 -21
  144. package/docs/functions/quoteStr.md +0 -21
  145. package/docs/functions/reControlCharsRegex.md +0 -21
  146. package/docs/functions/readFilenamesRecursiveSync.md +0 -47
  147. package/docs/functions/readTextFileChunks.md +0 -51
  148. package/docs/functions/readTextFileChunksEx.md +0 -23
  149. package/docs/functions/readableFromAsyncIterable.md +0 -28
  150. package/docs/functions/registerCoreTools.md +0 -17
  151. package/docs/functions/registerYamlTag.md +0 -21
  152. package/docs/functions/removeMarkdownBold.md +0 -23
  153. package/docs/functions/removeMarkdownBoldAndItalic.md +0 -23
  154. package/docs/functions/removeMarkdownItalic.md +0 -23
  155. package/docs/functions/replaceWithPlaceholder.md +0 -41
  156. package/docs/functions/restoreFromPlacehoders.md +0 -45
  157. package/docs/functions/sanitizeFilename.md +0 -37
  158. package/docs/functions/sanitizeFilepath.md +0 -31
  159. package/docs/functions/saveConfigFile.md +0 -25
  160. package/docs/functions/scaleStrToParamsSize.md +0 -27
  161. package/docs/functions/simplifyObjectArguments.md +0 -21
  162. package/docs/functions/sortedValues.md +0 -25
  163. package/docs/functions/splitChunks.md +0 -23
  164. package/docs/functions/splitParagraph.md +0 -32
  165. package/docs/functions/splitSentence.md +0 -37
  166. package/docs/functions/stringifyYaml.md +0 -21
  167. package/docs/functions/stripConsoleColor.md +0 -21
  168. package/docs/functions/textToDate.md +0 -23
  169. package/docs/functions/throwError.md +0 -37
  170. package/docs/functions/toDate.md +0 -76
  171. package/docs/functions/toDateTime.md +0 -21
  172. package/docs/functions/toRegExp.md +0 -34
  173. package/docs/functions/trimStartOfStreamHelper.md +0 -41
  174. package/docs/functions/truncTo.md +0 -47
  175. package/docs/functions/truncateByToken.md +0 -23
  176. package/docs/functions/truncateToTokenLimit.md +0 -44
  177. package/docs/functions/truncateToTokenLimitEx.md +0 -23
  178. package/docs/functions/uuid.md +0 -23
  179. package/docs/functions/uuidParse.md +0 -21
  180. package/docs/functions/uuidStringify.md +0 -23
  181. package/docs/functions/uuidValidate.md +0 -21
  182. package/docs/functions/uuidVersion.md +0 -21
  183. package/docs/functions/uuidv1.md +0 -47
  184. package/docs/functions/uuidv4.md +0 -47
  185. package/docs/functions/uuidv5.md +0 -51
  186. package/docs/functions/wait.md +0 -21
  187. package/docs/functions/xxhash.md +0 -25
  188. package/docs/functions/xxhash32.md +0 -23
  189. package/docs/functions/xxhash64.md +0 -23
  190. package/docs/functions/xxhashAsStr.md +0 -25
  191. package/docs/globals.md +0 -285
  192. package/docs/interfaces/AIChatAssistantMessageParam.md +0 -117
  193. package/docs/interfaces/AIChatContentPartImage.md +0 -31
  194. package/docs/interfaces/AIChatContentPartText.md +0 -27
  195. package/docs/interfaces/AIChatMessageParamBase.md +0 -58
  196. package/docs/interfaces/AIChatMessageToolCall.md +0 -45
  197. package/docs/interfaces/AIChatSystemMessageParam.md +0 -87
  198. package/docs/interfaces/AIChatToolMessageParam.md +0 -97
  199. package/docs/interfaces/AIChatUserMessageParam.md +0 -127
  200. package/docs/interfaces/AIChoiceConfig.md +0 -77
  201. package/docs/interfaces/AIResult.md +0 -73
  202. package/docs/interfaces/AIStreamParser.md +0 -39
  203. package/docs/interfaces/AIStreamParserOptions.md +0 -21
  204. package/docs/interfaces/BaseFunc.md +0 -155
  205. package/docs/interfaces/BaseFuncItem.md +0 -103
  206. package/docs/interfaces/CancelableAbilityOptions.md +0 -115
  207. package/docs/interfaces/ClientFuncItem.md +0 -179
  208. package/docs/interfaces/DotenvExpandOptions.md +0 -47
  209. package/docs/interfaces/DotenvExpandOutput.md +0 -27
  210. package/docs/interfaces/DotenvParseInput.md +0 -11
  211. package/docs/interfaces/DotenvParseOutput.md +0 -11
  212. package/docs/interfaces/DotenvPopulateInput.md +0 -11
  213. package/docs/interfaces/EventClientFuncParams.md +0 -55
  214. package/docs/interfaces/EventServerFuncParams.md +0 -71
  215. package/docs/interfaces/FewShotPromptTemplateOptions.md +0 -163
  216. package/docs/interfaces/FuncItem.md +0 -143
  217. package/docs/interfaces/FuncParam.md +0 -71
  218. package/docs/interfaces/FuncParams.md +0 -11
  219. package/docs/interfaces/Funcs.md +0 -11
  220. package/docs/interfaces/HashAlgoParams.md +0 -37
  221. package/docs/interfaces/IFileMetaInfo.md +0 -77
  222. package/docs/interfaces/IReadTextFileChunksOptions.md +0 -157
  223. package/docs/interfaces/ITruncateToTokenLimitOptions.md +0 -111
  224. package/docs/interfaces/JsonFilter.md +0 -11
  225. package/docs/interfaces/ParseObjectArgumentOptions.md +0 -97
  226. package/docs/interfaces/PromptExampleSelectorOptions.md +0 -36
  227. package/docs/interfaces/PromptTemplateOptions.md +0 -75
  228. package/docs/interfaces/RemoteFuncItem.md +0 -168
  229. package/docs/interfaces/ReplacePlacehoderOptions.md +0 -47
  230. package/docs/interfaces/ResClientFuncParams.md +0 -35
  231. package/docs/interfaces/ResServerFuncParams.md +0 -73
  232. package/docs/interfaces/SanitizeFilenameOptions.md +0 -27
  233. package/docs/interfaces/SectionStringOptions.md +0 -27
  234. package/docs/interfaces/ServerFuncItem.md +0 -189
  235. package/docs/interfaces/ServerFuncParams.md +0 -37
  236. package/docs/interfaces/SplitSentenceOptions.md +0 -47
  237. package/docs/interfaces/StreamCallbacksAndOptions.md +0 -95
  238. package/docs/interfaces/TaskAbortControllers.md +0 -11
  239. package/docs/interfaces/TaskPromise.md +0 -138
  240. package/docs/interfaces/ToolFuncPackage.md +0 -49
  241. package/docs/type-aliases/AIChatContentPart.md +0 -13
  242. package/docs/type-aliases/AIChatMessageParam.md +0 -13
  243. package/docs/type-aliases/AIChatRole.md +0 -13
  244. package/docs/type-aliases/AIMessageType.md +0 -13
  245. package/docs/type-aliases/AIModelNameRule.md +0 -13
  246. package/docs/type-aliases/AIModelNameRuleFn.md +0 -21
  247. package/docs/type-aliases/AIModelNameRules.md +0 -13
  248. package/docs/type-aliases/AITextGenerationFinishReason.md +0 -13
  249. package/docs/type-aliases/ActionName.md +0 -13
  250. package/docs/type-aliases/AsyncTaskId.md +0 -13
  251. package/docs/type-aliases/EventErrorListenerFn.md +0 -27
  252. package/docs/type-aliases/EventListenerFn.md +0 -25
  253. package/docs/type-aliases/FStringPromptTemplateNode.md +0 -16
  254. package/docs/type-aliases/FuncParamType.md +0 -13
  255. package/docs/type-aliases/PromptExamples.md +0 -17
  256. package/docs/type-aliases/PromptTemplateType.md +0 -13
  257. package/docs/type-aliases/PromptType.md +0 -13
  258. package/docs/type-aliases/TFunc.md +0 -23
  259. package/docs/variables/AIChatRoles.md +0 -13
  260. package/docs/variables/AIMessageTypes.md +0 -13
  261. package/docs/variables/AITextGenerationFinishReasons.md +0 -13
  262. package/docs/variables/AbortErrorCode.md +0 -13
  263. package/docs/variables/ActionNames.md +0 -13
  264. package/docs/variables/AlreadyExistsErrorCode.md +0 -13
  265. package/docs/variables/ClientToolFuncSchema.md +0 -87
  266. package/docs/variables/DefaultAsyncSemaphoreCapacity.md +0 -13
  267. package/docs/variables/EventBusName.md +0 -13
  268. package/docs/variables/EventName.md +0 -13
  269. package/docs/variables/FilenameReservedRegex.md +0 -16
  270. package/docs/variables/HFBuiltins.md +0 -92
  271. package/docs/variables/InternalErrorCode.md +0 -13
  272. package/docs/variables/LLM_TOKENIZER_NAMES.md +0 -83
  273. package/docs/variables/LLM_TOKENIZER_NAMES_MAP.md +0 -13
  274. package/docs/variables/NotFoundErrorCode.md +0 -13
  275. package/docs/variables/NotImplementedErrorCode.md +0 -13
  276. package/docs/variables/PASSING_SCORE.md +0 -13
  277. package/docs/variables/PromptTemplateTypes.md +0 -13
  278. package/docs/variables/PromptTypes.md +0 -16
  279. package/docs/variables/RStreamErrCode.md +0 -13
  280. package/docs/variables/RemoteToolFuncSchema.md +0 -87
  281. package/docs/variables/ResponseRStreamErrCode.md +0 -13
  282. package/docs/variables/SSEChannelAlreadyClosedErrCode.md +0 -13
  283. package/docs/variables/ServerToolFuncSchema.md +0 -87
  284. package/docs/variables/ToolAsyncCancelableBit.md +0 -13
  285. package/docs/variables/ToolAsyncMultiTaskBit.md +0 -13
  286. package/docs/variables/ToolAsyncPriorityBit.md +0 -13
  287. package/docs/variables/ToolFuncSchema.md +0 -125
  288. package/docs/variables/WindowsReservedNameRegex.md +0 -15
  289. package/docs/variables/base32768.md +0 -13
  290. package/docs/variables/defaultTemplateFormat.md +0 -13
  291. package/docs/variables/event.md +0 -13
  292. package/docs/variables/eventClient.md +0 -13
  293. package/docs/variables/eventServer.md +0 -13
  294. package/docs/variables/lrucache.md +0 -13
  295. package/docs/variables/mimeType.md +0 -13
  296. package/docs/variables/uuidNIL.md +0 -13
@@ -1,25 +0,0 @@
1
- [**@isdk/ai-tool**](../README.md) • **Docs**
2
-
3
- ***
4
-
5
- [@isdk/ai-tool](../globals.md) / saveConfigFile
6
-
7
- # Function: saveConfigFile()
8
-
9
- > **saveConfigFile**(`filename`, `config`, `extLevel`): `string`
10
-
11
- ## Parameters
12
-
13
- • **filename**: `string`
14
-
15
- • **config**: `any`
16
-
17
- • **extLevel**: `number` = `1`
18
-
19
- ## Returns
20
-
21
- `string`
22
-
23
- ## Defined in
24
-
25
- [packages/ai-tool/src/utils/config.ts:88](https://github.com/isdk/ai-tool.js/blob/e324043799402aa2caa41711a9168487ab85c166/src/utils/config.ts#L88)
@@ -1,27 +0,0 @@
1
- [**@isdk/ai-tool**](../README.md) • **Docs**
2
-
3
- ***
4
-
5
- [@isdk/ai-tool](../globals.md) / scaleStrToParamsSize
6
-
7
- # Function: scaleStrToParamsSize()
8
-
9
- > **scaleStrToParamsSize**(`scale`): `number`
10
-
11
- Converts a formatted parameters size string (with units T, B, M, or K) back to its byte value.
12
-
13
- ## Parameters
14
-
15
- • **scale**: `string`
16
-
17
- The formatted parameter size string (e.g., "1.23B", "456M", "789K", or "123").
18
-
19
- ## Returns
20
-
21
- `number`
22
-
23
- The parameter size in bytes.
24
-
25
- ## Defined in
26
-
27
- [packages/ai-tool/src/utils/convert-params-size.ts:44](https://github.com/isdk/ai-tool.js/blob/e324043799402aa2caa41711a9168487ab85c166/src/utils/convert-params-size.ts#L44)
@@ -1,21 +0,0 @@
1
- [**@isdk/ai-tool**](../README.md) • **Docs**
2
-
3
- ***
4
-
5
- [@isdk/ai-tool](../globals.md) / simplifyObjectArguments
6
-
7
- # Function: simplifyObjectArguments()
8
-
9
- > **simplifyObjectArguments**(`args`): `any`
10
-
11
- ## Parameters
12
-
13
- • **args**: `any`
14
-
15
- ## Returns
16
-
17
- `any`
18
-
19
- ## Defined in
20
-
21
- [packages/ai-tool/src/utils/parse-command.ts:75](https://github.com/isdk/ai-tool.js/blob/e324043799402aa2caa41711a9168487ab85c166/src/utils/parse-command.ts#L75)
@@ -1,25 +0,0 @@
1
- [**@isdk/ai-tool**](../README.md) • **Docs**
2
-
3
- ***
4
-
5
- [@isdk/ai-tool](../globals.md) / sortedValues
6
-
7
- # Function: sortedValues()
8
-
9
- > **sortedValues**\<`T`\>(`values`): `T`[]
10
-
11
- ## Type Parameters
12
-
13
- • **T**
14
-
15
- ## Parameters
16
-
17
- • **values**: `Record`\<`string`, `T`\>
18
-
19
- ## Returns
20
-
21
- `T`[]
22
-
23
- ## Defined in
24
-
25
- [packages/ai-tool/src/utils/prompt/few-shot-prompt-template.ts:4](https://github.com/isdk/ai-tool.js/blob/e324043799402aa2caa41711a9168487ab85c166/src/utils/prompt/few-shot-prompt-template.ts#L4)
@@ -1,23 +0,0 @@
1
- [**@isdk/ai-tool**](../README.md) • **Docs**
2
-
3
- ***
4
-
5
- [@isdk/ai-tool](../globals.md) / splitChunks
6
-
7
- # Function: splitChunks()
8
-
9
- > **splitChunks**(`content`, `options`?): `Promise`\<`string`[][]\>
10
-
11
- ## Parameters
12
-
13
- • **content**: `string`
14
-
15
- • **options?**: [`IReadTextFileChunksOptions`](../interfaces/IReadTextFileChunksOptions.md)
16
-
17
- ## Returns
18
-
19
- `Promise`\<`string`[][]\>
20
-
21
- ## Defined in
22
-
23
- [packages/ai-tool/src/utils/read-text-file-chunks.ts:182](https://github.com/isdk/ai-tool.js/blob/e324043799402aa2caa41711a9168487ab85c166/src/utils/read-text-file-chunks.ts#L182)
@@ -1,32 +0,0 @@
1
- [**@isdk/ai-tool**](../README.md) • **Docs**
2
-
3
- ***
4
-
5
- [@isdk/ai-tool](../globals.md) / splitParagraph
6
-
7
- # Function: splitParagraph()
8
-
9
- > **splitParagraph**(`value`, `options`?): `string`[][]
10
-
11
- Splits the input string into paragraphs based on empty lines and title lines.
12
- Each paragraph is represented as an array of strings, where each string is a line in the paragraph.
13
-
14
- ## Parameters
15
-
16
- • **value**: `string`
17
-
18
- The input string to be split into paragraphs.
19
-
20
- • **options?**: [`SplitSentenceOptions`](../interfaces/SplitSentenceOptions.md)
21
-
22
- Optional configuration options for splitting the string.
23
-
24
- ## Returns
25
-
26
- `string`[][]
27
-
28
- A two-dimensional array where each sub-array represents a paragraph.
29
-
30
- ## Defined in
31
-
32
- [packages/ai-tool/src/utils/split-paragraph.ts:12](https://github.com/isdk/ai-tool.js/blob/e324043799402aa2caa41711a9168487ab85c166/src/utils/split-paragraph.ts#L12)
@@ -1,37 +0,0 @@
1
- [**@isdk/ai-tool**](../README.md) • **Docs**
2
-
3
- ***
4
-
5
- [@isdk/ai-tool](../globals.md) / splitSentence
6
-
7
- # Function: splitSentence()
8
-
9
- > **splitSentence**(`text`, `best`): `string`[]
10
-
11
- Splits a text into sentences.
12
- This function is used to split a text into separate sentences, based on punctuation marks such as '.', '?', or '!' and other rules.
13
-
14
- ## Parameters
15
-
16
- • **text**: `string`
17
-
18
- The input string that needs to be split into sentences.
19
-
20
- • **best**: [`SplitSentenceOptions`](../interfaces/SplitSentenceOptions.md) = `{}`
21
-
22
- A boolean flag indicating if the function should use the best possible sentence splitting method (default is true).
23
- If set to false, it will not perform any additional processing and simply split on newline characters ('\n').
24
-
25
- ## Returns
26
-
27
- `string`[]
28
-
29
- An array of strings where each string represents a sentence in the input text.
30
-
31
- Example:
32
- const text = "Hello world! How are you today? I am fine.";
33
- console.log(splitSentence(text)); // returns ['Hello world!', 'How are you today?', 'I am fine.']
34
-
35
- ## Defined in
36
-
37
- [packages/ai-tool/src/utils/split-sentence.ts:44](https://github.com/isdk/ai-tool.js/blob/e324043799402aa2caa41711a9168487ab85c166/src/utils/split-sentence.ts#L44)
@@ -1,21 +0,0 @@
1
- [**@isdk/ai-tool**](../README.md) • **Docs**
2
-
3
- ***
4
-
5
- [@isdk/ai-tool](../globals.md) / stringifyYaml
6
-
7
- # Function: stringifyYaml()
8
-
9
- > **stringifyYaml**(`content`): `string`
10
-
11
- ## Parameters
12
-
13
- • **content**: `any`
14
-
15
- ## Returns
16
-
17
- `string`
18
-
19
- ## Defined in
20
-
21
- [packages/ai-tool/src/utils/config.ts:28](https://github.com/isdk/ai-tool.js/blob/e324043799402aa2caa41711a9168487ab85c166/src/utils/config.ts#L28)
@@ -1,21 +0,0 @@
1
- [**@isdk/ai-tool**](../README.md) • **Docs**
2
-
3
- ***
4
-
5
- [@isdk/ai-tool](../globals.md) / stripConsoleColor
6
-
7
- # Function: stripConsoleColor()
8
-
9
- > **stripConsoleColor**(`str`): `any`
10
-
11
- ## Parameters
12
-
13
- • **str**: `any`
14
-
15
- ## Returns
16
-
17
- `any`
18
-
19
- ## Defined in
20
-
21
- [packages/ai-tool/src/utils/strip-console-color.ts:1](https://github.com/isdk/ai-tool.js/blob/e324043799402aa2caa41711a9168487ab85c166/src/utils/strip-console-color.ts#L1)
@@ -1,23 +0,0 @@
1
- [**@isdk/ai-tool**](../README.md) • **Docs**
2
-
3
- ***
4
-
5
- [@isdk/ai-tool](../globals.md) / textToDate
6
-
7
- # Function: textToDate()
8
-
9
- > **textToDate**(`date`, `format`): `Date`
10
-
11
- ## Parameters
12
-
13
- • **date**: `string`
14
-
15
- • **format**: `string` = `FormatDateStr`
16
-
17
- ## Returns
18
-
19
- `Date`
20
-
21
- ## Defined in
22
-
23
- [packages/ai-tool/src/utils/to-datetime.ts:25](https://github.com/isdk/ai-tool.js/blob/e324043799402aa2caa41711a9168487ab85c166/src/utils/to-datetime.ts#L25)
@@ -1,37 +0,0 @@
1
- [**@isdk/ai-tool**](../README.md) • **Docs**
2
-
3
- ***
4
-
5
- [@isdk/ai-tool](../globals.md) / throwError
6
-
7
- # Function: throwError()
8
-
9
- > **throwError**(`message`, `name`?, `status`?): `void`
10
-
11
- Throw an error
12
-
13
- ## Parameters
14
-
15
- • **message**: `string`
16
-
17
- Error message
18
-
19
- • **name?**: `string` \| `Record`\<`string`, `any`\>
20
-
21
- Error name, optional
22
-
23
- • **status?**: `string` \| `number`
24
-
25
- Error status code, default to 500
26
-
27
- ## Returns
28
-
29
- `void`
30
-
31
- ## Throws
32
-
33
- Throws a BaseError object
34
-
35
- ## Defined in
36
-
37
- node\_modules/.pnpm/@isdk+common-error@0.1.3/node\_modules/@isdk/common-error/dist/index.d.ts:161
@@ -1,76 +0,0 @@
1
- [**@isdk/ai-tool**](../README.md) • **Docs**
2
-
3
- ***
4
-
5
- [@isdk/ai-tool](../globals.md) / toDate
6
-
7
- # Function: toDate()
8
-
9
- > **toDate**\<`DateType`, `ResultDate`\>(`argument`, `context`?): `ResultDate`
10
-
11
- ## Type Parameters
12
-
13
- • **DateType** *extends* `Date` \| `ConstructableDate`
14
-
15
- The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
16
-
17
- • **ResultDate** *extends* `Date` = `DateType`
18
-
19
- The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
20
-
21
- ## Parameters
22
-
23
- • **argument**: `DateArg`\<`DateType`\>
24
-
25
- The value to convert
26
-
27
- • **context?**: `ContextFn`\<`ResultDate`\>
28
-
29
- ## Returns
30
-
31
- `ResultDate`
32
-
33
- The parsed date in the local time zone
34
-
35
- ## Name
36
-
37
- toDate
38
-
39
- ## Summary
40
-
41
- Convert the given argument to an instance of Date.
42
-
43
- ## Description
44
-
45
- Convert the given argument to an instance of Date.
46
-
47
- If the argument is an instance of Date, the function returns its clone.
48
-
49
- If the argument is a number, it is treated as a timestamp.
50
-
51
- If the argument is none of the above, the function returns Invalid Date.
52
-
53
- Starting from v3.7.0, it clones a date using `[Symbol.for("constructDateFrom")]`
54
- enabling to transfer extra properties from the reference date to the new date.
55
- It's useful for extensions like [`TZDate`](https://github.com/date-fns/tz)
56
- that accept a time zone as a constructor argument.
57
-
58
- **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
59
-
60
- ## Examples
61
-
62
- ```ts
63
- // Clone the date:
64
- const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
65
- //=> Tue Feb 11 2014 11:30:30
66
- ```
67
-
68
- ```ts
69
- // Convert the timestamp to date:
70
- const result = toDate(1392098430000)
71
- //=> Tue Feb 11 2014 11:30:30
72
- ```
73
-
74
- ## Defined in
75
-
76
- node\_modules/.pnpm/date-fns@4.1.0/node\_modules/date-fns/toDate.d.ts:40
@@ -1,21 +0,0 @@
1
- [**@isdk/ai-tool**](../README.md) • **Docs**
2
-
3
- ***
4
-
5
- [@isdk/ai-tool](../globals.md) / toDateTime
6
-
7
- # Function: toDateTime()
8
-
9
- > **toDateTime**(`date`): `undefined` \| `Date`
10
-
11
- ## Parameters
12
-
13
- • **date**: `string` \| `number` \| `Date`
14
-
15
- ## Returns
16
-
17
- `undefined` \| `Date`
18
-
19
- ## Defined in
20
-
21
- [packages/ai-tool/src/utils/to-datetime.ts:9](https://github.com/isdk/ai-tool.js/blob/e324043799402aa2caa41711a9168487ab85c166/src/utils/to-datetime.ts#L9)
@@ -1,34 +0,0 @@
1
- [**@isdk/ai-tool**](../README.md) • **Docs**
2
-
3
- ***
4
-
5
- [@isdk/ai-tool](../globals.md) / toRegExp
6
-
7
- # Function: toRegExp()
8
-
9
- > **toRegExp**(`value`): `RegExp`
10
-
11
- create or clone RegExp
12
-
13
- ## Parameters
14
-
15
- • **value**: `string` \| `RegExp`
16
-
17
- create a new RegExp from.
18
-
19
- ## Returns
20
-
21
- `RegExp`
22
-
23
- - new RegExp instance.
24
-
25
- ## Example
26
-
27
- ```ts
28
- toRegExp('/[a-z]/g') // new RegExp(/[a-z]/g)
29
- toRegExp(/[a-z]/g) // new RegExp(/[a-z]/g)
30
- ```
31
-
32
- ## Defined in
33
-
34
- node\_modules/.pnpm/util-ex@2.0.0/node\_modules/util-ex/lib/to-regexp.d.ts:9
@@ -1,41 +0,0 @@
1
- [**@isdk/ai-tool**](../README.md) • **Docs**
2
-
3
- ***
4
-
5
- [@isdk/ai-tool](../globals.md) / trimStartOfStreamHelper
6
-
7
- # Function: trimStartOfStreamHelper()
8
-
9
- > **trimStartOfStreamHelper**(): (`text`) => `string`
10
-
11
- Returns a stateful function that, when invoked, trims leading whitespace
12
- from the input text. The trimming only occurs on the first invocation, ensuring that
13
- subsequent calls do not alter the input text. This is particularly useful in scenarios
14
- where a text stream is being processed and only the initial whitespace should be removed.
15
-
16
- ## Returns
17
-
18
- `Function`
19
-
20
- A function that takes a string as input and returns a string
21
- with leading whitespace removed if it is the first invocation; otherwise, it returns the input unchanged.
22
-
23
- ### Parameters
24
-
25
- • **text**: `string`
26
-
27
- ### Returns
28
-
29
- `string`
30
-
31
- ## Example
32
-
33
- ```ts
34
- const trimStart = trimStartOfStreamHelper();
35
- const output1 = trimStart(" text"); // "text"
36
- const output2 = trimStart(" text"); // " text"
37
- ```
38
-
39
- ## Defined in
40
-
41
- [packages/ai-tool/src/utils/stream/ai-stream.ts:92](https://github.com/isdk/ai-tool.js/blob/e324043799402aa2caa41711a9168487ab85c166/src/utils/stream/ai-stream.ts#L92)
@@ -1,47 +0,0 @@
1
- [**@isdk/ai-tool**](../README.md) • **Docs**
2
-
3
- ***
4
-
5
- [@isdk/ai-tool](../globals.md) / truncTo
6
-
7
- # Function: truncTo()
8
-
9
- > **truncTo**(`n`, `dec`, `up`): `number`
10
-
11
- Truncates(Round) a number to a specified number of decimal places.
12
-
13
- ## Parameters
14
-
15
- • **n**: `number`
16
-
17
- The number to truncate.
18
-
19
- • **dec**: `number` = `2`
20
-
21
- The number of decimal places to truncate to (default is 2).
22
-
23
- • **up**: `number` = `0.5`
24
-
25
- The amount to round up by before truncating (default is 0.5).
26
-
27
- ## Returns
28
-
29
- `number`
30
-
31
- The truncated number.
32
-
33
- ## Examples
34
-
35
- ```ts
36
- // returns 1.235
37
- truncTo(1.2345, 3)
38
- ```
39
-
40
- ```ts
41
- // returns 1.24
42
- truncTo(1.2345, 2, 0.6)
43
- ```
44
-
45
- ## Defined in
46
-
47
- [packages/ai-tool/src/utils/trunc-to.ts:19](https://github.com/isdk/ai-tool.js/blob/e324043799402aa2caa41711a9168487ab85c166/src/utils/trunc-to.ts#L19)
@@ -1,23 +0,0 @@
1
- [**@isdk/ai-tool**](../README.md) • **Docs**
2
-
3
- ***
4
-
5
- [@isdk/ai-tool](../globals.md) / truncateByToken
6
-
7
- # Function: truncateByToken()
8
-
9
- > **truncateByToken**(`content`, `options`?): `Promise`\<`void`\>
10
-
11
- ## Parameters
12
-
13
- • **content**: `string`
14
-
15
- • **options?**: [`ITruncateToTokenLimitOptions`](../interfaces/ITruncateToTokenLimitOptions.md)
16
-
17
- ## Returns
18
-
19
- `Promise`\<`void`\>
20
-
21
- ## Defined in
22
-
23
- [packages/ai-tool/src/utils/truncate-to-token-limit.ts:164](https://github.com/isdk/ai-tool.js/blob/e324043799402aa2caa41711a9168487ab85c166/src/utils/truncate-to-token-limit.ts#L164)
@@ -1,44 +0,0 @@
1
- [**@isdk/ai-tool**](../README.md) • **Docs**
2
-
3
- ***
4
-
5
- [@isdk/ai-tool](../globals.md) / truncateToTokenLimit
6
-
7
- # Function: truncateToTokenLimit()
8
-
9
- > **truncateToTokenLimit**(`content`, `options`?): `Promise`\<`string`\>
10
-
11
- Truncates the given content to fit within a specified token limit by removing sentences from the end.
12
- This function is suitable for text content with multiple sentences.
13
-
14
- ## Parameters
15
-
16
- • **content**: `string`
17
-
18
- The original text content to be processed.
19
-
20
- • **options?**: [`ITruncateToTokenLimitOptions`](../interfaces/ITruncateToTokenLimitOptions.md)
21
-
22
- Optional configuration including model ID and size limit.
23
-
24
- ## Returns
25
-
26
- `Promise`\<`string`\>
27
-
28
- The truncated text content.
29
-
30
- ## Example
31
-
32
- ```typescript
33
- const text = "This is an example text that will be truncated to fit within the token limit. It contains multiple sentences. Each sentence will be removed until the content fits within the specified token limit. This is the fourth sentence. This is the fifth sentence.";
34
- const truncatedText = await truncateToTokenLimit(text, { modelId: "exampleModel", size: 50 });
35
- console.log(truncatedText); // Output may be the truncated text
36
- ```
37
-
38
- ## Warning
39
-
40
- This function is designed for text content with multiple sentences.
41
-
42
- ## Defined in
43
-
44
- [packages/ai-tool/src/utils/truncate-to-token-limit.ts:31](https://github.com/isdk/ai-tool.js/blob/e324043799402aa2caa41711a9168487ab85c166/src/utils/truncate-to-token-limit.ts#L31)
@@ -1,23 +0,0 @@
1
- [**@isdk/ai-tool**](../README.md) • **Docs**
2
-
3
- ***
4
-
5
- [@isdk/ai-tool](../globals.md) / truncateToTokenLimitEx
6
-
7
- # Function: truncateToTokenLimitEx()
8
-
9
- > **truncateToTokenLimitEx**(`sentences`, `options`?): `Promise`\<`string`[]\>
10
-
11
- ## Parameters
12
-
13
- • **sentences**: `string`[]
14
-
15
- • **options?**: [`ITruncateToTokenLimitOptions`](../interfaces/ITruncateToTokenLimitOptions.md)
16
-
17
- ## Returns
18
-
19
- `Promise`\<`string`[]\>
20
-
21
- ## Defined in
22
-
23
- [packages/ai-tool/src/utils/truncate-to-token-limit.ts:111](https://github.com/isdk/ai-tool.js/blob/e324043799402aa2caa41711a9168487ab85c166/src/utils/truncate-to-token-limit.ts#L111)
@@ -1,23 +0,0 @@
1
- [**@isdk/ai-tool**](../README.md) • **Docs**
2
-
3
- ***
4
-
5
- [@isdk/ai-tool](../globals.md) / uuid
6
-
7
- # Function: uuid()
8
-
9
- > **uuid**(`ver`, `encode`?): `string`
10
-
11
- ## Parameters
12
-
13
- • **ver**: `1` \| `4` \| `5` = `1`
14
-
15
- • **encode?**: `boolean`
16
-
17
- ## Returns
18
-
19
- `string`
20
-
21
- ## Defined in
22
-
23
- [packages/ai-tool/src/utils/hash/uuid.ts:8](https://github.com/isdk/ai-tool.js/blob/e324043799402aa2caa41711a9168487ab85c166/src/utils/hash/uuid.ts#L8)
@@ -1,21 +0,0 @@
1
- [**@isdk/ai-tool**](../README.md) • **Docs**
2
-
3
- ***
4
-
5
- [@isdk/ai-tool](../globals.md) / uuidParse
6
-
7
- # Function: uuidParse()
8
-
9
- > **uuidParse**(`uuid`): `Uint8Array`
10
-
11
- ## Parameters
12
-
13
- • **uuid**: `string`
14
-
15
- ## Returns
16
-
17
- `Uint8Array`
18
-
19
- ## Defined in
20
-
21
- node\_modules/.pnpm/@types+uuid@10.0.0/node\_modules/@types/uuid/index.d.ts:102
@@ -1,23 +0,0 @@
1
- [**@isdk/ai-tool**](../README.md) • **Docs**
2
-
3
- ***
4
-
5
- [@isdk/ai-tool](../globals.md) / uuidStringify
6
-
7
- # Function: uuidStringify()
8
-
9
- > **uuidStringify**(`buffer`, `offset`?): `string`
10
-
11
- ## Parameters
12
-
13
- • **buffer**: `InputBuffer`
14
-
15
- • **offset?**: `number`
16
-
17
- ## Returns
18
-
19
- `string`
20
-
21
- ## Defined in
22
-
23
- node\_modules/.pnpm/@types+uuid@10.0.0/node\_modules/@types/uuid/index.d.ts:103