@isdk/ai-tool 0.2.0 → 0.2.1
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-TOUPOZHH.mjs +1 -0
- package/dist/funcs.d.mts +1 -1
- package/dist/funcs.d.ts +1 -1
- package/dist/funcs.js +1 -1
- package/dist/funcs.mjs +1 -1
- package/dist/{index-nP9lSU6E.d.mts → index-DUEs7T8M.d.mts} +2 -2
- package/dist/{index-nP9lSU6E.d.ts → index-DUEs7T8M.d.ts} +2 -2
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/docs/README.md +5 -3
- package/docs/_media/CONTRIBUTING.md +18 -0
- package/docs/_media/LICENSE-MIT +22 -0
- package/docs/classes/AbortError.md +108 -129
- package/docs/classes/AlreadyExistsError.md +105 -126
- package/docs/classes/BaseError.md +112 -125
- package/docs/classes/CancelableAbility.md +136 -188
- package/docs/classes/ClientTools.md +1005 -1107
- package/docs/classes/CommonError.md +115 -136
- package/docs/classes/ConfigFile.md +150 -163
- package/docs/classes/EventClient.md +1128 -1282
- package/docs/classes/EventServer.md +1165 -1303
- package/docs/classes/EventToolFunc.md +958 -1028
- package/docs/classes/FStringPromptTemplate.md +352 -438
- package/docs/classes/FewShotPromptTemplate.md +364 -464
- package/docs/classes/GolangPromptTemplate.md +352 -438
- package/docs/classes/HFEnvironment.md +53 -79
- package/docs/classes/HFInterpreter.md +20 -377
- package/docs/classes/HFTemplate.md +21 -33
- package/docs/classes/HfPromptTemplate.md +352 -438
- package/docs/classes/IntSet.md +67 -100
- package/docs/classes/NotFoundError.md +105 -126
- package/docs/classes/NotImplementationError.md +105 -126
- package/docs/classes/PromptExampleSelector.md +58 -70
- package/docs/classes/PromptTemplate.md +338 -422
- package/docs/classes/ReadableStreamError.md +108 -129
- package/docs/classes/ResClientTools.md +916 -1026
- package/docs/classes/ResServerTools.md +919 -1026
- package/docs/classes/SSEChannel.md +93 -112
- package/docs/classes/Semaphore.md +44 -140
- package/docs/classes/ServerTools.md +981 -1072
- package/docs/classes/TaskAbortController.md +46 -66
- package/docs/classes/ToolFunc.md +840 -910
- package/docs/enumerations/AsyncFeatureBits.md +37 -0
- package/docs/enumerations/AsyncFeatures.md +37 -0
- package/docs/enumerations/ErrorCode.md +217 -0
- package/docs/enumerations/XXHashAlgorithm.md +27 -0
- package/docs/functions/AIArgProcessor.md +27 -0
- package/docs/functions/AIStream.md +50 -0
- package/docs/functions/ChoiceArgProcessor.md +27 -0
- package/docs/functions/RateLimit.md +33 -0
- package/docs/functions/TemplateArgProcessor.md +27 -0
- package/docs/functions/backendEventable.md +23 -0
- package/docs/functions/canonicalize.md +21 -0
- package/docs/functions/countRegexMatches.md +33 -0
- package/docs/functions/createAbilityInjector.md +87 -0
- package/docs/functions/createCallbacksTransformer.md +49 -0
- package/docs/functions/createEmptyReadableStream.md +23 -0
- package/docs/functions/createEndWithRepetitionDetector.md +29 -0
- package/docs/functions/createError.md +35 -0
- package/docs/functions/createEventStreamTransformer.md +33 -0
- package/docs/functions/createHfValueFunc.md +29 -0
- package/docs/functions/createLRUCache.md +23 -0
- package/docs/functions/dateToText.md +23 -0
- package/docs/functions/expandEnv.md +40 -0
- package/docs/functions/expandObjEnv.md +54 -0
- package/docs/functions/extNameLevel.md +43 -0
- package/docs/functions/fileIsExists.md +34 -0
- package/docs/functions/filenameReservedRegex.md +22 -0
- package/docs/functions/filterValidFnScope.md +21 -0
- package/docs/functions/findPort.md +23 -0
- package/docs/functions/formatISO.md +71 -0
- package/docs/functions/getAllEnumKeys.md +31 -0
- package/docs/functions/getConfigFileNames.md +23 -0
- package/docs/functions/getConfigs.md +23 -0
- package/docs/functions/getKeysPath.md +38 -0
- package/docs/functions/getMultiLevelExtname.md +31 -0
- package/docs/functions/getPackageDir.md +39 -0
- package/docs/functions/getRealFilepath.md +34 -0
- package/docs/functions/getResponseErrorReadableStream.md +21 -0
- package/docs/functions/hfParse.md +24 -0
- package/docs/functions/hfTokenize.md +25 -0
- package/docs/functions/interpolateEnv.md +25 -0
- package/docs/functions/interpolateFString.md +27 -0
- package/docs/functions/interpolateGolangTemplate.md +31 -0
- package/docs/functions/isModelNameMatched.md +45 -0
- package/docs/functions/isValidFilename.md +38 -0
- package/docs/functions/isValidFilepath.md +27 -0
- package/docs/functions/isWebStream.md +21 -0
- package/docs/functions/jsonFilterToWhere.md +45 -0
- package/docs/functions/jsonToMarkdownStr.md +31 -0
- package/docs/functions/loadFileFromPaths.md +54 -0
- package/docs/functions/loadTextFromPaths.md +29 -0
- package/docs/functions/lrucache.md +29 -0
- package/docs/functions/makeToolFuncCancelable.md +23 -0
- package/docs/functions/matchUrlProtocol.md +48 -0
- package/docs/functions/memoize.md +27 -0
- package/docs/functions/messagesToText.md +21 -0
- package/docs/functions/paramsSizeToScaleStr.md +32 -0
- package/docs/functions/parseCommand.md +33 -0
- package/docs/functions/parseDateFormat.md +360 -0
- package/docs/functions/parseFString.md +26 -0
- package/docs/functions/parseISO.md +72 -0
- package/docs/functions/parseJsJson.md +38 -0
- package/docs/functions/parseObjectArgInfo.md +27 -0
- package/docs/functions/parseObjectArgumentInfos.md +25 -0
- package/docs/functions/parseObjectArguments.md +68 -0
- package/docs/functions/parseObjectArgumentsAsArgInfos.md +42 -0
- package/docs/functions/parseYaml.md +21 -0
- package/docs/functions/quoteStr.md +21 -0
- package/docs/functions/reControlCharsRegex.md +21 -0
- package/docs/functions/readFilenamesRecursiveSync.md +47 -0
- package/docs/functions/readableFromAsyncIterable.md +28 -0
- package/docs/functions/registerCoreTools.md +17 -0
- package/docs/functions/registerYamlTag.md +21 -0
- package/docs/functions/sanitizeFilename.md +37 -0
- package/docs/functions/sanitizeFilepath.md +31 -0
- package/docs/functions/saveConfigFile.md +25 -0
- package/docs/functions/scaleStrToParamsSize.md +27 -0
- package/docs/functions/simplifyObjectArguments.md +21 -0
- package/docs/functions/sortedValues.md +25 -0
- package/docs/functions/splitSentence.md +37 -0
- package/docs/functions/stringifyYaml.md +49 -0
- package/docs/functions/textToDate.md +23 -0
- package/docs/functions/throwError.md +37 -0
- package/docs/functions/toDate.md +76 -0
- package/docs/functions/toDateTime.md +21 -0
- package/docs/functions/trimStartOfStreamHelper.md +41 -0
- package/docs/functions/truncTo.md +47 -0
- package/docs/functions/uuid.md +23 -0
- package/docs/functions/uuidParse.md +21 -0
- package/docs/functions/uuidStringify.md +23 -0
- package/docs/functions/uuidValidate.md +21 -0
- package/docs/functions/uuidVersion.md +21 -0
- package/docs/functions/uuidv1.md +47 -0
- package/docs/functions/uuidv4.md +47 -0
- package/docs/functions/uuidv5.md +51 -0
- package/docs/functions/wait.md +21 -0
- package/docs/functions/xxhash.md +25 -0
- package/docs/functions/xxhash32.md +23 -0
- package/docs/functions/xxhash64.md +23 -0
- package/docs/functions/xxhashAsStr.md +25 -0
- package/docs/globals.md +236 -0
- package/docs/interfaces/AIChatAssistantMessageParam.md +29 -38
- package/docs/interfaces/AIChatContentPartImage.md +11 -16
- package/docs/interfaces/AIChatContentPartText.md +9 -12
- package/docs/interfaces/AIChatMessageParamBase.md +12 -19
- package/docs/interfaces/AIChatMessageToolCall.md +18 -21
- package/docs/interfaces/AIChatSystemMessageParam.md +16 -22
- package/docs/interfaces/AIChatToolMessageParam.md +19 -26
- package/docs/interfaces/AIChatUserMessageParam.md +32 -42
- package/docs/interfaces/AIChoiceConfig.md +31 -39
- package/docs/interfaces/AIResult.md +26 -33
- package/docs/interfaces/AIStreamParser.md +24 -18
- package/docs/interfaces/AIStreamParserOptions.md +8 -10
- package/docs/interfaces/BaseFunc.md +55 -75
- package/docs/interfaces/BaseFuncItem.md +43 -61
- package/docs/interfaces/CancelableAbilityOptions.md +43 -54
- package/docs/interfaces/ClientFuncItem.md +66 -83
- package/docs/interfaces/DotenvExpandOptions.md +15 -19
- package/docs/interfaces/DotenvExpandOutput.md +11 -14
- package/docs/interfaces/DotenvParseInput.md +6 -2
- package/docs/interfaces/DotenvParseOutput.md +6 -2
- package/docs/interfaces/DotenvPopulateInput.md +6 -2
- package/docs/interfaces/EventClientFuncParams.md +22 -33
- package/docs/interfaces/EventServerFuncParams.md +27 -35
- package/docs/interfaces/FewShotPromptTemplateOptions.md +58 -74
- package/docs/interfaces/FuncItem.md +53 -70
- package/docs/interfaces/FuncParam.md +29 -36
- package/docs/interfaces/FuncParams.md +6 -2
- package/docs/interfaces/Funcs.md +6 -2
- package/docs/interfaces/JsonFilter.md +6 -2
- package/docs/interfaces/ParseObjectArgumentOptions.md +23 -29
- package/docs/interfaces/PromptExampleSelectorOptions.md +13 -16
- package/docs/interfaces/PromptTemplateOptions.md +31 -40
- package/docs/interfaces/RemoteFuncItem.md +64 -82
- package/docs/interfaces/ResClientFuncParams.md +14 -19
- package/docs/interfaces/ResServerFuncParams.md +28 -36
- package/docs/interfaces/SanitizeFilenameOptions.md +11 -14
- package/docs/interfaces/ServerFuncItem.md +70 -88
- package/docs/interfaces/ServerFuncParams.md +15 -20
- package/docs/interfaces/StreamCallbacksAndOptions.md +36 -65
- package/docs/interfaces/TaskAbortControllers.md +6 -2
- package/docs/interfaces/TaskPromise.md +48 -61
- package/docs/interfaces/ToolFuncPackage.md +18 -32
- package/docs/type-aliases/AIChatContentPart.md +13 -0
- package/docs/type-aliases/AIChatMessageParam.md +13 -0
- package/docs/type-aliases/AIChatRole.md +13 -0
- package/docs/type-aliases/AIMessageType.md +13 -0
- package/docs/type-aliases/AIModelNameRule.md +13 -0
- package/docs/type-aliases/AIModelNameRuleFn.md +21 -0
- package/docs/type-aliases/AIModelNameRules.md +13 -0
- package/docs/type-aliases/AITextGenerationFinishReason.md +13 -0
- package/docs/type-aliases/ActionName.md +13 -0
- package/docs/type-aliases/AsyncTaskId.md +13 -0
- package/docs/type-aliases/EventErrorListenerFn.md +27 -0
- package/docs/type-aliases/EventListenerFn.md +25 -0
- package/docs/type-aliases/FStringPromptTemplateNode.md +16 -0
- package/docs/type-aliases/FuncParamType.md +13 -0
- package/docs/type-aliases/PromptExamples.md +17 -0
- package/docs/type-aliases/PromptTemplateType.md +13 -0
- package/docs/type-aliases/PromptType.md +13 -0
- package/docs/type-aliases/TFunc.md +23 -0
- package/docs/variables/AIChatRoles.md +13 -0
- package/docs/variables/AIMessageTypes.md +13 -0
- package/docs/variables/AITextGenerationFinishReasons.md +13 -0
- package/docs/variables/AbortErrorCode.md +13 -0
- package/docs/variables/ActionNames.md +13 -0
- package/docs/variables/AlreadyExistsErrorCode.md +13 -0
- package/docs/variables/ClientToolFuncSchema.md +87 -0
- package/docs/variables/DefaultAsyncSemaphoreCapacity.md +13 -0
- package/docs/variables/EventBusName.md +13 -0
- package/docs/variables/EventName.md +13 -0
- package/docs/variables/FilenameReservedRegex.md +16 -0
- package/docs/variables/HFBuiltins.md +92 -0
- package/docs/variables/InternalErrorCode.md +13 -0
- package/docs/variables/NotFoundErrorCode.md +13 -0
- package/docs/variables/NotImplementedErrorCode.md +13 -0
- package/docs/variables/PASSING_SCORE.md +13 -0
- package/docs/variables/PromptTemplateTypes.md +13 -0
- package/docs/variables/PromptTypes.md +16 -0
- package/docs/variables/RStreamErrCode.md +13 -0
- package/docs/variables/RemoteToolFuncSchema.md +87 -0
- package/docs/variables/ResponseRStreamErrCode.md +13 -0
- package/docs/variables/SSEChannelAlreadyClosedErrCode.md +13 -0
- package/docs/variables/ServerToolFuncSchema.md +87 -0
- package/docs/variables/ToolAsyncCancelableBit.md +13 -0
- package/docs/variables/ToolAsyncMultiTaskBit.md +13 -0
- package/docs/variables/ToolAsyncPriorityBit.md +13 -0
- package/docs/variables/ToolFuncSchema.md +125 -0
- package/docs/variables/WindowsReservedNameRegex.md +15 -0
- package/docs/variables/base32768.md +13 -0
- package/docs/variables/defaultTemplateFormat.md +13 -0
- package/docs/variables/event.md +13 -0
- package/docs/variables/eventClient.md +13 -0
- package/docs/variables/eventServer.md +13 -0
- package/docs/variables/lrucache.md +13 -0
- package/docs/variables/mimeType.md +13 -0
- package/docs/variables/uuidNIL.md +13 -0
- package/package.json +26 -27
- package/dist/chunk-W2LO3HZT.mjs +0 -1
- package/docs/.nojekyll +0 -1
- package/docs/enums/AsyncFeatureBits.md +0 -41
- package/docs/enums/AsyncFeatures.md +0 -41
- package/docs/enums/ErrorCode.md +0 -239
- package/docs/enums/XXHashAlgorithm.md +0 -30
- package/docs/modules.md +0 -4062
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
[**@isdk/ai-tool**](../README.md) • **Docs**
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/ai-tool](../globals.md) / AlreadyExistsErrorCode
|
|
6
|
+
|
|
7
|
+
# Variable: AlreadyExistsErrorCode
|
|
8
|
+
|
|
9
|
+
> `const` **AlreadyExistsErrorCode**: [`Conflict`](../enumerations/ErrorCode.md#conflict) = `ErrorCode.Conflict`
|
|
10
|
+
|
|
11
|
+
## Defined in
|
|
12
|
+
|
|
13
|
+
node\_modules/.pnpm/@isdk+common-error@0.1.1/node\_modules/@isdk/common-error/dist/index.d.ts:30
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
[**@isdk/ai-tool**](../README.md) • **Docs**
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/ai-tool](../globals.md) / ClientToolFuncSchema
|
|
6
|
+
|
|
7
|
+
# Variable: ClientToolFuncSchema
|
|
8
|
+
|
|
9
|
+
> `const` **ClientToolFuncSchema**: `object`
|
|
10
|
+
|
|
11
|
+
## Type declaration
|
|
12
|
+
|
|
13
|
+
### action
|
|
14
|
+
|
|
15
|
+
> **action**: `object`
|
|
16
|
+
|
|
17
|
+
### action.type
|
|
18
|
+
|
|
19
|
+
> **type**: `string` = `'string'`
|
|
20
|
+
|
|
21
|
+
### action.assign()
|
|
22
|
+
|
|
23
|
+
#### Parameters
|
|
24
|
+
|
|
25
|
+
• **value**: `"get"` \| `"post"` \| `"put"` \| `"delete"` \| `"patch"` \| `"list"` \| `"res"`
|
|
26
|
+
|
|
27
|
+
• **dest**: `any`
|
|
28
|
+
|
|
29
|
+
• **src?**: `any`
|
|
30
|
+
|
|
31
|
+
• **name?**: `string`
|
|
32
|
+
|
|
33
|
+
• **options?**: `any`
|
|
34
|
+
|
|
35
|
+
#### Returns
|
|
36
|
+
|
|
37
|
+
`"get"` \| `"post"` \| `"put"` \| `"delete"` \| `"patch"` \| `"list"` \| `"res"`
|
|
38
|
+
|
|
39
|
+
### allowExportFunc
|
|
40
|
+
|
|
41
|
+
> **allowExportFunc**: `object`
|
|
42
|
+
|
|
43
|
+
### allowExportFunc.type
|
|
44
|
+
|
|
45
|
+
> **type**: `string` = `'boolean'`
|
|
46
|
+
|
|
47
|
+
### apiRoot
|
|
48
|
+
|
|
49
|
+
> **apiRoot**: `object`
|
|
50
|
+
|
|
51
|
+
### apiRoot.type
|
|
52
|
+
|
|
53
|
+
> **type**: `string` = `'string'`
|
|
54
|
+
|
|
55
|
+
### apiRoot.get()
|
|
56
|
+
|
|
57
|
+
#### Parameters
|
|
58
|
+
|
|
59
|
+
• **this**: `any`
|
|
60
|
+
|
|
61
|
+
#### Returns
|
|
62
|
+
|
|
63
|
+
`any`
|
|
64
|
+
|
|
65
|
+
### apiRoot.set()
|
|
66
|
+
|
|
67
|
+
#### Parameters
|
|
68
|
+
|
|
69
|
+
• **this**: `any`
|
|
70
|
+
|
|
71
|
+
• **value**: `string`
|
|
72
|
+
|
|
73
|
+
#### Returns
|
|
74
|
+
|
|
75
|
+
`void`
|
|
76
|
+
|
|
77
|
+
### fetchOptions
|
|
78
|
+
|
|
79
|
+
> **fetchOptions**: `object`
|
|
80
|
+
|
|
81
|
+
### fetchOptions.type
|
|
82
|
+
|
|
83
|
+
> **type**: `string` = `'object'`
|
|
84
|
+
|
|
85
|
+
## Defined in
|
|
86
|
+
|
|
87
|
+
[packages/ai-tool/src/client-tools.ts:153](https://github.com/isdk/ai-tool.js/blob/5f9f0083c734722103ff5468e424b48c212a55f0/src/client-tools.ts#L153)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
[**@isdk/ai-tool**](../README.md) • **Docs**
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/ai-tool](../globals.md) / DefaultAsyncSemaphoreCapacity
|
|
6
|
+
|
|
7
|
+
# Variable: DefaultAsyncSemaphoreCapacity
|
|
8
|
+
|
|
9
|
+
> `const` **DefaultAsyncSemaphoreCapacity**: `32` = `32`
|
|
10
|
+
|
|
11
|
+
## Defined in
|
|
12
|
+
|
|
13
|
+
[packages/ai-tool/src/utils/async-semaphore.ts:6](https://github.com/isdk/ai-tool.js/blob/5f9f0083c734722103ff5468e424b48c212a55f0/src/utils/async-semaphore.ts#L6)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
[**@isdk/ai-tool**](../README.md) • **Docs**
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/ai-tool](../globals.md) / EventBusName
|
|
6
|
+
|
|
7
|
+
# Variable: EventBusName
|
|
8
|
+
|
|
9
|
+
> `const` **EventBusName**: `"event-bus"` = `'event-bus'`
|
|
10
|
+
|
|
11
|
+
## Defined in
|
|
12
|
+
|
|
13
|
+
[packages/ai-tool/src/utils/event/event-ability.ts:7](https://github.com/isdk/ai-tool.js/blob/5f9f0083c734722103ff5468e424b48c212a55f0/src/utils/event/event-ability.ts#L7)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
[**@isdk/ai-tool**](../README.md) • **Docs**
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/ai-tool](../globals.md) / EventName
|
|
6
|
+
|
|
7
|
+
# Variable: EventName
|
|
8
|
+
|
|
9
|
+
> `const` **EventName**: `"event"` = `'event'`
|
|
10
|
+
|
|
11
|
+
## Defined in
|
|
12
|
+
|
|
13
|
+
[packages/ai-tool/src/utils/event/event-ability.ts:6](https://github.com/isdk/ai-tool.js/blob/5f9f0083c734722103ff5468e424b48c212a55f0/src/utils/event/event-ability.ts#L6)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
[**@isdk/ai-tool**](../README.md) • **Docs**
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/ai-tool](../globals.md) / FilenameReservedRegex
|
|
6
|
+
|
|
7
|
+
# Variable: FilenameReservedRegex
|
|
8
|
+
|
|
9
|
+
> `const` **FilenameReservedRegex**: `RegExp`
|
|
10
|
+
|
|
11
|
+
Regular expression pattern for reserved characters in a filename.
|
|
12
|
+
do not use /g global option here: when the regex is executed multiple times, it will always begin where it left off last time.
|
|
13
|
+
|
|
14
|
+
## Defined in
|
|
15
|
+
|
|
16
|
+
[packages/ai-tool/src/utils/filename.ts:8](https://github.com/isdk/ai-tool.js/blob/5f9f0083c734722103ff5468e424b48c212a55f0/src/utils/filename.ts#L8)
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
[**@isdk/ai-tool**](../README.md) • **Docs**
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/ai-tool](../globals.md) / HFBuiltins
|
|
6
|
+
|
|
7
|
+
# Variable: HFBuiltins
|
|
8
|
+
|
|
9
|
+
> `const` **HFBuiltins**: `object`
|
|
10
|
+
|
|
11
|
+
## Type declaration
|
|
12
|
+
|
|
13
|
+
### randomInt()
|
|
14
|
+
|
|
15
|
+
> **randomInt**: (`to`, `from`) => `number`
|
|
16
|
+
|
|
17
|
+
#### Parameters
|
|
18
|
+
|
|
19
|
+
• **to**: `number`
|
|
20
|
+
|
|
21
|
+
• **from**: `number` = `0`
|
|
22
|
+
|
|
23
|
+
#### Returns
|
|
24
|
+
|
|
25
|
+
`number`
|
|
26
|
+
|
|
27
|
+
### select()
|
|
28
|
+
|
|
29
|
+
> **select**: (`obj`, `index`?) => `any`
|
|
30
|
+
|
|
31
|
+
Selects an element from the given object, array, or string.
|
|
32
|
+
|
|
33
|
+
#### Parameters
|
|
34
|
+
|
|
35
|
+
• **obj**: `any`
|
|
36
|
+
|
|
37
|
+
Can be an object, array, or string to select from.
|
|
38
|
+
|
|
39
|
+
• **index?**: `string` \| `number`
|
|
40
|
+
|
|
41
|
+
Optional, specifies the index or key to select. Negative values indicate indices from the end.
|
|
42
|
+
|
|
43
|
+
#### Returns
|
|
44
|
+
|
|
45
|
+
`any`
|
|
46
|
+
|
|
47
|
+
The selected element, or `undefined` if the input is empty or not provided.
|
|
48
|
+
|
|
49
|
+
#### Examples
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
// Selecting an element from an array
|
|
53
|
+
const array = ['apple', 'banana', 'cherry']
|
|
54
|
+
console.log(select(array)) // Random element from the array
|
|
55
|
+
console.log(select(array, 1)) // Second element
|
|
56
|
+
console.log(select(array, -1)) // Last element
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
// Selecting a property from an object
|
|
61
|
+
const obj = { fruit1: 'apple', fruit2: 'banana', fruit3: 'cherry' }
|
|
62
|
+
console.log(select(obj)) // Random property from the object
|
|
63
|
+
console.log(select(obj, 'fruit2')) // Property with key 'fruit2'
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
// Selecting a character from a string
|
|
68
|
+
const str = 'hello'
|
|
69
|
+
console.log(select(str)) // Random character from the string
|
|
70
|
+
console.log(select(str, 1)) // Second character
|
|
71
|
+
console.log(select(str, -1)) // Last character
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### tojson()
|
|
75
|
+
|
|
76
|
+
> **tojson**: (`value`, `indent`?, `depth`?) => `string`
|
|
77
|
+
|
|
78
|
+
#### Parameters
|
|
79
|
+
|
|
80
|
+
• **value**: `any`
|
|
81
|
+
|
|
82
|
+
• **indent?**: `number` \| `object`
|
|
83
|
+
|
|
84
|
+
• **depth?**: `number`
|
|
85
|
+
|
|
86
|
+
#### Returns
|
|
87
|
+
|
|
88
|
+
`string`
|
|
89
|
+
|
|
90
|
+
## Defined in
|
|
91
|
+
|
|
92
|
+
[packages/ai-tool/src/utils/prompt/template/jinja/src/builtins.ts:61](https://github.com/isdk/ai-tool.js/blob/5f9f0083c734722103ff5468e424b48c212a55f0/src/utils/prompt/template/jinja/src/builtins.ts#L61)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
[**@isdk/ai-tool**](../README.md) • **Docs**
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/ai-tool](../globals.md) / InternalErrorCode
|
|
6
|
+
|
|
7
|
+
# Variable: InternalErrorCode
|
|
8
|
+
|
|
9
|
+
> `const` **InternalErrorCode**: [`InternalError`](../enumerations/ErrorCode.md#internalerror) = `ErrorCode.InternalError`
|
|
10
|
+
|
|
11
|
+
## Defined in
|
|
12
|
+
|
|
13
|
+
node\_modules/.pnpm/@isdk+common-error@0.1.1/node\_modules/@isdk/common-error/dist/index.d.ts:27
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
[**@isdk/ai-tool**](../README.md) • **Docs**
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/ai-tool](../globals.md) / NotFoundErrorCode
|
|
6
|
+
|
|
7
|
+
# Variable: NotFoundErrorCode
|
|
8
|
+
|
|
9
|
+
> `const` **NotFoundErrorCode**: [`NotFound`](../enumerations/ErrorCode.md#notfound) = `ErrorCode.NotFound`
|
|
10
|
+
|
|
11
|
+
## Defined in
|
|
12
|
+
|
|
13
|
+
node\_modules/.pnpm/@isdk+common-error@0.1.1/node\_modules/@isdk/common-error/dist/index.d.ts:29
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
[**@isdk/ai-tool**](../README.md) • **Docs**
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/ai-tool](../globals.md) / NotImplementedErrorCode
|
|
6
|
+
|
|
7
|
+
# Variable: NotImplementedErrorCode
|
|
8
|
+
|
|
9
|
+
> `const` **NotImplementedErrorCode**: [`NotImplemented`](../enumerations/ErrorCode.md#notimplemented) = `ErrorCode.NotImplemented`
|
|
10
|
+
|
|
11
|
+
## Defined in
|
|
12
|
+
|
|
13
|
+
node\_modules/.pnpm/@isdk+common-error@0.1.1/node\_modules/@isdk/common-error/dist/index.d.ts:28
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
[**@isdk/ai-tool**](../README.md) • **Docs**
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/ai-tool](../globals.md) / PASSING\_SCORE
|
|
6
|
+
|
|
7
|
+
# Variable: PASSING\_SCORE
|
|
8
|
+
|
|
9
|
+
> `const` **PASSING\_SCORE**: `0.618` = `0.618`
|
|
10
|
+
|
|
11
|
+
## Defined in
|
|
12
|
+
|
|
13
|
+
[packages/ai-tool/src/utils/consts.ts:3](https://github.com/isdk/ai-tool.js/blob/5f9f0083c734722103ff5468e424b48c212a55f0/src/utils/consts.ts#L3)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
[**@isdk/ai-tool**](../README.md) • **Docs**
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/ai-tool](../globals.md) / PromptTemplateTypes
|
|
6
|
+
|
|
7
|
+
# Variable: PromptTemplateTypes
|
|
8
|
+
|
|
9
|
+
> `const` **PromptTemplateTypes**: readonly [`"internal"`, `"hf"`, `"fill"`]
|
|
10
|
+
|
|
11
|
+
## Defined in
|
|
12
|
+
|
|
13
|
+
[packages/ai-tool/src/utils/prompt/consts.ts:12](https://github.com/isdk/ai-tool.js/blob/5f9f0083c734722103ff5468e424b48c212a55f0/src/utils/prompt/consts.ts#L12)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
[**@isdk/ai-tool**](../README.md) • **Docs**
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/ai-tool](../globals.md) / PromptTypes
|
|
6
|
+
|
|
7
|
+
# Variable: PromptTypes
|
|
8
|
+
|
|
9
|
+
> `const` **PromptTypes**: readonly [`"chat"`, `"char"`, `"plan"`]
|
|
10
|
+
|
|
11
|
+
Prompt Type
|
|
12
|
+
defaults to `chat`
|
|
13
|
+
|
|
14
|
+
## Defined in
|
|
15
|
+
|
|
16
|
+
[packages/ai-tool/src/utils/prompt/consts.ts:5](https://github.com/isdk/ai-tool.js/blob/5f9f0083c734722103ff5468e424b48c212a55f0/src/utils/prompt/consts.ts#L5)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
[**@isdk/ai-tool**](../README.md) • **Docs**
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/ai-tool](../globals.md) / RStreamErrCode
|
|
6
|
+
|
|
7
|
+
# Variable: RStreamErrCode
|
|
8
|
+
|
|
9
|
+
> `const` **RStreamErrCode**: `600` = `600`
|
|
10
|
+
|
|
11
|
+
## Defined in
|
|
12
|
+
|
|
13
|
+
[packages/ai-tool/src/utils/stream/error-readable-stream.ts:3](https://github.com/isdk/ai-tool.js/blob/5f9f0083c734722103ff5468e424b48c212a55f0/src/utils/stream/error-readable-stream.ts#L3)
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
[**@isdk/ai-tool**](../README.md) • **Docs**
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/ai-tool](../globals.md) / RemoteToolFuncSchema
|
|
6
|
+
|
|
7
|
+
# Variable: RemoteToolFuncSchema
|
|
8
|
+
|
|
9
|
+
> `const` **RemoteToolFuncSchema**: `object`
|
|
10
|
+
|
|
11
|
+
## Type declaration
|
|
12
|
+
|
|
13
|
+
### action
|
|
14
|
+
|
|
15
|
+
> **action**: `object`
|
|
16
|
+
|
|
17
|
+
### action.type
|
|
18
|
+
|
|
19
|
+
> **type**: `string` = `'string'`
|
|
20
|
+
|
|
21
|
+
### action.assign()
|
|
22
|
+
|
|
23
|
+
#### Parameters
|
|
24
|
+
|
|
25
|
+
• **value**: `"get"` \| `"post"` \| `"put"` \| `"delete"` \| `"patch"` \| `"list"` \| `"res"`
|
|
26
|
+
|
|
27
|
+
• **dest**: `any`
|
|
28
|
+
|
|
29
|
+
• **src?**: `any`
|
|
30
|
+
|
|
31
|
+
• **name?**: `string`
|
|
32
|
+
|
|
33
|
+
• **options?**: `any`
|
|
34
|
+
|
|
35
|
+
#### Returns
|
|
36
|
+
|
|
37
|
+
`"get"` \| `"post"` \| `"put"` \| `"delete"` \| `"patch"` \| `"list"` \| `"res"`
|
|
38
|
+
|
|
39
|
+
### allowExportFunc
|
|
40
|
+
|
|
41
|
+
> **allowExportFunc**: `object`
|
|
42
|
+
|
|
43
|
+
### allowExportFunc.type
|
|
44
|
+
|
|
45
|
+
> **type**: `string` = `'boolean'`
|
|
46
|
+
|
|
47
|
+
### apiRoot
|
|
48
|
+
|
|
49
|
+
> **apiRoot**: `object`
|
|
50
|
+
|
|
51
|
+
### apiRoot.type
|
|
52
|
+
|
|
53
|
+
> **type**: `string` = `'string'`
|
|
54
|
+
|
|
55
|
+
### apiRoot.get()
|
|
56
|
+
|
|
57
|
+
#### Parameters
|
|
58
|
+
|
|
59
|
+
• **this**: `any`
|
|
60
|
+
|
|
61
|
+
#### Returns
|
|
62
|
+
|
|
63
|
+
`any`
|
|
64
|
+
|
|
65
|
+
### apiRoot.set()
|
|
66
|
+
|
|
67
|
+
#### Parameters
|
|
68
|
+
|
|
69
|
+
• **this**: `any`
|
|
70
|
+
|
|
71
|
+
• **value**: `string`
|
|
72
|
+
|
|
73
|
+
#### Returns
|
|
74
|
+
|
|
75
|
+
`void`
|
|
76
|
+
|
|
77
|
+
### fetchOptions
|
|
78
|
+
|
|
79
|
+
> **fetchOptions**: `object`
|
|
80
|
+
|
|
81
|
+
### fetchOptions.type
|
|
82
|
+
|
|
83
|
+
> **type**: `string` = `'object'`
|
|
84
|
+
|
|
85
|
+
## Defined in
|
|
86
|
+
|
|
87
|
+
[packages/ai-tool/src/utils/consts.ts:13](https://github.com/isdk/ai-tool.js/blob/5f9f0083c734722103ff5468e424b48c212a55f0/src/utils/consts.ts#L13)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
[**@isdk/ai-tool**](../README.md) • **Docs**
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/ai-tool](../globals.md) / ResponseRStreamErrCode
|
|
6
|
+
|
|
7
|
+
# Variable: ResponseRStreamErrCode
|
|
8
|
+
|
|
9
|
+
> `const` **ResponseRStreamErrCode**: `601` = `601`
|
|
10
|
+
|
|
11
|
+
## Defined in
|
|
12
|
+
|
|
13
|
+
[packages/ai-tool/src/utils/stream/error-readable-stream.ts:4](https://github.com/isdk/ai-tool.js/blob/5f9f0083c734722103ff5468e424b48c212a55f0/src/utils/stream/error-readable-stream.ts#L4)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
[**@isdk/ai-tool**](../README.md) • **Docs**
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/ai-tool](../globals.md) / SSEChannelAlreadyClosedErrCode
|
|
6
|
+
|
|
7
|
+
# Variable: SSEChannelAlreadyClosedErrCode
|
|
8
|
+
|
|
9
|
+
> `const` **SSEChannelAlreadyClosedErrCode**: `498` = `498`
|
|
10
|
+
|
|
11
|
+
## Defined in
|
|
12
|
+
|
|
13
|
+
[packages/ai-tool/src/utils/event/sse-channel.ts:17](https://github.com/isdk/ai-tool.js/blob/5f9f0083c734722103ff5468e424b48c212a55f0/src/utils/event/sse-channel.ts#L17)
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
[**@isdk/ai-tool**](../README.md) • **Docs**
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/ai-tool](../globals.md) / ServerToolFuncSchema
|
|
6
|
+
|
|
7
|
+
# Variable: ServerToolFuncSchema
|
|
8
|
+
|
|
9
|
+
> `const` **ServerToolFuncSchema**: `object`
|
|
10
|
+
|
|
11
|
+
## Type declaration
|
|
12
|
+
|
|
13
|
+
### action
|
|
14
|
+
|
|
15
|
+
> **action**: `object`
|
|
16
|
+
|
|
17
|
+
### action.type
|
|
18
|
+
|
|
19
|
+
> **type**: `string` = `'string'`
|
|
20
|
+
|
|
21
|
+
### action.assign()
|
|
22
|
+
|
|
23
|
+
#### Parameters
|
|
24
|
+
|
|
25
|
+
• **value**: `"get"` \| `"post"` \| `"put"` \| `"delete"` \| `"patch"` \| `"list"` \| `"res"`
|
|
26
|
+
|
|
27
|
+
• **dest**: `any`
|
|
28
|
+
|
|
29
|
+
• **src?**: `any`
|
|
30
|
+
|
|
31
|
+
• **name?**: `string`
|
|
32
|
+
|
|
33
|
+
• **options?**: `any`
|
|
34
|
+
|
|
35
|
+
#### Returns
|
|
36
|
+
|
|
37
|
+
`"get"` \| `"post"` \| `"put"` \| `"delete"` \| `"patch"` \| `"list"` \| `"res"`
|
|
38
|
+
|
|
39
|
+
### allowExportFunc
|
|
40
|
+
|
|
41
|
+
> **allowExportFunc**: `object`
|
|
42
|
+
|
|
43
|
+
### allowExportFunc.type
|
|
44
|
+
|
|
45
|
+
> **type**: `string` = `'boolean'`
|
|
46
|
+
|
|
47
|
+
### apiRoot
|
|
48
|
+
|
|
49
|
+
> **apiRoot**: `object`
|
|
50
|
+
|
|
51
|
+
### apiRoot.type
|
|
52
|
+
|
|
53
|
+
> **type**: `string` = `'string'`
|
|
54
|
+
|
|
55
|
+
### apiRoot.get()
|
|
56
|
+
|
|
57
|
+
#### Parameters
|
|
58
|
+
|
|
59
|
+
• **this**: `any`
|
|
60
|
+
|
|
61
|
+
#### Returns
|
|
62
|
+
|
|
63
|
+
`any`
|
|
64
|
+
|
|
65
|
+
### apiRoot.set()
|
|
66
|
+
|
|
67
|
+
#### Parameters
|
|
68
|
+
|
|
69
|
+
• **this**: `any`
|
|
70
|
+
|
|
71
|
+
• **value**: `string`
|
|
72
|
+
|
|
73
|
+
#### Returns
|
|
74
|
+
|
|
75
|
+
`void`
|
|
76
|
+
|
|
77
|
+
### fetchOptions
|
|
78
|
+
|
|
79
|
+
> **fetchOptions**: `object`
|
|
80
|
+
|
|
81
|
+
### fetchOptions.type
|
|
82
|
+
|
|
83
|
+
> **type**: `string` = `'object'`
|
|
84
|
+
|
|
85
|
+
## Defined in
|
|
86
|
+
|
|
87
|
+
[packages/ai-tool/src/server-tools.ts:62](https://github.com/isdk/ai-tool.js/blob/5f9f0083c734722103ff5468e424b48c212a55f0/src/server-tools.ts#L62)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
[**@isdk/ai-tool**](../README.md) • **Docs**
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/ai-tool](../globals.md) / ToolAsyncCancelableBit
|
|
6
|
+
|
|
7
|
+
# Variable: ToolAsyncCancelableBit
|
|
8
|
+
|
|
9
|
+
> `const` **ToolAsyncCancelableBit**: `1` = `1`
|
|
10
|
+
|
|
11
|
+
## Defined in
|
|
12
|
+
|
|
13
|
+
[packages/ai-tool/src/tool-func.ts:8](https://github.com/isdk/ai-tool.js/blob/5f9f0083c734722103ff5468e424b48c212a55f0/src/tool-func.ts#L8)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
[**@isdk/ai-tool**](../README.md) • **Docs**
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/ai-tool](../globals.md) / ToolAsyncMultiTaskBit
|
|
6
|
+
|
|
7
|
+
# Variable: ToolAsyncMultiTaskBit
|
|
8
|
+
|
|
9
|
+
> `const` **ToolAsyncMultiTaskBit**: `0` = `0`
|
|
10
|
+
|
|
11
|
+
## Defined in
|
|
12
|
+
|
|
13
|
+
[packages/ai-tool/src/tool-func.ts:7](https://github.com/isdk/ai-tool.js/blob/5f9f0083c734722103ff5468e424b48c212a55f0/src/tool-func.ts#L7)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
[**@isdk/ai-tool**](../README.md) • **Docs**
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/ai-tool](../globals.md) / ToolAsyncPriorityBit
|
|
6
|
+
|
|
7
|
+
# Variable: ToolAsyncPriorityBit
|
|
8
|
+
|
|
9
|
+
> `const` **ToolAsyncPriorityBit**: `2` = `2`
|
|
10
|
+
|
|
11
|
+
## Defined in
|
|
12
|
+
|
|
13
|
+
[packages/ai-tool/src/tool-func.ts:9](https://github.com/isdk/ai-tool.js/blob/5f9f0083c734722103ff5468e424b48c212a55f0/src/tool-func.ts#L9)
|