@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
|
@@ -1,60 +1,35 @@
|
|
|
1
|
-
[
|
|
1
|
+
[**@isdk/ai-tool**](../README.md) • **Docs**
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/ai-tool](../globals.md) / NotImplementationError
|
|
2
6
|
|
|
3
7
|
# Class: NotImplementationError
|
|
4
8
|
|
|
5
9
|
Represents an error when a function or method is not implemented.
|
|
6
10
|
Inherits from BaseError.
|
|
7
11
|
|
|
8
|
-
|
|
12
|
+
## Example
|
|
9
13
|
|
|
10
14
|
```ts
|
|
11
15
|
throw new NotImplementationError()
|
|
12
16
|
```
|
|
13
17
|
|
|
14
|
-
##
|
|
18
|
+
## Extends
|
|
15
19
|
|
|
16
20
|
- [`CommonError`](CommonError.md)
|
|
17
21
|
|
|
18
|
-
↳ **`NotImplementationError`**
|
|
19
|
-
|
|
20
|
-
## Table of contents
|
|
21
|
-
|
|
22
|
-
### Constructors
|
|
23
|
-
|
|
24
|
-
- [constructor](NotImplementationError.md#constructor)
|
|
25
|
-
|
|
26
|
-
### Properties
|
|
27
|
-
|
|
28
|
-
- [caller](NotImplementationError.md#caller)
|
|
29
|
-
- [cause](NotImplementationError.md#cause)
|
|
30
|
-
- [code](NotImplementationError.md#code)
|
|
31
|
-
- [data](NotImplementationError.md#data)
|
|
32
|
-
- [message](NotImplementationError.md#message)
|
|
33
|
-
- [name](NotImplementationError.md#name)
|
|
34
|
-
- [stack](NotImplementationError.md#stack)
|
|
35
|
-
- [code](NotImplementationError.md#code-1)
|
|
36
|
-
- [prepareStackTrace](NotImplementationError.md#preparestacktrace)
|
|
37
|
-
- [stackTraceLimit](NotImplementationError.md#stacktracelimit)
|
|
38
|
-
|
|
39
|
-
### Methods
|
|
40
|
-
|
|
41
|
-
- [fromJSON](NotImplementationError.md#fromjson)
|
|
42
|
-
- [toJSON](NotImplementationError.md#tojson)
|
|
43
|
-
- [captureStackTrace](NotImplementationError.md#capturestacktrace)
|
|
44
|
-
- [createErrorClass](NotImplementationError.md#createerrorclass)
|
|
45
|
-
|
|
46
22
|
## Constructors
|
|
47
23
|
|
|
48
|
-
###
|
|
24
|
+
### new NotImplementationError()
|
|
49
25
|
|
|
50
|
-
|
|
26
|
+
> **new NotImplementationError**(`msg`?, `name`?): [`NotImplementationError`](NotImplementationError.md)
|
|
51
27
|
|
|
52
28
|
#### Parameters
|
|
53
29
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
| `name?` | `string` \| `Record`\<`string`, `any`\> |
|
|
30
|
+
• **msg?**: `string`
|
|
31
|
+
|
|
32
|
+
• **name?**: `string` \| `Record`\<`string`, `any`\>
|
|
58
33
|
|
|
59
34
|
#### Returns
|
|
60
35
|
|
|
@@ -62,192 +37,189 @@ throw new NotImplementationError()
|
|
|
62
37
|
|
|
63
38
|
#### Overrides
|
|
64
39
|
|
|
65
|
-
[CommonError](CommonError.md).[constructor](CommonError.md#
|
|
40
|
+
[`CommonError`](CommonError.md).[`constructor`](CommonError.md#constructors)
|
|
66
41
|
|
|
67
42
|
#### Defined in
|
|
68
43
|
|
|
69
|
-
|
|
44
|
+
node\_modules/.pnpm/@isdk+common-error@0.1.1/node\_modules/@isdk/common-error/dist/index.d.ts:102
|
|
70
45
|
|
|
71
46
|
## Properties
|
|
72
47
|
|
|
73
48
|
### caller
|
|
74
49
|
|
|
75
|
-
|
|
50
|
+
> **caller**: `string`
|
|
76
51
|
|
|
77
52
|
The name of the function that threw the error.
|
|
78
53
|
|
|
79
54
|
#### Inherited from
|
|
80
55
|
|
|
81
|
-
[CommonError](CommonError.md).[caller](CommonError.md#caller)
|
|
56
|
+
[`CommonError`](CommonError.md).[`caller`](CommonError.md#caller)
|
|
82
57
|
|
|
83
58
|
#### Defined in
|
|
84
59
|
|
|
85
|
-
|
|
60
|
+
node\_modules/.pnpm/@isdk+common-error@0.1.1/node\_modules/@isdk/common-error/dist/index.d.ts:63
|
|
86
61
|
|
|
87
|
-
|
|
62
|
+
***
|
|
88
63
|
|
|
89
|
-
### cause
|
|
64
|
+
### cause?
|
|
90
65
|
|
|
91
|
-
|
|
66
|
+
> `optional` **cause**: `unknown`
|
|
92
67
|
|
|
93
68
|
#### Inherited from
|
|
94
69
|
|
|
95
|
-
[CommonError](CommonError.md).[cause](CommonError.md#cause)
|
|
70
|
+
[`CommonError`](CommonError.md).[`cause`](CommonError.md#cause)
|
|
96
71
|
|
|
97
72
|
#### Defined in
|
|
98
73
|
|
|
99
|
-
|
|
74
|
+
node\_modules/.pnpm/typescript@5.6.2/node\_modules/typescript/lib/lib.es2022.error.d.ts:24
|
|
100
75
|
|
|
101
|
-
|
|
76
|
+
***
|
|
102
77
|
|
|
103
78
|
### code
|
|
104
79
|
|
|
105
|
-
|
|
80
|
+
> **code**: `ErrorCodeType`
|
|
81
|
+
|
|
82
|
+
the error code
|
|
106
83
|
|
|
107
84
|
#### Inherited from
|
|
108
85
|
|
|
109
|
-
[CommonError](CommonError.md).[code](CommonError.md#code)
|
|
86
|
+
[`CommonError`](CommonError.md).[`code`](CommonError.md#code)
|
|
110
87
|
|
|
111
88
|
#### Defined in
|
|
112
89
|
|
|
113
|
-
|
|
90
|
+
node\_modules/.pnpm/@isdk+common-error@0.1.1/node\_modules/@isdk/common-error/dist/index.d.ts:64
|
|
114
91
|
|
|
115
|
-
|
|
92
|
+
***
|
|
116
93
|
|
|
117
|
-
### data
|
|
94
|
+
### data?
|
|
118
95
|
|
|
119
|
-
|
|
96
|
+
> `optional` **data**: `any`
|
|
120
97
|
|
|
121
98
|
Additional data associated with the error.
|
|
122
99
|
|
|
123
100
|
#### Inherited from
|
|
124
101
|
|
|
125
|
-
[CommonError](CommonError.md).[data](CommonError.md#data)
|
|
102
|
+
[`CommonError`](CommonError.md).[`data`](CommonError.md#data)
|
|
126
103
|
|
|
127
104
|
#### Defined in
|
|
128
105
|
|
|
129
|
-
|
|
106
|
+
node\_modules/.pnpm/@isdk+common-error@0.1.1/node\_modules/@isdk/common-error/dist/index.d.ts:65
|
|
130
107
|
|
|
131
|
-
|
|
108
|
+
***
|
|
132
109
|
|
|
133
110
|
### message
|
|
134
111
|
|
|
135
|
-
|
|
112
|
+
> **message**: `string`
|
|
136
113
|
|
|
137
114
|
#### Inherited from
|
|
138
115
|
|
|
139
|
-
[CommonError](CommonError.md).[message](CommonError.md#message)
|
|
116
|
+
[`CommonError`](CommonError.md).[`message`](CommonError.md#message)
|
|
140
117
|
|
|
141
118
|
#### Defined in
|
|
142
119
|
|
|
143
|
-
|
|
120
|
+
node\_modules/.pnpm/typescript@5.6.2/node\_modules/typescript/lib/lib.es5.d.ts:1077
|
|
144
121
|
|
|
145
|
-
|
|
122
|
+
***
|
|
146
123
|
|
|
147
124
|
### name
|
|
148
125
|
|
|
149
|
-
|
|
126
|
+
> **name**: `string`
|
|
150
127
|
|
|
151
128
|
#### Inherited from
|
|
152
129
|
|
|
153
|
-
[CommonError](CommonError.md).[name](CommonError.md#name)
|
|
130
|
+
[`CommonError`](CommonError.md).[`name`](CommonError.md#name)
|
|
154
131
|
|
|
155
132
|
#### Defined in
|
|
156
133
|
|
|
157
|
-
|
|
134
|
+
node\_modules/.pnpm/typescript@5.6.2/node\_modules/typescript/lib/lib.es5.d.ts:1076
|
|
158
135
|
|
|
159
|
-
|
|
136
|
+
***
|
|
160
137
|
|
|
161
|
-
### stack
|
|
138
|
+
### stack?
|
|
162
139
|
|
|
163
|
-
|
|
140
|
+
> `optional` **stack**: `string`
|
|
164
141
|
|
|
165
142
|
#### Inherited from
|
|
166
143
|
|
|
167
|
-
[CommonError](CommonError.md).[stack](CommonError.md#stack)
|
|
144
|
+
[`CommonError`](CommonError.md).[`stack`](CommonError.md#stack)
|
|
168
145
|
|
|
169
146
|
#### Defined in
|
|
170
147
|
|
|
171
|
-
|
|
148
|
+
node\_modules/.pnpm/typescript@5.6.2/node\_modules/typescript/lib/lib.es5.d.ts:1078
|
|
172
149
|
|
|
173
|
-
|
|
150
|
+
***
|
|
174
151
|
|
|
175
152
|
### code
|
|
176
153
|
|
|
177
|
-
|
|
154
|
+
> `static` **code**: `ErrorCodeType`
|
|
178
155
|
|
|
179
156
|
The error code associated with the error.
|
|
180
157
|
|
|
181
158
|
#### Inherited from
|
|
182
159
|
|
|
183
|
-
[CommonError](CommonError.md).[code](CommonError.md#code-1)
|
|
160
|
+
[`CommonError`](CommonError.md).[`code`](CommonError.md#code-1)
|
|
184
161
|
|
|
185
162
|
#### Defined in
|
|
186
163
|
|
|
187
|
-
|
|
164
|
+
node\_modules/.pnpm/@isdk+common-error@0.1.1/node\_modules/@isdk/common-error/dist/index.d.ts:62
|
|
188
165
|
|
|
189
|
-
|
|
166
|
+
***
|
|
190
167
|
|
|
191
|
-
### prepareStackTrace
|
|
168
|
+
### prepareStackTrace()?
|
|
192
169
|
|
|
193
|
-
|
|
170
|
+
> `static` `optional` **prepareStackTrace**: (`err`, `stackTraces`) => `any`
|
|
194
171
|
|
|
195
172
|
Optional override for formatting stack traces
|
|
196
173
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
https://v8.dev/docs/stack-trace-api#customizing-stack-traces
|
|
174
|
+
#### Parameters
|
|
200
175
|
|
|
201
|
-
|
|
176
|
+
• **err**: `Error`
|
|
202
177
|
|
|
203
|
-
|
|
178
|
+
• **stackTraces**: `CallSite`[]
|
|
204
179
|
|
|
205
|
-
|
|
180
|
+
#### Returns
|
|
206
181
|
|
|
207
|
-
|
|
208
|
-
| :------ | :------ |
|
|
209
|
-
| `err` | `Error` |
|
|
210
|
-
| `stackTraces` | `CallSite`[] |
|
|
182
|
+
`any`
|
|
211
183
|
|
|
212
|
-
|
|
184
|
+
#### See
|
|
213
185
|
|
|
214
|
-
|
|
186
|
+
https://v8.dev/docs/stack-trace-api#customizing-stack-traces
|
|
215
187
|
|
|
216
188
|
#### Inherited from
|
|
217
189
|
|
|
218
|
-
[CommonError](CommonError.md).[prepareStackTrace](CommonError.md#preparestacktrace)
|
|
190
|
+
[`CommonError`](CommonError.md).[`prepareStackTrace`](CommonError.md#preparestacktrace)
|
|
219
191
|
|
|
220
192
|
#### Defined in
|
|
221
193
|
|
|
222
|
-
|
|
194
|
+
node\_modules/.pnpm/@types+node@22.5.5/node\_modules/@types/node/globals.d.ts:143
|
|
223
195
|
|
|
224
|
-
|
|
196
|
+
***
|
|
225
197
|
|
|
226
198
|
### stackTraceLimit
|
|
227
199
|
|
|
228
|
-
|
|
200
|
+
> `static` **stackTraceLimit**: `number`
|
|
229
201
|
|
|
230
202
|
#### Inherited from
|
|
231
203
|
|
|
232
|
-
[CommonError](CommonError.md).[stackTraceLimit](CommonError.md#stacktracelimit)
|
|
204
|
+
[`CommonError`](CommonError.md).[`stackTraceLimit`](CommonError.md#stacktracelimit)
|
|
233
205
|
|
|
234
206
|
#### Defined in
|
|
235
207
|
|
|
236
|
-
|
|
208
|
+
node\_modules/.pnpm/@types+node@22.5.5/node\_modules/@types/node/globals.d.ts:145
|
|
237
209
|
|
|
238
210
|
## Methods
|
|
239
211
|
|
|
240
|
-
### fromJSON
|
|
212
|
+
### fromJSON()
|
|
241
213
|
|
|
242
|
-
|
|
214
|
+
> **fromJSON**(`json`): [`BaseError`](BaseError.md)
|
|
243
215
|
|
|
244
216
|
Creates a new BaseError instance from a JSON representation.
|
|
245
217
|
|
|
246
218
|
#### Parameters
|
|
247
219
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
220
|
+
• **json**: `any`
|
|
221
|
+
|
|
222
|
+
A JSON representation of the error.
|
|
251
223
|
|
|
252
224
|
#### Returns
|
|
253
225
|
|
|
@@ -257,17 +229,17 @@ A new BaseError instance.
|
|
|
257
229
|
|
|
258
230
|
#### Inherited from
|
|
259
231
|
|
|
260
|
-
[CommonError](CommonError.md).[fromJSON](CommonError.md#fromjson)
|
|
232
|
+
[`CommonError`](CommonError.md).[`fromJSON`](CommonError.md#fromjson)
|
|
261
233
|
|
|
262
234
|
#### Defined in
|
|
263
235
|
|
|
264
|
-
|
|
236
|
+
node\_modules/.pnpm/@isdk+common-error@0.1.1/node\_modules/@isdk/common-error/dist/index.d.ts:87
|
|
265
237
|
|
|
266
|
-
|
|
238
|
+
***
|
|
267
239
|
|
|
268
|
-
### toJSON
|
|
240
|
+
### toJSON()
|
|
269
241
|
|
|
270
|
-
|
|
242
|
+
> **toJSON**(): `any`
|
|
271
243
|
|
|
272
244
|
Returns a JSON representation of the error.
|
|
273
245
|
|
|
@@ -279,26 +251,25 @@ A JSON representation of the error.
|
|
|
279
251
|
|
|
280
252
|
#### Inherited from
|
|
281
253
|
|
|
282
|
-
[CommonError](CommonError.md).[toJSON](CommonError.md#tojson)
|
|
254
|
+
[`CommonError`](CommonError.md).[`toJSON`](CommonError.md#tojson)
|
|
283
255
|
|
|
284
256
|
#### Defined in
|
|
285
257
|
|
|
286
|
-
|
|
258
|
+
node\_modules/.pnpm/@isdk+common-error@0.1.1/node\_modules/@isdk/common-error/dist/index.d.ts:80
|
|
287
259
|
|
|
288
|
-
|
|
260
|
+
***
|
|
289
261
|
|
|
290
|
-
### captureStackTrace
|
|
262
|
+
### captureStackTrace()
|
|
291
263
|
|
|
292
|
-
|
|
264
|
+
> `static` **captureStackTrace**(`targetObject`, `constructorOpt`?): `void`
|
|
293
265
|
|
|
294
266
|
Create .stack property on a target object
|
|
295
267
|
|
|
296
268
|
#### Parameters
|
|
297
269
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
| `constructorOpt?` | `Function` |
|
|
270
|
+
• **targetObject**: `object`
|
|
271
|
+
|
|
272
|
+
• **constructorOpt?**: `Function`
|
|
302
273
|
|
|
303
274
|
#### Returns
|
|
304
275
|
|
|
@@ -306,34 +277,42 @@ Create .stack property on a target object
|
|
|
306
277
|
|
|
307
278
|
#### Inherited from
|
|
308
279
|
|
|
309
|
-
[CommonError](CommonError.md).[captureStackTrace](CommonError.md#capturestacktrace)
|
|
280
|
+
[`CommonError`](CommonError.md).[`captureStackTrace`](CommonError.md#capturestacktrace)
|
|
310
281
|
|
|
311
282
|
#### Defined in
|
|
312
283
|
|
|
313
|
-
|
|
284
|
+
node\_modules/.pnpm/@types+node@22.5.5/node\_modules/@types/node/globals.d.ts:136
|
|
285
|
+
|
|
286
|
+
***
|
|
314
287
|
|
|
315
|
-
|
|
288
|
+
### createErrorClass()
|
|
316
289
|
|
|
317
|
-
|
|
290
|
+
> `static` **createErrorClass**(`aType`, `aErrorCode`?, `ParentErrorClass`?): *typeof* [`BaseError`](BaseError.md)
|
|
318
291
|
|
|
319
|
-
|
|
292
|
+
Create an Error Class
|
|
320
293
|
|
|
321
294
|
#### Parameters
|
|
322
295
|
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
296
|
+
• **aType**: `string`
|
|
297
|
+
|
|
298
|
+
the error type(class) name
|
|
299
|
+
|
|
300
|
+
• **aErrorCode?**: `string` \| `number` \| *typeof* `AbstractError`
|
|
301
|
+
|
|
302
|
+
• **ParentErrorClass?**: *typeof* [`BaseError`](BaseError.md)
|
|
303
|
+
|
|
304
|
+
the parent error class. defaults to AbstractError
|
|
328
305
|
|
|
329
306
|
#### Returns
|
|
330
307
|
|
|
331
|
-
typeof [`BaseError`](BaseError.md)
|
|
308
|
+
*typeof* [`BaseError`](BaseError.md)
|
|
309
|
+
|
|
310
|
+
the new Error Class
|
|
332
311
|
|
|
333
312
|
#### Inherited from
|
|
334
313
|
|
|
335
|
-
[CommonError](CommonError.md).[createErrorClass](CommonError.md#createerrorclass)
|
|
314
|
+
[`CommonError`](CommonError.md).[`createErrorClass`](CommonError.md#createerrorclass)
|
|
336
315
|
|
|
337
316
|
#### Defined in
|
|
338
317
|
|
|
339
|
-
|
|
318
|
+
node\_modules/.pnpm/@isdk+common-error@0.1.1/node\_modules/@isdk/common-error/dist/index.d.ts:66
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
[
|
|
1
|
+
[**@isdk/ai-tool**](../README.md) • **Docs**
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@isdk/ai-tool](../globals.md) / PromptExampleSelector
|
|
2
6
|
|
|
3
7
|
# Class: PromptExampleSelector\<T\>
|
|
4
8
|
|
|
@@ -6,7 +10,7 @@ The `PromptExampleSelector` class provides a mechanism to selectively choose exa
|
|
|
6
10
|
configurable options such as maximum length and probability threshold. This class is meant to be extended and customized
|
|
7
11
|
with an implementation of the `selectExample` method.
|
|
8
12
|
|
|
9
|
-
|
|
13
|
+
## Example
|
|
10
14
|
|
|
11
15
|
```ts
|
|
12
16
|
// Custom selector that selects examples based on a custom condition
|
|
@@ -28,51 +32,29 @@ for await (const selectedExample of selector) {
|
|
|
28
32
|
}
|
|
29
33
|
```
|
|
30
34
|
|
|
31
|
-
## Type
|
|
32
|
-
|
|
33
|
-
| Name | Type | Description |
|
|
34
|
-
| :------ | :------ | :------ |
|
|
35
|
-
| `T` | `any` | The type of the prompt examples. |
|
|
36
|
-
|
|
37
|
-
## Table of contents
|
|
38
|
-
|
|
39
|
-
### Constructors
|
|
35
|
+
## Type Parameters
|
|
40
36
|
|
|
41
|
-
|
|
37
|
+
• **T** = `any`
|
|
42
38
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
- [examples](PromptExampleSelector.md#examples)
|
|
46
|
-
- [maxLength](PromptExampleSelector.md#maxlength)
|
|
47
|
-
- [threshold](PromptExampleSelector.md#threshold)
|
|
48
|
-
|
|
49
|
-
### Methods
|
|
50
|
-
|
|
51
|
-
- [[asyncIterator]](PromptExampleSelector.md#[asynciterator])
|
|
52
|
-
- [initialize](PromptExampleSelector.md#initialize)
|
|
53
|
-
- [selectExample](PromptExampleSelector.md#selectexample)
|
|
54
|
-
- [selectExamples](PromptExampleSelector.md#selectexamples)
|
|
39
|
+
The type of the prompt examples.
|
|
55
40
|
|
|
56
41
|
## Constructors
|
|
57
42
|
|
|
58
|
-
###
|
|
43
|
+
### new PromptExampleSelector()
|
|
59
44
|
|
|
60
|
-
|
|
45
|
+
> **new PromptExampleSelector**\<`T`\>(`examples`, `options`?): [`PromptExampleSelector`](PromptExampleSelector.md)\<`T`\>
|
|
61
46
|
|
|
62
47
|
Constructs a new `PromptExampleSelector` instance with the given examples and options.
|
|
63
48
|
|
|
64
|
-
####
|
|
49
|
+
#### Parameters
|
|
50
|
+
|
|
51
|
+
• **examples**: [`PromptExamples`](../type-aliases/PromptExamples.md)\<`T`\>
|
|
65
52
|
|
|
66
|
-
|
|
67
|
-
| :------ | :------ |
|
|
68
|
-
| `T` | `any` |
|
|
53
|
+
The prompt examples to select from.
|
|
69
54
|
|
|
70
|
-
|
|
55
|
+
• **options?**: [`PromptExampleSelectorOptions`](../interfaces/PromptExampleSelectorOptions.md)
|
|
71
56
|
|
|
72
|
-
|
|
73
|
-
| :------ | :------ | :------ |
|
|
74
|
-
| `examples` | [`PromptExamples`](../modules.md#promptexamples)\<`T`\> | The prompt examples to select from. |
|
|
75
|
-
| `options?` | [`PromptExampleSelectorOptions`](../interfaces/PromptExampleSelectorOptions.md) | An optional configuration object. |
|
|
57
|
+
An optional configuration object.
|
|
76
58
|
|
|
77
59
|
#### Returns
|
|
78
60
|
|
|
@@ -80,47 +62,47 @@ Constructs a new `PromptExampleSelector` instance with the given examples and op
|
|
|
80
62
|
|
|
81
63
|
#### Defined in
|
|
82
64
|
|
|
83
|
-
[packages/ai-tool/src/utils/prompt/prompt-example-selector.ts:62](https://github.com/isdk/ai-tool.js/blob/
|
|
65
|
+
[packages/ai-tool/src/utils/prompt/prompt-example-selector.ts:62](https://github.com/isdk/ai-tool.js/blob/5f9f0083c734722103ff5468e424b48c212a55f0/src/utils/prompt/prompt-example-selector.ts#L62)
|
|
84
66
|
|
|
85
67
|
## Properties
|
|
86
68
|
|
|
87
69
|
### examples
|
|
88
70
|
|
|
89
|
-
|
|
71
|
+
> **examples**: [`PromptExamples`](../type-aliases/PromptExamples.md)\<`T`\>
|
|
90
72
|
|
|
91
73
|
The collection of prompt examples.
|
|
92
74
|
|
|
93
75
|
#### Defined in
|
|
94
76
|
|
|
95
|
-
[packages/ai-tool/src/utils/prompt/prompt-example-selector.ts:55](https://github.com/isdk/ai-tool.js/blob/
|
|
77
|
+
[packages/ai-tool/src/utils/prompt/prompt-example-selector.ts:55](https://github.com/isdk/ai-tool.js/blob/5f9f0083c734722103ff5468e424b48c212a55f0/src/utils/prompt/prompt-example-selector.ts#L55)
|
|
96
78
|
|
|
97
|
-
|
|
79
|
+
***
|
|
98
80
|
|
|
99
81
|
### maxLength
|
|
100
82
|
|
|
101
|
-
|
|
83
|
+
> **maxLength**: `undefined` \| `number`
|
|
102
84
|
|
|
103
85
|
#### Defined in
|
|
104
86
|
|
|
105
|
-
[packages/ai-tool/src/utils/prompt/prompt-example-selector.ts:47](https://github.com/isdk/ai-tool.js/blob/
|
|
87
|
+
[packages/ai-tool/src/utils/prompt/prompt-example-selector.ts:47](https://github.com/isdk/ai-tool.js/blob/5f9f0083c734722103ff5468e424b48c212a55f0/src/utils/prompt/prompt-example-selector.ts#L47)
|
|
106
88
|
|
|
107
|
-
|
|
89
|
+
***
|
|
108
90
|
|
|
109
91
|
### threshold
|
|
110
92
|
|
|
111
|
-
|
|
93
|
+
> **threshold**: `undefined` \| `number`
|
|
112
94
|
|
|
113
95
|
The probability threshold (0-1) for selecting an example. If `undefined`, no filtering by probability occurs.
|
|
114
96
|
|
|
115
97
|
#### Defined in
|
|
116
98
|
|
|
117
|
-
[packages/ai-tool/src/utils/prompt/prompt-example-selector.ts:51](https://github.com/isdk/ai-tool.js/blob/
|
|
99
|
+
[packages/ai-tool/src/utils/prompt/prompt-example-selector.ts:51](https://github.com/isdk/ai-tool.js/blob/5f9f0083c734722103ff5468e424b48c212a55f0/src/utils/prompt/prompt-example-selector.ts#L51)
|
|
118
100
|
|
|
119
101
|
## Methods
|
|
120
102
|
|
|
121
|
-
### [asyncIterator]
|
|
103
|
+
### \[asyncIterator\]()
|
|
122
104
|
|
|
123
|
-
|
|
105
|
+
> **\[asyncIterator\]**(): `AsyncGenerator`\<`Awaited`\<`T`\>, `void`, `unknown`\>
|
|
124
106
|
|
|
125
107
|
Returns an asynchronous iterator for the selected examples.
|
|
126
108
|
|
|
@@ -132,22 +114,25 @@ An asynchronous iterator over the selected examples.
|
|
|
132
114
|
|
|
133
115
|
#### Defined in
|
|
134
116
|
|
|
135
|
-
[packages/ai-tool/src/utils/prompt/prompt-example-selector.ts:119](https://github.com/isdk/ai-tool.js/blob/
|
|
117
|
+
[packages/ai-tool/src/utils/prompt/prompt-example-selector.ts:119](https://github.com/isdk/ai-tool.js/blob/5f9f0083c734722103ff5468e424b48c212a55f0/src/utils/prompt/prompt-example-selector.ts#L119)
|
|
136
118
|
|
|
137
|
-
|
|
119
|
+
***
|
|
138
120
|
|
|
139
|
-
### initialize
|
|
121
|
+
### initialize()
|
|
140
122
|
|
|
141
|
-
|
|
123
|
+
> **initialize**(`examples`, `options`?): `void`
|
|
142
124
|
|
|
143
125
|
Initializes the selector with examples and options.
|
|
144
126
|
|
|
145
127
|
#### Parameters
|
|
146
128
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
129
|
+
• **examples**: [`PromptExamples`](../type-aliases/PromptExamples.md)\<`T`\>
|
|
130
|
+
|
|
131
|
+
The prompt examples to select from.
|
|
132
|
+
|
|
133
|
+
• **options?**: [`PromptExampleSelectorOptions`](../interfaces/PromptExampleSelectorOptions.md)
|
|
134
|
+
|
|
135
|
+
An optional configuration object.
|
|
151
136
|
|
|
152
137
|
#### Returns
|
|
153
138
|
|
|
@@ -155,22 +140,25 @@ Initializes the selector with examples and options.
|
|
|
155
140
|
|
|
156
141
|
#### Defined in
|
|
157
142
|
|
|
158
|
-
[packages/ai-tool/src/utils/prompt/prompt-example-selector.ts:71](https://github.com/isdk/ai-tool.js/blob/
|
|
143
|
+
[packages/ai-tool/src/utils/prompt/prompt-example-selector.ts:71](https://github.com/isdk/ai-tool.js/blob/5f9f0083c734722103ff5468e424b48c212a55f0/src/utils/prompt/prompt-example-selector.ts#L71)
|
|
159
144
|
|
|
160
|
-
|
|
145
|
+
***
|
|
161
146
|
|
|
162
|
-
### selectExample
|
|
147
|
+
### selectExample()
|
|
163
148
|
|
|
164
|
-
|
|
149
|
+
> **selectExample**(`example`, `threshold`?): `void` \| `T`
|
|
165
150
|
|
|
166
151
|
Select an example. Can overwrite this in subclasses.
|
|
167
152
|
|
|
168
153
|
#### Parameters
|
|
169
154
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
155
|
+
• **example**: `T`
|
|
156
|
+
|
|
157
|
+
The example to potentially select.
|
|
158
|
+
|
|
159
|
+
• **threshold?**: `number`
|
|
160
|
+
|
|
161
|
+
report the current probability [0-1) for the selecting example.
|
|
174
162
|
|
|
175
163
|
#### Returns
|
|
176
164
|
|
|
@@ -180,21 +168,21 @@ The selected example, or `undefined` if not selected.
|
|
|
180
168
|
|
|
181
169
|
#### Defined in
|
|
182
170
|
|
|
183
|
-
[packages/ai-tool/src/utils/prompt/prompt-example-selector.ts:92](https://github.com/isdk/ai-tool.js/blob/
|
|
171
|
+
[packages/ai-tool/src/utils/prompt/prompt-example-selector.ts:92](https://github.com/isdk/ai-tool.js/blob/5f9f0083c734722103ff5468e424b48c212a55f0/src/utils/prompt/prompt-example-selector.ts#L92)
|
|
184
172
|
|
|
185
|
-
|
|
173
|
+
***
|
|
186
174
|
|
|
187
|
-
### selectExamples
|
|
175
|
+
### selectExamples()
|
|
188
176
|
|
|
189
|
-
|
|
177
|
+
> **selectExamples**(`examples`): `AsyncGenerator`\<`Awaited`\<`T`\>, `void`, `unknown`\>
|
|
190
178
|
|
|
191
179
|
Asynchronously selects examples from the given examples, applying the configured threshold (if any).
|
|
192
180
|
|
|
193
181
|
#### Parameters
|
|
194
182
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
183
|
+
• **examples**: [`PromptExamples`](../type-aliases/PromptExamples.md)\<`T`\> = `...`
|
|
184
|
+
|
|
185
|
+
The examples to select from. Defaults to the selector's examples if not provided.
|
|
198
186
|
|
|
199
187
|
#### Returns
|
|
200
188
|
|
|
@@ -204,4 +192,4 @@ An asynchronous iterator yielding selected examples.
|
|
|
204
192
|
|
|
205
193
|
#### Defined in
|
|
206
194
|
|
|
207
|
-
[packages/ai-tool/src/utils/prompt/prompt-example-selector.ts:103](https://github.com/isdk/ai-tool.js/blob/
|
|
195
|
+
[packages/ai-tool/src/utils/prompt/prompt-example-selector.ts:103](https://github.com/isdk/ai-tool.js/blob/5f9f0083c734722103ff5468e424b48c212a55f0/src/utils/prompt/prompt-example-selector.ts#L103)
|