@isdk/ai-tool 0.2.3 → 0.4.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 (267) hide show
  1. package/dist/chunk-SIP3XWIH.mjs +1 -0
  2. package/dist/funcs.d.mts +1 -1
  3. package/dist/funcs.d.ts +1 -1
  4. package/dist/funcs.js +1 -1
  5. package/dist/funcs.mjs +1 -1
  6. package/dist/{index-DUEs7T8M.d.mts → index-BC3GQn6-.d.mts} +7 -0
  7. package/dist/{index-DUEs7T8M.d.ts → index-BC3GQn6-.d.ts} +7 -0
  8. package/dist/index.d.mts +413 -11
  9. package/dist/index.d.ts +413 -11
  10. package/dist/index.js +1 -1
  11. package/dist/index.mjs +1 -1
  12. package/dist/test/util.mjs +1 -1
  13. package/docs/classes/AbortError.md +45 -15
  14. package/docs/classes/AlreadyExistsError.md +45 -15
  15. package/docs/classes/BaseError.md +42 -16
  16. package/docs/classes/CancelableAbility.md +20 -20
  17. package/docs/classes/ClientTools.md +93 -93
  18. package/docs/classes/CommonError.md +45 -15
  19. package/docs/classes/EventClient.md +115 -115
  20. package/docs/classes/EventServer.md +117 -117
  21. package/docs/classes/EventToolFunc.md +85 -85
  22. package/docs/classes/FStringPromptTemplate.md +18 -18
  23. package/docs/classes/FewShotPromptTemplate.md +22 -22
  24. package/docs/classes/GolangPromptTemplate.md +18 -18
  25. package/docs/classes/HFEnvironment.md +9 -9
  26. package/docs/classes/HFInterpreter.md +4 -4
  27. package/docs/classes/HFTemplate.md +4 -4
  28. package/docs/classes/HfPromptTemplate.md +18 -18
  29. package/docs/classes/IntSet.md +11 -11
  30. package/docs/classes/NotFoundError.md +45 -15
  31. package/docs/classes/NotImplementationError.md +45 -15
  32. package/docs/classes/PromptExampleSelector.md +8 -8
  33. package/docs/classes/PromptTemplate.md +17 -17
  34. package/docs/classes/ReadableStreamError.md +45 -15
  35. package/docs/classes/ResClientTools.md +100 -100
  36. package/docs/classes/ResServerTools.md +101 -101
  37. package/docs/classes/SSEChannel.md +14 -14
  38. package/docs/classes/Semaphore.md +8 -8
  39. package/docs/classes/ServerTools.md +89 -89
  40. package/docs/classes/TaskAbortController.md +8 -8
  41. package/docs/classes/ToolFunc.md +82 -82
  42. package/docs/classes/YamlTypeBaseObject.md +29 -0
  43. package/docs/enumerations/AsyncFeatureBits.md +3 -3
  44. package/docs/enumerations/AsyncFeatures.md +3 -3
  45. package/docs/enumerations/ErrorCode.md +21 -21
  46. package/docs/enumerations/HashAlgorithm.md +117 -0
  47. package/docs/functions/AIArgProcessor.md +1 -1
  48. package/docs/functions/AIStream.md +1 -1
  49. package/docs/functions/ChoiceArgProcessor.md +1 -1
  50. package/docs/functions/RateLimit.md +1 -1
  51. package/docs/functions/TemplateArgProcessor.md +1 -1
  52. package/docs/functions/backendEventable.md +1 -1
  53. package/docs/functions/completeSentences.md +23 -0
  54. package/docs/functions/concatText.md +23 -0
  55. package/docs/functions/countLLMTokens.md +23 -0
  56. package/docs/functions/countRegexMatches.md +1 -1
  57. package/docs/functions/createCallbacksTransformer.md +1 -1
  58. package/docs/functions/createEmptyReadableStream.md +1 -1
  59. package/docs/functions/createEndWithRepetitionDetector.md +1 -1
  60. package/docs/functions/createError.md +1 -1
  61. package/docs/functions/createEventStreamTransformer.md +1 -1
  62. package/docs/functions/createHfValueFunc.md +1 -1
  63. package/docs/functions/createLRUCache.md +1 -1
  64. package/docs/functions/createYamlObjectTag.md +23 -0
  65. package/docs/functions/dateToText.md +1 -1
  66. package/docs/functions/decodeCharset.md +23 -0
  67. package/docs/functions/detectCharset.md +23 -0
  68. package/docs/functions/encodeLLMTokens.md +23 -0
  69. package/docs/functions/expandEnv.md +1 -1
  70. package/docs/functions/expandObjEnv.md +1 -1
  71. package/docs/functions/extNameLevel.md +1 -1
  72. package/docs/functions/fileIsExists.md +1 -1
  73. package/docs/functions/filenameReservedRegex.md +1 -1
  74. package/docs/functions/filterValidFnScope.md +1 -1
  75. package/docs/functions/findIndexNonEmptyFrom.md +23 -0
  76. package/docs/functions/findPort.md +1 -1
  77. package/docs/functions/formatTextWithSpace.md +59 -0
  78. package/docs/functions/getAllEnumKeys.md +1 -1
  79. package/docs/functions/getConfigFileNames.md +1 -1
  80. package/docs/functions/getConfigs.md +1 -1
  81. package/docs/functions/getFileMetaInfo.md +21 -0
  82. package/docs/functions/getHashAlgoBySize.md +21 -0
  83. package/docs/functions/getKeysPath.md +1 -1
  84. package/docs/functions/getLLMTokenizer.md +21 -0
  85. package/docs/functions/getMultiLevelExtname.md +1 -1
  86. package/docs/functions/getPackageDir.md +1 -1
  87. package/docs/functions/getRealFilepath.md +1 -1
  88. package/docs/functions/getResponseErrorReadableStream.md +1 -1
  89. package/docs/functions/hasDirectoryIn.md +1 -1
  90. package/docs/functions/hashFile.md +23 -0
  91. package/docs/functions/hashStream.md +23 -0
  92. package/docs/functions/hfParse.md +1 -1
  93. package/docs/functions/hfTokenize.md +1 -1
  94. package/docs/functions/interpolateEnv.md +1 -1
  95. package/docs/functions/interpolateFString.md +1 -1
  96. package/docs/functions/interpolateGolangTemplate.md +1 -1
  97. package/docs/functions/isLangUsingSpaces.md +21 -0
  98. package/docs/functions/isListItemString.md +21 -0
  99. package/docs/functions/isModelNameMatched.md +1 -1
  100. package/docs/functions/isPunctuationChar.md +36 -0
  101. package/docs/functions/isRegExp.md +1 -1
  102. package/docs/functions/isSectionString.md +23 -0
  103. package/docs/functions/isSentenceEnding.md +21 -0
  104. package/docs/functions/isSepLineString.md +21 -0
  105. package/docs/functions/isSubdirectory.md +1 -1
  106. package/docs/functions/isTitleString.md +23 -0
  107. package/docs/functions/isValidFilename.md +1 -1
  108. package/docs/functions/isValidFilepath.md +1 -1
  109. package/docs/functions/isWebStream.md +1 -1
  110. package/docs/functions/jsonFilterToWhere.md +1 -1
  111. package/docs/functions/jsonToMarkdownStr.md +1 -1
  112. package/docs/functions/loadFileFromPaths.md +1 -1
  113. package/docs/functions/loadTextFromPaths.md +1 -1
  114. package/docs/functions/lrucache.md +1 -1
  115. package/docs/functions/makeToolFuncCancelable.md +1 -1
  116. package/docs/functions/matchUrlProtocol.md +1 -1
  117. package/docs/functions/memoize.md +1 -1
  118. package/docs/functions/messagesToText.md +1 -1
  119. package/docs/functions/paramsSizeToScaleStr.md +1 -1
  120. package/docs/functions/parseCommand.md +3 -11
  121. package/docs/functions/parseFString.md +1 -1
  122. package/docs/functions/parseJsJson.md +3 -3
  123. package/docs/functions/parseJsJsonSimpleSync.md +23 -0
  124. package/docs/functions/parseObjectArgInfo.md +1 -1
  125. package/docs/functions/parseObjectArgumentInfos.md +1 -1
  126. package/docs/functions/parseObjectArguments.md +1 -1
  127. package/docs/functions/parseObjectArgumentsAsArgInfos.md +1 -1
  128. package/docs/functions/parseYaml.md +1 -1
  129. package/docs/functions/quoteStr.md +1 -1
  130. package/docs/functions/reControlCharsRegex.md +1 -1
  131. package/docs/functions/readFilenamesRecursiveSync.md +1 -1
  132. package/docs/functions/readTextFileChunks.md +51 -0
  133. package/docs/functions/readTextFileChunksEx.md +23 -0
  134. package/docs/functions/readableFromAsyncIterable.md +1 -1
  135. package/docs/functions/registerCoreTools.md +1 -1
  136. package/docs/functions/registerYamlTag.md +1 -1
  137. package/docs/functions/removeMarkdownBold.md +23 -0
  138. package/docs/functions/removeMarkdownBoldAndItalic.md +23 -0
  139. package/docs/functions/removeMarkdownItalic.md +23 -0
  140. package/docs/functions/replaceWithPlaceholder.md +41 -0
  141. package/docs/functions/restoreFromPlacehoders.md +45 -0
  142. package/docs/functions/sanitizeFilename.md +1 -1
  143. package/docs/functions/sanitizeFilepath.md +1 -1
  144. package/docs/functions/saveConfigFile.md +1 -1
  145. package/docs/functions/scaleStrToParamsSize.md +1 -1
  146. package/docs/functions/simplifyObjectArguments.md +1 -1
  147. package/docs/functions/sortedValues.md +1 -1
  148. package/docs/functions/splitChunks.md +23 -0
  149. package/docs/functions/splitParagraph.md +32 -0
  150. package/docs/functions/splitSentence.md +2 -2
  151. package/docs/functions/stringifyYaml.md +1 -1
  152. package/docs/functions/stripConsoleColor.md +21 -0
  153. package/docs/functions/textToDate.md +1 -1
  154. package/docs/functions/throwError.md +1 -1
  155. package/docs/functions/toDateTime.md +1 -1
  156. package/docs/functions/trimStartOfStreamHelper.md +1 -1
  157. package/docs/functions/truncTo.md +1 -1
  158. package/docs/functions/truncateByToken.md +23 -0
  159. package/docs/functions/truncateToTokenLimit.md +44 -0
  160. package/docs/functions/truncateToTokenLimitEx.md +23 -0
  161. package/docs/functions/uuid.md +1 -1
  162. package/docs/functions/wait.md +1 -1
  163. package/docs/functions/xxhash.md +2 -2
  164. package/docs/functions/xxhash32.md +1 -1
  165. package/docs/functions/xxhash64.md +1 -1
  166. package/docs/functions/xxhashAsStr.md +2 -2
  167. package/docs/globals.md +46 -1
  168. package/docs/interfaces/AIChatAssistantMessageParam.md +48 -6
  169. package/docs/interfaces/AIChatContentPartImage.md +2 -2
  170. package/docs/interfaces/AIChatContentPartText.md +2 -2
  171. package/docs/interfaces/AIChatMessageParamBase.md +31 -1
  172. package/docs/interfaces/AIChatMessageToolCall.md +3 -3
  173. package/docs/interfaces/AIChatSystemMessageParam.md +45 -3
  174. package/docs/interfaces/AIChatToolMessageParam.md +46 -4
  175. package/docs/interfaces/AIChatUserMessageParam.md +49 -7
  176. package/docs/interfaces/AIChoiceConfig.md +7 -7
  177. package/docs/interfaces/AIResult.md +5 -5
  178. package/docs/interfaces/AIStreamParser.md +1 -1
  179. package/docs/interfaces/AIStreamParserOptions.md +1 -1
  180. package/docs/interfaces/BaseFunc.md +9 -9
  181. package/docs/interfaces/BaseFuncItem.md +8 -8
  182. package/docs/interfaces/CancelableAbilityOptions.md +2 -2
  183. package/docs/interfaces/ClientFuncItem.md +11 -11
  184. package/docs/interfaces/DotenvExpandOptions.md +3 -3
  185. package/docs/interfaces/DotenvExpandOutput.md +2 -2
  186. package/docs/interfaces/EventClientFuncParams.md +4 -4
  187. package/docs/interfaces/EventServerFuncParams.md +5 -5
  188. package/docs/interfaces/FewShotPromptTemplateOptions.md +11 -11
  189. package/docs/interfaces/FuncItem.md +9 -9
  190. package/docs/interfaces/FuncParam.md +6 -6
  191. package/docs/interfaces/HashAlgoParams.md +37 -0
  192. package/docs/interfaces/IFileMetaInfo.md +77 -0
  193. package/docs/interfaces/IReadTextFileChunksOptions.md +157 -0
  194. package/docs/interfaces/ITruncateToTokenLimitOptions.md +111 -0
  195. package/docs/interfaces/ParseObjectArgumentOptions.md +55 -5
  196. package/docs/interfaces/PromptExampleSelectorOptions.md +2 -2
  197. package/docs/interfaces/PromptTemplateOptions.md +6 -6
  198. package/docs/interfaces/RemoteFuncItem.md +11 -11
  199. package/docs/interfaces/ReplacePlacehoderOptions.md +47 -0
  200. package/docs/interfaces/ResClientFuncParams.md +2 -2
  201. package/docs/interfaces/ResServerFuncParams.md +5 -5
  202. package/docs/interfaces/SanitizeFilenameOptions.md +2 -2
  203. package/docs/interfaces/SectionStringOptions.md +27 -0
  204. package/docs/interfaces/ServerFuncItem.md +12 -12
  205. package/docs/interfaces/ServerFuncParams.md +2 -2
  206. package/docs/interfaces/SplitSentenceOptions.md +47 -0
  207. package/docs/interfaces/StreamCallbacksAndOptions.md +4 -4
  208. package/docs/interfaces/TaskPromise.md +5 -5
  209. package/docs/interfaces/ToolFuncPackage.md +3 -3
  210. package/docs/type-aliases/AIChatContentPart.md +1 -1
  211. package/docs/type-aliases/AIChatMessageParam.md +1 -1
  212. package/docs/type-aliases/AIChatRole.md +1 -1
  213. package/docs/type-aliases/AIMessageType.md +1 -1
  214. package/docs/type-aliases/AIModelNameRule.md +1 -1
  215. package/docs/type-aliases/AIModelNameRuleFn.md +1 -1
  216. package/docs/type-aliases/AIModelNameRules.md +1 -1
  217. package/docs/type-aliases/AITextGenerationFinishReason.md +1 -1
  218. package/docs/type-aliases/ActionName.md +1 -1
  219. package/docs/type-aliases/AsyncTaskId.md +1 -1
  220. package/docs/type-aliases/EventErrorListenerFn.md +1 -1
  221. package/docs/type-aliases/EventListenerFn.md +1 -1
  222. package/docs/type-aliases/FStringPromptTemplateNode.md +1 -1
  223. package/docs/type-aliases/FuncParamType.md +1 -1
  224. package/docs/type-aliases/PromptExamples.md +1 -1
  225. package/docs/type-aliases/PromptTemplateType.md +1 -1
  226. package/docs/type-aliases/PromptType.md +1 -1
  227. package/docs/type-aliases/TFunc.md +1 -1
  228. package/docs/variables/AIChatRoles.md +1 -1
  229. package/docs/variables/AIMessageTypes.md +1 -1
  230. package/docs/variables/AITextGenerationFinishReasons.md +1 -1
  231. package/docs/variables/AbortErrorCode.md +1 -1
  232. package/docs/variables/ActionNames.md +1 -1
  233. package/docs/variables/AlreadyExistsErrorCode.md +1 -1
  234. package/docs/variables/ClientToolFuncSchema.md +1 -1
  235. package/docs/variables/DefaultAsyncSemaphoreCapacity.md +1 -1
  236. package/docs/variables/EventBusName.md +1 -1
  237. package/docs/variables/EventName.md +1 -1
  238. package/docs/variables/FilenameReservedRegex.md +1 -1
  239. package/docs/variables/HFBuiltins.md +1 -1
  240. package/docs/variables/InternalErrorCode.md +1 -1
  241. package/docs/variables/LLM_TOKENIZER_NAMES.md +83 -0
  242. package/docs/variables/LLM_TOKENIZER_NAMES_MAP.md +13 -0
  243. package/docs/variables/NotFoundErrorCode.md +1 -1
  244. package/docs/variables/NotImplementedErrorCode.md +1 -1
  245. package/docs/variables/PASSING_SCORE.md +1 -1
  246. package/docs/variables/PromptTemplateTypes.md +1 -1
  247. package/docs/variables/PromptTypes.md +1 -1
  248. package/docs/variables/RStreamErrCode.md +1 -1
  249. package/docs/variables/RemoteToolFuncSchema.md +1 -1
  250. package/docs/variables/ResponseRStreamErrCode.md +1 -1
  251. package/docs/variables/SSEChannelAlreadyClosedErrCode.md +1 -1
  252. package/docs/variables/ServerToolFuncSchema.md +1 -1
  253. package/docs/variables/ToolAsyncCancelableBit.md +1 -1
  254. package/docs/variables/ToolAsyncMultiTaskBit.md +1 -1
  255. package/docs/variables/ToolAsyncPriorityBit.md +1 -1
  256. package/docs/variables/ToolFuncSchema.md +1 -1
  257. package/docs/variables/WindowsReservedNameRegex.md +1 -1
  258. package/docs/variables/base32768.md +1 -1
  259. package/docs/variables/defaultTemplateFormat.md +1 -1
  260. package/docs/variables/event.md +1 -1
  261. package/docs/variables/eventClient.md +1 -1
  262. package/docs/variables/eventServer.md +1 -1
  263. package/docs/variables/lrucache.md +1 -1
  264. package/package.json +7 -3
  265. package/dist/chunk-FLVJ4R53.mjs +0 -1
  266. package/docs/enumerations/XXHashAlgorithm.md +0 -27
  267. /package/dist/{chunk-PXQPLL62.mjs → chunk-VIG2GB47.mjs} +0 -0
@@ -24,4 +24,4 @@
24
24
 
25
25
  ## Defined in
26
26
 
27
- [packages/ai-tool/src/utils/memoize.ts:14](https://github.com/isdk/ai-tool.js/blob/fe6b47f429fb128627d2210e367fa914b891d314/src/utils/memoize.ts#L14)
27
+ [packages/ai-tool/src/utils/memoize.ts:14](https://github.com/isdk/ai-tool.js/blob/b0813174e9b350ae47231f8e5f885150313123b0/src/utils/memoize.ts#L14)
@@ -18,4 +18,4 @@
18
18
 
19
19
  ## Defined in
20
20
 
21
- [packages/ai-tool/src/utils/chat.ts:118](https://github.com/isdk/ai-tool.js/blob/fe6b47f429fb128627d2210e367fa914b891d314/src/utils/chat.ts#L118)
21
+ [packages/ai-tool/src/utils/chat.ts:121](https://github.com/isdk/ai-tool.js/blob/b0813174e9b350ae47231f8e5f885150313123b0/src/utils/chat.ts#L121)
@@ -29,4 +29,4 @@ A string representing the formatted parameter size with the appropriate scale un
29
29
 
30
30
  ## Defined in
31
31
 
32
- [packages/ai-tool/src/utils/convert-params-size.ts:11](https://github.com/isdk/ai-tool.js/blob/fe6b47f429fb128627d2210e367fa914b891d314/src/utils/convert-params-size.ts#L11)
32
+ [packages/ai-tool/src/utils/convert-params-size.ts:11](https://github.com/isdk/ai-tool.js/blob/b0813174e9b350ae47231f8e5f885150313123b0/src/utils/convert-params-size.ts#L11)
@@ -6,7 +6,7 @@
6
6
 
7
7
  # Function: parseCommand()
8
8
 
9
- > **parseCommand**(`commandStr`, `scope`?, `options`?): `Promise`\<`object`\>
9
+ > **parseCommand**(`commandStr`, `scope`?, `options`?): `Promise`\<`object` \| `undefined`\>
10
10
 
11
11
  ## Parameters
12
12
 
@@ -18,16 +18,8 @@
18
18
 
19
19
  ## Returns
20
20
 
21
- `Promise`\<`object`\>
22
-
23
- ### args?
24
-
25
- > `optional` **args**: `Record`\<`string`, `any`\>
26
-
27
- ### command
28
-
29
- > **command**: `string`
21
+ `Promise`\<`object` \| `undefined`\>
30
22
 
31
23
  ## Defined in
32
24
 
33
- [packages/ai-tool/src/utils/parse-command.ts:377](https://github.com/isdk/ai-tool.js/blob/fe6b47f429fb128627d2210e367fa914b891d314/src/utils/parse-command.ts#L377)
25
+ [packages/ai-tool/src/utils/parse-command.ts:397](https://github.com/isdk/ai-tool.js/blob/b0813174e9b350ae47231f8e5f885150313123b0/src/utils/parse-command.ts#L397)
@@ -23,4 +23,4 @@ extract from langchain.js/langchain-core/src/prompts/template.ts
23
23
 
24
24
  ## Defined in
25
25
 
26
- [packages/ai-tool/src/utils/prompt/template/python.ts:16](https://github.com/isdk/ai-tool.js/blob/fe6b47f429fb128627d2210e367fa914b891d314/src/utils/prompt/template/python.ts#L16)
26
+ [packages/ai-tool/src/utils/prompt/template/python.ts:16](https://github.com/isdk/ai-tool.js/blob/b0813174e9b350ae47231f8e5f885150313123b0/src/utils/prompt/template/python.ts#L16)
@@ -6,7 +6,7 @@
6
6
 
7
7
  # Function: parseJsJson()
8
8
 
9
- > **parseJsJson**(`input`, `scope`?): `any`
9
+ > **parseJsJson**(`input`, `scope`?): `Promise`\<`any`\>
10
10
 
11
11
  Parses a JavaScript string into a JSON object.
12
12
 
@@ -20,7 +20,7 @@ The string to be parsed into JSON.
20
20
 
21
21
  ## Returns
22
22
 
23
- `any`
23
+ `Promise`\<`any`\>
24
24
 
25
25
  The parsed JSON object. If parsing fails, undefined is returned.
26
26
 
@@ -35,4 +35,4 @@ console.log(json); // { name: 'John' }
35
35
 
36
36
  ## Defined in
37
37
 
38
- [packages/ai-tool/src/utils/parse-js-json.ts:15](https://github.com/isdk/ai-tool.js/blob/fe6b47f429fb128627d2210e367fa914b891d314/src/utils/parse-js-json.ts#L15)
38
+ [packages/ai-tool/src/utils/parse-js-json.ts:16](https://github.com/isdk/ai-tool.js/blob/b0813174e9b350ae47231f8e5f885150313123b0/src/utils/parse-js-json.ts#L16)
@@ -0,0 +1,23 @@
1
+ [**@isdk/ai-tool**](../README.md) • **Docs**
2
+
3
+ ***
4
+
5
+ [@isdk/ai-tool](../globals.md) / parseJsJsonSimpleSync
6
+
7
+ # Function: parseJsJsonSimpleSync()
8
+
9
+ > **parseJsJsonSimpleSync**(`input`, `scope`?): `any`
10
+
11
+ ## Parameters
12
+
13
+ • **input**: `string`
14
+
15
+ • **scope?**: `Record`\<`string`, `any`\>
16
+
17
+ ## Returns
18
+
19
+ `any`
20
+
21
+ ## Defined in
22
+
23
+ [packages/ai-tool/src/utils/parse-js-json.ts:28](https://github.com/isdk/ai-tool.js/blob/b0813174e9b350ae47231f8e5f885150313123b0/src/utils/parse-js-json.ts#L28)
@@ -24,4 +24,4 @@
24
24
 
25
25
  ## Defined in
26
26
 
27
- [packages/ai-tool/src/utils/parse-command.ts:226](https://github.com/isdk/ai-tool.js/blob/fe6b47f429fb128627d2210e367fa914b891d314/src/utils/parse-command.ts#L226)
27
+ [packages/ai-tool/src/utils/parse-command.ts:255](https://github.com/isdk/ai-tool.js/blob/b0813174e9b350ae47231f8e5f885150313123b0/src/utils/parse-command.ts#L255)
@@ -22,4 +22,4 @@
22
22
 
23
23
  ## Defined in
24
24
 
25
- [packages/ai-tool/src/utils/parse-command.ts:88](https://github.com/isdk/ai-tool.js/blob/fe6b47f429fb128627d2210e367fa914b891d314/src/utils/parse-command.ts#L88)
25
+ [packages/ai-tool/src/utils/parse-command.ts:93](https://github.com/isdk/ai-tool.js/blob/b0813174e9b350ae47231f8e5f885150313123b0/src/utils/parse-command.ts#L93)
@@ -65,4 +65,4 @@ console.log(arrayResult); // Output: [1, 2, 3]
65
65
 
66
66
  ## Defined in
67
67
 
68
- [packages/ai-tool/src/utils/parse-command.ts:66](https://github.com/isdk/ai-tool.js/blob/fe6b47f429fb128627d2210e367fa914b891d314/src/utils/parse-command.ts#L66)
68
+ [packages/ai-tool/src/utils/parse-command.ts:71](https://github.com/isdk/ai-tool.js/blob/b0813174e9b350ae47231f8e5f885150313123b0/src/utils/parse-command.ts#L71)
@@ -39,4 +39,4 @@ An array of parsed argument information, where each item contains a boolean indi
39
39
 
40
40
  ## Defined in
41
41
 
42
- [packages/ai-tool/src/utils/parse-command.ts:285](https://github.com/isdk/ai-tool.js/blob/fe6b47f429fb128627d2210e367fa914b891d314/src/utils/parse-command.ts#L285)
42
+ [packages/ai-tool/src/utils/parse-command.ts:304](https://github.com/isdk/ai-tool.js/blob/b0813174e9b350ae47231f8e5f885150313123b0/src/utils/parse-command.ts#L304)
@@ -18,4 +18,4 @@
18
18
 
19
19
  ## Defined in
20
20
 
21
- [packages/ai-tool/src/utils/config.ts:24](https://github.com/isdk/ai-tool.js/blob/fe6b47f429fb128627d2210e367fa914b891d314/src/utils/config.ts#L24)
21
+ [packages/ai-tool/src/utils/config.ts:24](https://github.com/isdk/ai-tool.js/blob/b0813174e9b350ae47231f8e5f885150313123b0/src/utils/config.ts#L24)
@@ -18,4 +18,4 @@
18
18
 
19
19
  ## Defined in
20
20
 
21
- [packages/ai-tool/src/utils/parse-command.ts:200](https://github.com/isdk/ai-tool.js/blob/fe6b47f429fb128627d2210e367fa914b891d314/src/utils/parse-command.ts#L200)
21
+ [packages/ai-tool/src/utils/parse-command.ts:205](https://github.com/isdk/ai-tool.js/blob/b0813174e9b350ae47231f8e5f885150313123b0/src/utils/parse-command.ts#L205)
@@ -18,4 +18,4 @@ A compiled regular expression for control characters in a filename.
18
18
 
19
19
  ## Defined in
20
20
 
21
- [packages/ai-tool/src/utils/filename.ts:50](https://github.com/isdk/ai-tool.js/blob/fe6b47f429fb128627d2210e367fa914b891d314/src/utils/filename.ts#L50)
21
+ [packages/ai-tool/src/utils/filename.ts:50](https://github.com/isdk/ai-tool.js/blob/b0813174e9b350ae47231f8e5f885150313123b0/src/utils/filename.ts#L50)
@@ -44,4 +44,4 @@ console.log(files); // Outputs an array of JavaScript file paths.
44
44
 
45
45
  ## Defined in
46
46
 
47
- [packages/ai-tool/src/utils/load-file-from-paths.ts:123](https://github.com/isdk/ai-tool.js/blob/fe6b47f429fb128627d2210e367fa914b891d314/src/utils/load-file-from-paths.ts#L123)
47
+ [packages/ai-tool/src/utils/load-file-from-paths.ts:136](https://github.com/isdk/ai-tool.js/blob/b0813174e9b350ae47231f8e5f885150313123b0/src/utils/load-file-from-paths.ts#L136)
@@ -0,0 +1,51 @@
1
+ [**@isdk/ai-tool**](../README.md) • **Docs**
2
+
3
+ ***
4
+
5
+ [@isdk/ai-tool](../globals.md) / readTextFileChunks
6
+
7
+ # Function: readTextFileChunks()
8
+
9
+ > **readTextFileChunks**(`filePath`, `options`?): `AsyncIterable`\<`string`\>
10
+
11
+ Reads a text file and yields chunks of text that are within a specified token limit.
12
+ This function supports both small files that can be read entirely into memory,
13
+ and large files that require streaming.
14
+
15
+ Note: The specified `size` must not be less than the token count of the longest sentence.
16
+ If the `size` is less than the token count of the longest sentence, some sentences may not
17
+ fit completely into a single chunk.
18
+ Without completeSentence and corrected Only!
19
+
20
+ ## Parameters
21
+
22
+ • **filePath**: `string`
23
+
24
+ The path to the text file to be read.
25
+
26
+ • **options?**: [`IReadTextFileChunksOptions`](../interfaces/IReadTextFileChunksOptions.md)
27
+
28
+ optional Options for reading the file.
29
+
30
+ ## Returns
31
+
32
+ `AsyncIterable`\<`string`\>
33
+
34
+ ## Example
35
+
36
+ ```typescript
37
+ const filePath = 'path/to/file.txt';
38
+ const options = {
39
+ size: 2048,
40
+ modelId: 'gpt-3.5',
41
+ metaInfo: { size: 10240 }
42
+ };
43
+
44
+ for await (const chunk of readTextFileChunks(filePath, options)) {
45
+ console.log('Chunk:', chunk);
46
+ }
47
+ ```
48
+
49
+ ## Defined in
50
+
51
+ [packages/ai-tool/src/utils/read-text-file-chunks.ts:41](https://github.com/isdk/ai-tool.js/blob/b0813174e9b350ae47231f8e5f885150313123b0/src/utils/read-text-file-chunks.ts#L41)
@@ -0,0 +1,23 @@
1
+ [**@isdk/ai-tool**](../README.md) • **Docs**
2
+
3
+ ***
4
+
5
+ [@isdk/ai-tool](../globals.md) / readTextFileChunksEx
6
+
7
+ # Function: readTextFileChunksEx()
8
+
9
+ > **readTextFileChunksEx**(`filePath`, `options`?): `AsyncIterable`\<`string`[]\>
10
+
11
+ ## Parameters
12
+
13
+ • **filePath**: `string`
14
+
15
+ • **options?**: [`IReadTextFileChunksOptions`](../interfaces/IReadTextFileChunksOptions.md)
16
+
17
+ ## Returns
18
+
19
+ `AsyncIterable`\<`string`[]\>
20
+
21
+ ## Defined in
22
+
23
+ [packages/ai-tool/src/utils/read-text-file-chunks.ts:109](https://github.com/isdk/ai-tool.js/blob/b0813174e9b350ae47231f8e5f885150313123b0/src/utils/read-text-file-chunks.ts#L109)
@@ -25,4 +25,4 @@ https://github.com/whatwg/streams/commit/8d7a0bf26eb2cc23e884ddbaac7c1da4b91cf2b
25
25
 
26
26
  ## Defined in
27
27
 
28
- [packages/ai-tool/src/utils/stream/ai-stream.ts:166](https://github.com/isdk/ai-tool.js/blob/fe6b47f429fb128627d2210e367fa914b891d314/src/utils/stream/ai-stream.ts#L166)
28
+ [packages/ai-tool/src/utils/stream/ai-stream.ts:166](https://github.com/isdk/ai-tool.js/blob/b0813174e9b350ae47231f8e5f885150313123b0/src/utils/stream/ai-stream.ts#L166)
@@ -14,4 +14,4 @@
14
14
 
15
15
  ## Defined in
16
16
 
17
- [packages/ai-tool/src/funcs/index.ts:9](https://github.com/isdk/ai-tool.js/blob/fe6b47f429fb128627d2210e367fa914b891d314/src/funcs/index.ts#L9)
17
+ [packages/ai-tool/src/funcs/index.ts:9](https://github.com/isdk/ai-tool.js/blob/b0813174e9b350ae47231f8e5f885150313123b0/src/funcs/index.ts#L9)
@@ -18,4 +18,4 @@
18
18
 
19
19
  ## Defined in
20
20
 
21
- [packages/ai-tool/src/utils/config.ts:14](https://github.com/isdk/ai-tool.js/blob/fe6b47f429fb128627d2210e367fa914b891d314/src/utils/config.ts#L14)
21
+ [packages/ai-tool/src/utils/config.ts:14](https://github.com/isdk/ai-tool.js/blob/b0813174e9b350ae47231f8e5f885150313123b0/src/utils/config.ts#L14)
@@ -0,0 +1,23 @@
1
+ [**@isdk/ai-tool**](../README.md) • **Docs**
2
+
3
+ ***
4
+
5
+ [@isdk/ai-tool](../globals.md) / removeMarkdownBold
6
+
7
+ # Function: removeMarkdownBold()
8
+
9
+ > **removeMarkdownBold**(`s`, `once`?): `string`
10
+
11
+ ## Parameters
12
+
13
+ • **s**: `string`
14
+
15
+ • **once?**: `boolean`
16
+
17
+ ## Returns
18
+
19
+ `string`
20
+
21
+ ## Defined in
22
+
23
+ [packages/ai-tool/src/utils/split-sentence.ts:292](https://github.com/isdk/ai-tool.js/blob/b0813174e9b350ae47231f8e5f885150313123b0/src/utils/split-sentence.ts#L292)
@@ -0,0 +1,23 @@
1
+ [**@isdk/ai-tool**](../README.md) • **Docs**
2
+
3
+ ***
4
+
5
+ [@isdk/ai-tool](../globals.md) / removeMarkdownBoldAndItalic
6
+
7
+ # Function: removeMarkdownBoldAndItalic()
8
+
9
+ > **removeMarkdownBoldAndItalic**(`s`, `once`?): `string`
10
+
11
+ ## Parameters
12
+
13
+ • **s**: `string`
14
+
15
+ • **once?**: `boolean`
16
+
17
+ ## Returns
18
+
19
+ `string`
20
+
21
+ ## Defined in
22
+
23
+ [packages/ai-tool/src/utils/split-sentence.ts:312](https://github.com/isdk/ai-tool.js/blob/b0813174e9b350ae47231f8e5f885150313123b0/src/utils/split-sentence.ts#L312)
@@ -0,0 +1,23 @@
1
+ [**@isdk/ai-tool**](../README.md) • **Docs**
2
+
3
+ ***
4
+
5
+ [@isdk/ai-tool](../globals.md) / removeMarkdownItalic
6
+
7
+ # Function: removeMarkdownItalic()
8
+
9
+ > **removeMarkdownItalic**(`s`, `once`?): `string`
10
+
11
+ ## Parameters
12
+
13
+ • **s**: `string`
14
+
15
+ • **once?**: `boolean`
16
+
17
+ ## Returns
18
+
19
+ `string`
20
+
21
+ ## Defined in
22
+
23
+ [packages/ai-tool/src/utils/split-sentence.ts:302](https://github.com/isdk/ai-tool.js/blob/b0813174e9b350ae47231f8e5f885150313123b0/src/utils/split-sentence.ts#L302)
@@ -0,0 +1,41 @@
1
+ [**@isdk/ai-tool**](../README.md) • **Docs**
2
+
3
+ ***
4
+
5
+ [@isdk/ai-tool](../globals.md) / replaceWithPlaceholder
6
+
7
+ # Function: replaceWithPlaceholder()
8
+
9
+ > **replaceWithPlaceholder**(`content`, `options`?): [`string`, `string`[]]
10
+
11
+ Replaces substrings in the given content with placeholders.
12
+
13
+ ## Parameters
14
+
15
+ • **content**: `string`
16
+
17
+ The string content to process.
18
+
19
+ • **options?**: [`ReplacePlacehoderOptions`](../interfaces/ReplacePlacehoderOptions.md)
20
+
21
+ Optional configuration object with the following properties:
22
+ - `startChar` - The starting character(s) of the substrings to replace. Can be a single character or an array of characters. Defaults to `["\"", "'"]`.
23
+ - `endChar` - The ending character(s) of the substrings to replace. Can be a single character or an array of characters. Defaults to the value of `startChar`.
24
+ - `placeholder` - The prefix for the placeholder names. Defaults to `defaultPlaceholderName`.
25
+ - `placehoders` - An array of placeholders to use instead of generating new one.
26
+
27
+ ## Returns
28
+
29
+ [`string`, `string`[]]
30
+
31
+ An array containing:
32
+ - `content` - The modified content with placeholders.
33
+ - `placehoders` - An array of the original substrings that were replaced.
34
+
35
+ ## Throws
36
+
37
+ If the lengths of `startChar` and `endChar` are not the same.
38
+
39
+ ## Defined in
40
+
41
+ [packages/ai-tool/src/utils/parse-command.ts:438](https://github.com/isdk/ai-tool.js/blob/b0813174e9b350ae47231f8e5f885150313123b0/src/utils/parse-command.ts#L438)
@@ -0,0 +1,45 @@
1
+ [**@isdk/ai-tool**](../README.md) • **Docs**
2
+
3
+ ***
4
+
5
+ [@isdk/ai-tool](../globals.md) / restoreFromPlacehoders
6
+
7
+ # Function: restoreFromPlacehoders()
8
+
9
+ > **restoreFromPlacehoders**(`content`, `placehoders`, `options`?): `string`
10
+
11
+ Restores the original substrings from placeholders in the given content.
12
+
13
+ ## Parameters
14
+
15
+ • **content**: `string`
16
+
17
+ The string content containing placeholders to be restored.
18
+
19
+ • **placehoders**: `string`[]
20
+
21
+ An array of the original substrings that were replaced by placeholders.
22
+
23
+ • **options?**: [`ReplacePlacehoderOptions`](../interfaces/ReplacePlacehoderOptions.md)
24
+
25
+ Optional configuration object with the following properties:
26
+ - `placeholder` - The prefix for the placeholder names. Defaults to `__PlacEhoLdeR_`.
27
+
28
+ ## Returns
29
+
30
+ `string`
31
+
32
+ The modified content with the original substrings restored.
33
+
34
+ ## Example
35
+
36
+ ```typescript
37
+ const contentWithPlaceholders = "Hello __PlacEhoLdeR_0, welcome to __PlacEhoLdeR_1!";
38
+ const originalSubstrings = ["World", "the site"];
39
+ const restoredContent = restoreFromPlacehoders(contentWithPlaceholders, originalSubstrings);
40
+ console.log(restoredContent); // Output: "Hello World, welcome to the site!"
41
+ ```
42
+
43
+ ## Defined in
44
+
45
+ [packages/ai-tool/src/utils/parse-command.ts:491](https://github.com/isdk/ai-tool.js/blob/b0813174e9b350ae47231f8e5f885150313123b0/src/utils/parse-command.ts#L491)
@@ -34,4 +34,4 @@ The sanitized filename.
34
34
 
35
35
  ## Defined in
36
36
 
37
- [packages/ai-tool/src/utils/filename.ts:97](https://github.com/isdk/ai-tool.js/blob/fe6b47f429fb128627d2210e367fa914b891d314/src/utils/filename.ts#L97)
37
+ [packages/ai-tool/src/utils/filename.ts:97](https://github.com/isdk/ai-tool.js/blob/b0813174e9b350ae47231f8e5f885150313123b0/src/utils/filename.ts#L97)
@@ -28,4 +28,4 @@ The sanitized file path as a string.
28
28
 
29
29
  ## Defined in
30
30
 
31
- [packages/ai-tool/src/utils/filename.ts:149](https://github.com/isdk/ai-tool.js/blob/fe6b47f429fb128627d2210e367fa914b891d314/src/utils/filename.ts#L149)
31
+ [packages/ai-tool/src/utils/filename.ts:149](https://github.com/isdk/ai-tool.js/blob/b0813174e9b350ae47231f8e5f885150313123b0/src/utils/filename.ts#L149)
@@ -22,4 +22,4 @@
22
22
 
23
23
  ## Defined in
24
24
 
25
- [packages/ai-tool/src/utils/config.ts:88](https://github.com/isdk/ai-tool.js/blob/fe6b47f429fb128627d2210e367fa914b891d314/src/utils/config.ts#L88)
25
+ [packages/ai-tool/src/utils/config.ts:88](https://github.com/isdk/ai-tool.js/blob/b0813174e9b350ae47231f8e5f885150313123b0/src/utils/config.ts#L88)
@@ -24,4 +24,4 @@ The parameter size in bytes.
24
24
 
25
25
  ## Defined in
26
26
 
27
- [packages/ai-tool/src/utils/convert-params-size.ts:44](https://github.com/isdk/ai-tool.js/blob/fe6b47f429fb128627d2210e367fa914b891d314/src/utils/convert-params-size.ts#L44)
27
+ [packages/ai-tool/src/utils/convert-params-size.ts:44](https://github.com/isdk/ai-tool.js/blob/b0813174e9b350ae47231f8e5f885150313123b0/src/utils/convert-params-size.ts#L44)
@@ -18,4 +18,4 @@
18
18
 
19
19
  ## Defined in
20
20
 
21
- [packages/ai-tool/src/utils/parse-command.ts:71](https://github.com/isdk/ai-tool.js/blob/fe6b47f429fb128627d2210e367fa914b891d314/src/utils/parse-command.ts#L71)
21
+ [packages/ai-tool/src/utils/parse-command.ts:76](https://github.com/isdk/ai-tool.js/blob/b0813174e9b350ae47231f8e5f885150313123b0/src/utils/parse-command.ts#L76)
@@ -22,4 +22,4 @@
22
22
 
23
23
  ## Defined in
24
24
 
25
- [packages/ai-tool/src/utils/prompt/few-shot-prompt-template.ts:4](https://github.com/isdk/ai-tool.js/blob/fe6b47f429fb128627d2210e367fa914b891d314/src/utils/prompt/few-shot-prompt-template.ts#L4)
25
+ [packages/ai-tool/src/utils/prompt/few-shot-prompt-template.ts:4](https://github.com/isdk/ai-tool.js/blob/b0813174e9b350ae47231f8e5f885150313123b0/src/utils/prompt/few-shot-prompt-template.ts#L4)
@@ -0,0 +1,23 @@
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/b0813174e9b350ae47231f8e5f885150313123b0/src/utils/read-text-file-chunks.ts#L182)
@@ -0,0 +1,32 @@
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/b0813174e9b350ae47231f8e5f885150313123b0/src/utils/split-paragraph.ts#L12)
@@ -17,7 +17,7 @@ This function is used to split a text into separate sentences, based on punctuat
17
17
 
18
18
  The input string that needs to be split into sentences.
19
19
 
20
- • **best**: `boolean` = `true`
20
+ • **best**: [`SplitSentenceOptions`](../interfaces/SplitSentenceOptions.md) = `{}`
21
21
 
22
22
  A boolean flag indicating if the function should use the best possible sentence splitting method (default is true).
23
23
  If set to false, it will not perform any additional processing and simply split on newline characters ('\n').
@@ -34,4 +34,4 @@ console.log(splitSentence(text)); // returns ['Hello world!', 'How are you toda
34
34
 
35
35
  ## Defined in
36
36
 
37
- [packages/ai-tool/src/utils/split-sentence.ts:29](https://github.com/isdk/ai-tool.js/blob/fe6b47f429fb128627d2210e367fa914b891d314/src/utils/split-sentence.ts#L29)
37
+ [packages/ai-tool/src/utils/split-sentence.ts:44](https://github.com/isdk/ai-tool.js/blob/b0813174e9b350ae47231f8e5f885150313123b0/src/utils/split-sentence.ts#L44)
@@ -18,4 +18,4 @@
18
18
 
19
19
  ## Defined in
20
20
 
21
- [packages/ai-tool/src/utils/config.ts:28](https://github.com/isdk/ai-tool.js/blob/fe6b47f429fb128627d2210e367fa914b891d314/src/utils/config.ts#L28)
21
+ [packages/ai-tool/src/utils/config.ts:28](https://github.com/isdk/ai-tool.js/blob/b0813174e9b350ae47231f8e5f885150313123b0/src/utils/config.ts#L28)
@@ -0,0 +1,21 @@
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/b0813174e9b350ae47231f8e5f885150313123b0/src/utils/strip-console-color.ts#L1)
@@ -20,4 +20,4 @@
20
20
 
21
21
  ## Defined in
22
22
 
23
- [packages/ai-tool/src/utils/to-datetime.ts:25](https://github.com/isdk/ai-tool.js/blob/fe6b47f429fb128627d2210e367fa914b891d314/src/utils/to-datetime.ts#L25)
23
+ [packages/ai-tool/src/utils/to-datetime.ts:25](https://github.com/isdk/ai-tool.js/blob/b0813174e9b350ae47231f8e5f885150313123b0/src/utils/to-datetime.ts#L25)
@@ -34,4 +34,4 @@ Throws a BaseError object
34
34
 
35
35
  ## Defined in
36
36
 
37
- node\_modules/.pnpm/@isdk+common-error@0.1.1/node\_modules/@isdk/common-error/dist/index.d.ts:149
37
+ node\_modules/.pnpm/@isdk+common-error@0.1.3/node\_modules/@isdk/common-error/dist/index.d.ts:161
@@ -18,4 +18,4 @@
18
18
 
19
19
  ## Defined in
20
20
 
21
- [packages/ai-tool/src/utils/to-datetime.ts:9](https://github.com/isdk/ai-tool.js/blob/fe6b47f429fb128627d2210e367fa914b891d314/src/utils/to-datetime.ts#L9)
21
+ [packages/ai-tool/src/utils/to-datetime.ts:9](https://github.com/isdk/ai-tool.js/blob/b0813174e9b350ae47231f8e5f885150313123b0/src/utils/to-datetime.ts#L9)
@@ -38,4 +38,4 @@ const output2 = trimStart(" text"); // " text"
38
38
 
39
39
  ## Defined in
40
40
 
41
- [packages/ai-tool/src/utils/stream/ai-stream.ts:92](https://github.com/isdk/ai-tool.js/blob/fe6b47f429fb128627d2210e367fa914b891d314/src/utils/stream/ai-stream.ts#L92)
41
+ [packages/ai-tool/src/utils/stream/ai-stream.ts:92](https://github.com/isdk/ai-tool.js/blob/b0813174e9b350ae47231f8e5f885150313123b0/src/utils/stream/ai-stream.ts#L92)
@@ -44,4 +44,4 @@ truncTo(1.2345, 2, 0.6)
44
44
 
45
45
  ## Defined in
46
46
 
47
- [packages/ai-tool/src/utils/trunc-to.ts:19](https://github.com/isdk/ai-tool.js/blob/fe6b47f429fb128627d2210e367fa914b891d314/src/utils/trunc-to.ts#L19)
47
+ [packages/ai-tool/src/utils/trunc-to.ts:19](https://github.com/isdk/ai-tool.js/blob/b0813174e9b350ae47231f8e5f885150313123b0/src/utils/trunc-to.ts#L19)
@@ -0,0 +1,23 @@
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/b0813174e9b350ae47231f8e5f885150313123b0/src/utils/truncate-to-token-limit.ts#L164)