@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,48 +1,20 @@
|
|
|
1
|
-
[
|
|
1
|
+
[**@isdk/ai-tool**](../README.md) • **Docs**
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
## Table of contents
|
|
6
|
-
|
|
7
|
-
### Constructors
|
|
8
|
-
|
|
9
|
-
- [constructor](HFInterpreter.md#constructor)
|
|
3
|
+
***
|
|
10
4
|
|
|
11
|
-
|
|
5
|
+
[@isdk/ai-tool](../globals.md) / HFInterpreter
|
|
12
6
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
### Methods
|
|
16
|
-
|
|
17
|
-
- [evalProgram](HFInterpreter.md#evalprogram)
|
|
18
|
-
- [evaluate](HFInterpreter.md#evaluate)
|
|
19
|
-
- [evaluateArguments](HFInterpreter.md#evaluatearguments)
|
|
20
|
-
- [evaluateBinaryExpression](HFInterpreter.md#evaluatebinaryexpression)
|
|
21
|
-
- [evaluateBlock](HFInterpreter.md#evaluateblock)
|
|
22
|
-
- [evaluateCallExpression](HFInterpreter.md#evaluatecallexpression)
|
|
23
|
-
- [evaluateFilterExpression](HFInterpreter.md#evaluatefilterexpression)
|
|
24
|
-
- [evaluateFor](HFInterpreter.md#evaluatefor)
|
|
25
|
-
- [evaluateIdentifier](HFInterpreter.md#evaluateidentifier)
|
|
26
|
-
- [evaluateIf](HFInterpreter.md#evaluateif)
|
|
27
|
-
- [evaluateMacro](HFInterpreter.md#evaluatemacro)
|
|
28
|
-
- [evaluateMemberExpression](HFInterpreter.md#evaluatememberexpression)
|
|
29
|
-
- [evaluateSet](HFInterpreter.md#evaluateset)
|
|
30
|
-
- [evaluateSliceExpression](HFInterpreter.md#evaluatesliceexpression)
|
|
31
|
-
- [evaluateTestExpression](HFInterpreter.md#evaluatetestexpression)
|
|
32
|
-
- [evaluateUnaryExpression](HFInterpreter.md#evaluateunaryexpression)
|
|
33
|
-
- [run](HFInterpreter.md#run)
|
|
7
|
+
# Class: HFInterpreter
|
|
34
8
|
|
|
35
9
|
## Constructors
|
|
36
10
|
|
|
37
|
-
###
|
|
11
|
+
### new HFInterpreter()
|
|
38
12
|
|
|
39
|
-
|
|
13
|
+
> **new HFInterpreter**(`env`?): [`HFInterpreter`](HFInterpreter.md)
|
|
40
14
|
|
|
41
15
|
#### Parameters
|
|
42
16
|
|
|
43
|
-
|
|
44
|
-
| :------ | :------ |
|
|
45
|
-
| `env?` | `Environment` |
|
|
17
|
+
• **env?**: `Environment`
|
|
46
18
|
|
|
47
19
|
#### Returns
|
|
48
20
|
|
|
@@ -50,356 +22,29 @@
|
|
|
50
22
|
|
|
51
23
|
#### Defined in
|
|
52
24
|
|
|
53
|
-
[packages/ai-tool/src/utils/prompt/template/jinja/src/runtime.ts:386](https://github.com/isdk/ai-tool.js/blob/
|
|
25
|
+
[packages/ai-tool/src/utils/prompt/template/jinja/src/runtime.ts:386](https://github.com/isdk/ai-tool.js/blob/5f9f0083c734722103ff5468e424b48c212a55f0/src/utils/prompt/template/jinja/src/runtime.ts#L386)
|
|
54
26
|
|
|
55
27
|
## Properties
|
|
56
28
|
|
|
57
29
|
### global
|
|
58
30
|
|
|
59
|
-
|
|
31
|
+
> **global**: `Environment`
|
|
60
32
|
|
|
61
33
|
#### Defined in
|
|
62
34
|
|
|
63
|
-
[packages/ai-tool/src/utils/prompt/template/jinja/src/runtime.ts:384](https://github.com/isdk/ai-tool.js/blob/
|
|
35
|
+
[packages/ai-tool/src/utils/prompt/template/jinja/src/runtime.ts:384](https://github.com/isdk/ai-tool.js/blob/5f9f0083c734722103ff5468e424b48c212a55f0/src/utils/prompt/template/jinja/src/runtime.ts#L384)
|
|
64
36
|
|
|
65
37
|
## Methods
|
|
66
38
|
|
|
67
|
-
###
|
|
68
|
-
|
|
69
|
-
▸ **evalProgram**(`program`, `environment`): `StringValue`
|
|
70
|
-
|
|
71
|
-
#### Parameters
|
|
72
|
-
|
|
73
|
-
| Name | Type |
|
|
74
|
-
| :------ | :------ |
|
|
75
|
-
| `program` | `Program` |
|
|
76
|
-
| `environment` | `Environment` |
|
|
77
|
-
|
|
78
|
-
#### Returns
|
|
79
|
-
|
|
80
|
-
`StringValue`
|
|
81
|
-
|
|
82
|
-
#### Defined in
|
|
83
|
-
|
|
84
|
-
[packages/ai-tool/src/utils/prompt/template/jinja/src/runtime.ts:773](https://github.com/isdk/ai-tool.js/blob/c5e620338f3b80d6ef09148577c5087098896d8b/src/utils/prompt/template/jinja/src/runtime.ts#L773)
|
|
85
|
-
|
|
86
|
-
___
|
|
87
|
-
|
|
88
|
-
### evaluate
|
|
89
|
-
|
|
90
|
-
▸ **evaluate**(`statement`, `environment`): `AnyRuntimeValue`
|
|
91
|
-
|
|
92
|
-
#### Parameters
|
|
93
|
-
|
|
94
|
-
| Name | Type |
|
|
95
|
-
| :------ | :------ |
|
|
96
|
-
| `statement` | `undefined` \| `Statement` |
|
|
97
|
-
| `environment` | `Environment` |
|
|
98
|
-
|
|
99
|
-
#### Returns
|
|
100
|
-
|
|
101
|
-
`AnyRuntimeValue`
|
|
102
|
-
|
|
103
|
-
#### Defined in
|
|
104
|
-
|
|
105
|
-
[packages/ai-tool/src/utils/prompt/template/jinja/src/runtime.ts:1063](https://github.com/isdk/ai-tool.js/blob/c5e620338f3b80d6ef09148577c5087098896d8b/src/utils/prompt/template/jinja/src/runtime.ts#L1063)
|
|
106
|
-
|
|
107
|
-
___
|
|
108
|
-
|
|
109
|
-
### evaluateArguments
|
|
39
|
+
### evaluate()
|
|
110
40
|
|
|
111
|
-
|
|
41
|
+
> **evaluate**(`statement`, `environment`): `AnyRuntimeValue`
|
|
112
42
|
|
|
113
43
|
#### Parameters
|
|
114
44
|
|
|
115
|
-
|
|
116
|
-
| :------ | :------ |
|
|
117
|
-
| `args` | `Expression`[] |
|
|
118
|
-
| `environment` | `Environment` |
|
|
119
|
-
|
|
120
|
-
#### Returns
|
|
121
|
-
|
|
122
|
-
[`AnyRuntimeValue`[], `Map`\<`string`, `AnyRuntimeValue`\>]
|
|
123
|
-
|
|
124
|
-
#### Defined in
|
|
125
|
-
|
|
126
|
-
[packages/ai-tool/src/utils/prompt/template/jinja/src/runtime.ts:495](https://github.com/isdk/ai-tool.js/blob/c5e620338f3b80d6ef09148577c5087098896d8b/src/utils/prompt/template/jinja/src/runtime.ts#L495)
|
|
127
|
-
|
|
128
|
-
___
|
|
129
|
-
|
|
130
|
-
### evaluateBinaryExpression
|
|
131
|
-
|
|
132
|
-
▸ **evaluateBinaryExpression**(`node`, `environment`): `AnyRuntimeValue`
|
|
133
|
-
|
|
134
|
-
Evaluates expressions following the binary operation type.
|
|
135
|
-
|
|
136
|
-
#### Parameters
|
|
137
|
-
|
|
138
|
-
| Name | Type |
|
|
139
|
-
| :------ | :------ |
|
|
140
|
-
| `node` | `BinaryExpression` |
|
|
141
|
-
| `environment` | `Environment` |
|
|
142
|
-
|
|
143
|
-
#### Returns
|
|
144
|
-
|
|
145
|
-
`AnyRuntimeValue`
|
|
146
|
-
|
|
147
|
-
#### Defined in
|
|
148
|
-
|
|
149
|
-
[packages/ai-tool/src/utils/prompt/template/jinja/src/runtime.ts:400](https://github.com/isdk/ai-tool.js/blob/c5e620338f3b80d6ef09148577c5087098896d8b/src/utils/prompt/template/jinja/src/runtime.ts#L400)
|
|
150
|
-
|
|
151
|
-
___
|
|
152
|
-
|
|
153
|
-
### evaluateBlock
|
|
154
|
-
|
|
155
|
-
▸ **evaluateBlock**(`statements`, `environment`): `StringValue`
|
|
156
|
-
|
|
157
|
-
#### Parameters
|
|
158
|
-
|
|
159
|
-
| Name | Type |
|
|
160
|
-
| :------ | :------ |
|
|
161
|
-
| `statements` | `Statement`[] |
|
|
162
|
-
| `environment` | `Environment` |
|
|
163
|
-
|
|
164
|
-
#### Returns
|
|
165
|
-
|
|
166
|
-
`StringValue`
|
|
167
|
-
|
|
168
|
-
#### Defined in
|
|
169
|
-
|
|
170
|
-
[packages/ai-tool/src/utils/prompt/template/jinja/src/runtime.ts:777](https://github.com/isdk/ai-tool.js/blob/c5e620338f3b80d6ef09148577c5087098896d8b/src/utils/prompt/template/jinja/src/runtime.ts#L777)
|
|
171
|
-
|
|
172
|
-
___
|
|
173
|
-
|
|
174
|
-
### evaluateCallExpression
|
|
175
|
-
|
|
176
|
-
▸ **evaluateCallExpression**(`expr`, `environment`): `AnyRuntimeValue`
|
|
177
|
-
|
|
178
|
-
#### Parameters
|
|
179
|
-
|
|
180
|
-
| Name | Type |
|
|
181
|
-
| :------ | :------ |
|
|
182
|
-
| `expr` | `CallExpression` |
|
|
183
|
-
| `environment` | `Environment` |
|
|
184
|
-
|
|
185
|
-
#### Returns
|
|
186
|
-
|
|
187
|
-
`AnyRuntimeValue`
|
|
188
|
-
|
|
189
|
-
#### Defined in
|
|
190
|
-
|
|
191
|
-
[packages/ai-tool/src/utils/prompt/template/jinja/src/runtime.ts:797](https://github.com/isdk/ai-tool.js/blob/c5e620338f3b80d6ef09148577c5087098896d8b/src/utils/prompt/template/jinja/src/runtime.ts#L797)
|
|
192
|
-
|
|
193
|
-
___
|
|
194
|
-
|
|
195
|
-
### evaluateFilterExpression
|
|
196
|
-
|
|
197
|
-
▸ **evaluateFilterExpression**(`node`, `environment`): `AnyRuntimeValue`
|
|
198
|
-
|
|
199
|
-
Evaluates expressions following the filter operation type.
|
|
200
|
-
|
|
201
|
-
#### Parameters
|
|
202
|
-
|
|
203
|
-
| Name | Type |
|
|
204
|
-
| :------ | :------ |
|
|
205
|
-
| `node` | `FilterExpression` |
|
|
206
|
-
| `environment` | `Environment` |
|
|
207
|
-
|
|
208
|
-
#### Returns
|
|
209
|
-
|
|
210
|
-
`AnyRuntimeValue`
|
|
211
|
-
|
|
212
|
-
#### Defined in
|
|
213
|
-
|
|
214
|
-
[packages/ai-tool/src/utils/prompt/template/jinja/src/runtime.ts:520](https://github.com/isdk/ai-tool.js/blob/c5e620338f3b80d6ef09148577c5087098896d8b/src/utils/prompt/template/jinja/src/runtime.ts#L520)
|
|
215
|
-
|
|
216
|
-
___
|
|
217
|
-
|
|
218
|
-
### evaluateFor
|
|
219
|
-
|
|
220
|
-
▸ **evaluateFor**(`node`, `environment`): `StringValue`
|
|
221
|
-
|
|
222
|
-
#### Parameters
|
|
223
|
-
|
|
224
|
-
| Name | Type |
|
|
225
|
-
| :------ | :------ |
|
|
226
|
-
| `node` | `For` |
|
|
227
|
-
| `environment` | `Environment` |
|
|
228
|
-
|
|
229
|
-
#### Returns
|
|
230
|
-
|
|
231
|
-
`StringValue`
|
|
232
|
-
|
|
233
|
-
#### Defined in
|
|
234
|
-
|
|
235
|
-
[packages/ai-tool/src/utils/prompt/template/jinja/src/runtime.ts:913](https://github.com/isdk/ai-tool.js/blob/c5e620338f3b80d6ef09148577c5087098896d8b/src/utils/prompt/template/jinja/src/runtime.ts#L913)
|
|
236
|
-
|
|
237
|
-
___
|
|
238
|
-
|
|
239
|
-
### evaluateIdentifier
|
|
240
|
-
|
|
241
|
-
▸ **evaluateIdentifier**(`node`, `environment`): `AnyRuntimeValue`
|
|
242
|
-
|
|
243
|
-
#### Parameters
|
|
244
|
-
|
|
245
|
-
| Name | Type |
|
|
246
|
-
| :------ | :------ |
|
|
247
|
-
| `node` | `Identifier` |
|
|
248
|
-
| `environment` | `Environment` |
|
|
249
|
-
|
|
250
|
-
#### Returns
|
|
251
|
-
|
|
252
|
-
`AnyRuntimeValue`
|
|
253
|
-
|
|
254
|
-
#### Defined in
|
|
255
|
-
|
|
256
|
-
[packages/ai-tool/src/utils/prompt/template/jinja/src/runtime.ts:793](https://github.com/isdk/ai-tool.js/blob/c5e620338f3b80d6ef09148577c5087098896d8b/src/utils/prompt/template/jinja/src/runtime.ts#L793)
|
|
257
|
-
|
|
258
|
-
___
|
|
259
|
-
|
|
260
|
-
### evaluateIf
|
|
261
|
-
|
|
262
|
-
▸ **evaluateIf**(`node`, `environment`): `StringValue`
|
|
263
|
-
|
|
264
|
-
#### Parameters
|
|
265
|
-
|
|
266
|
-
| Name | Type |
|
|
267
|
-
| :------ | :------ |
|
|
268
|
-
| `node` | `If` |
|
|
269
|
-
| `environment` | `Environment` |
|
|
270
|
-
|
|
271
|
-
#### Returns
|
|
272
|
-
|
|
273
|
-
`StringValue`
|
|
274
|
-
|
|
275
|
-
#### Defined in
|
|
276
|
-
|
|
277
|
-
[packages/ai-tool/src/utils/prompt/template/jinja/src/runtime.ts:908](https://github.com/isdk/ai-tool.js/blob/c5e620338f3b80d6ef09148577c5087098896d8b/src/utils/prompt/template/jinja/src/runtime.ts#L908)
|
|
278
|
-
|
|
279
|
-
___
|
|
280
|
-
|
|
281
|
-
### evaluateMacro
|
|
282
|
-
|
|
283
|
-
▸ **evaluateMacro**(`node`, `environment`): `NullValue`
|
|
284
|
-
|
|
285
|
-
See https://jinja.palletsprojects.com/en/3.1.x/templates/#macros for more information.
|
|
286
|
-
|
|
287
|
-
#### Parameters
|
|
288
|
-
|
|
289
|
-
| Name | Type |
|
|
290
|
-
| :------ | :------ |
|
|
291
|
-
| `node` | `Macro` |
|
|
292
|
-
| `environment` | `Environment` |
|
|
293
|
-
|
|
294
|
-
#### Returns
|
|
295
|
-
|
|
296
|
-
`NullValue`
|
|
297
|
-
|
|
298
|
-
#### Defined in
|
|
299
|
-
|
|
300
|
-
[packages/ai-tool/src/utils/prompt/template/jinja/src/runtime.ts:1020](https://github.com/isdk/ai-tool.js/blob/c5e620338f3b80d6ef09148577c5087098896d8b/src/utils/prompt/template/jinja/src/runtime.ts#L1020)
|
|
301
|
-
|
|
302
|
-
___
|
|
303
|
-
|
|
304
|
-
### evaluateMemberExpression
|
|
305
|
-
|
|
306
|
-
▸ **evaluateMemberExpression**(`expr`, `environment`): `AnyRuntimeValue`
|
|
307
|
-
|
|
308
|
-
#### Parameters
|
|
309
|
-
|
|
310
|
-
| Name | Type |
|
|
311
|
-
| :------ | :------ |
|
|
312
|
-
| `expr` | `MemberExpression` |
|
|
313
|
-
| `environment` | `Environment` |
|
|
314
|
-
|
|
315
|
-
#### Returns
|
|
316
|
-
|
|
317
|
-
`AnyRuntimeValue`
|
|
318
|
-
|
|
319
|
-
#### Defined in
|
|
320
|
-
|
|
321
|
-
[packages/ai-tool/src/utils/prompt/template/jinja/src/runtime.ts:844](https://github.com/isdk/ai-tool.js/blob/c5e620338f3b80d6ef09148577c5087098896d8b/src/utils/prompt/template/jinja/src/runtime.ts#L844)
|
|
322
|
-
|
|
323
|
-
___
|
|
324
|
-
|
|
325
|
-
### evaluateSet
|
|
326
|
-
|
|
327
|
-
▸ **evaluateSet**(`node`, `environment`): `NullValue`
|
|
328
|
-
|
|
329
|
-
#### Parameters
|
|
330
|
-
|
|
331
|
-
| Name | Type |
|
|
332
|
-
| :------ | :------ |
|
|
333
|
-
| `node` | `SetStatement` |
|
|
334
|
-
| `environment` | `Environment` |
|
|
335
|
-
|
|
336
|
-
#### Returns
|
|
337
|
-
|
|
338
|
-
`NullValue`
|
|
339
|
-
|
|
340
|
-
#### Defined in
|
|
341
|
-
|
|
342
|
-
[packages/ai-tool/src/utils/prompt/template/jinja/src/runtime.ts:885](https://github.com/isdk/ai-tool.js/blob/c5e620338f3b80d6ef09148577c5087098896d8b/src/utils/prompt/template/jinja/src/runtime.ts#L885)
|
|
343
|
-
|
|
344
|
-
___
|
|
345
|
-
|
|
346
|
-
### evaluateSliceExpression
|
|
347
|
-
|
|
348
|
-
▸ **evaluateSliceExpression**(`object`, `expr`, `environment`): `StringValue` \| `ArrayValue`
|
|
349
|
-
|
|
350
|
-
#### Parameters
|
|
351
|
-
|
|
352
|
-
| Name | Type |
|
|
353
|
-
| :------ | :------ |
|
|
354
|
-
| `object` | `AnyRuntimeValue` |
|
|
355
|
-
| `expr` | `SliceExpression` |
|
|
356
|
-
| `environment` | `Environment` |
|
|
357
|
-
|
|
358
|
-
#### Returns
|
|
359
|
-
|
|
360
|
-
`StringValue` \| `ArrayValue`
|
|
361
|
-
|
|
362
|
-
#### Defined in
|
|
363
|
-
|
|
364
|
-
[packages/ai-tool/src/utils/prompt/template/jinja/src/runtime.ts:813](https://github.com/isdk/ai-tool.js/blob/c5e620338f3b80d6ef09148577c5087098896d8b/src/utils/prompt/template/jinja/src/runtime.ts#L813)
|
|
365
|
-
|
|
366
|
-
___
|
|
367
|
-
|
|
368
|
-
### evaluateTestExpression
|
|
369
|
-
|
|
370
|
-
▸ **evaluateTestExpression**(`node`, `environment`): `BooleanValue`
|
|
371
|
-
|
|
372
|
-
Evaluates expressions following the test operation type.
|
|
373
|
-
|
|
374
|
-
#### Parameters
|
|
375
|
-
|
|
376
|
-
| Name | Type |
|
|
377
|
-
| :------ | :------ |
|
|
378
|
-
| `node` | `TestExpression` |
|
|
379
|
-
| `environment` | `Environment` |
|
|
380
|
-
|
|
381
|
-
#### Returns
|
|
382
|
-
|
|
383
|
-
`BooleanValue`
|
|
384
|
-
|
|
385
|
-
#### Defined in
|
|
386
|
-
|
|
387
|
-
[packages/ai-tool/src/utils/prompt/template/jinja/src/runtime.ts:744](https://github.com/isdk/ai-tool.js/blob/c5e620338f3b80d6ef09148577c5087098896d8b/src/utils/prompt/template/jinja/src/runtime.ts#L744)
|
|
388
|
-
|
|
389
|
-
___
|
|
390
|
-
|
|
391
|
-
### evaluateUnaryExpression
|
|
392
|
-
|
|
393
|
-
▸ **evaluateUnaryExpression**(`node`, `environment`): `AnyRuntimeValue`
|
|
394
|
-
|
|
395
|
-
Evaluates expressions following the unary operation type.
|
|
396
|
-
|
|
397
|
-
#### Parameters
|
|
45
|
+
• **statement**: `undefined` \| `Statement`
|
|
398
46
|
|
|
399
|
-
|
|
400
|
-
| :------ | :------ |
|
|
401
|
-
| `node` | `UnaryExpression` |
|
|
402
|
-
| `environment` | `Environment` |
|
|
47
|
+
• **environment**: `Environment`
|
|
403
48
|
|
|
404
49
|
#### Returns
|
|
405
50
|
|
|
@@ -407,21 +52,19 @@ Evaluates expressions following the unary operation type.
|
|
|
407
52
|
|
|
408
53
|
#### Defined in
|
|
409
54
|
|
|
410
|
-
[packages/ai-tool/src/utils/prompt/template/jinja/src/runtime.ts:
|
|
55
|
+
[packages/ai-tool/src/utils/prompt/template/jinja/src/runtime.ts:1063](https://github.com/isdk/ai-tool.js/blob/5f9f0083c734722103ff5468e424b48c212a55f0/src/utils/prompt/template/jinja/src/runtime.ts#L1063)
|
|
411
56
|
|
|
412
|
-
|
|
57
|
+
***
|
|
413
58
|
|
|
414
|
-
### run
|
|
59
|
+
### run()
|
|
415
60
|
|
|
416
|
-
|
|
61
|
+
> **run**(`program`): `AnyRuntimeValue`
|
|
417
62
|
|
|
418
63
|
Run the program.
|
|
419
64
|
|
|
420
65
|
#### Parameters
|
|
421
66
|
|
|
422
|
-
|
|
423
|
-
| :------ | :------ |
|
|
424
|
-
| `program` | `Program` |
|
|
67
|
+
• **program**: `Program`
|
|
425
68
|
|
|
426
69
|
#### Returns
|
|
427
70
|
|
|
@@ -429,4 +72,4 @@ Run the program.
|
|
|
429
72
|
|
|
430
73
|
#### Defined in
|
|
431
74
|
|
|
432
|
-
[packages/ai-tool/src/utils/prompt/template/jinja/src/runtime.ts:393](https://github.com/isdk/ai-tool.js/blob/
|
|
75
|
+
[packages/ai-tool/src/utils/prompt/template/jinja/src/runtime.ts:393](https://github.com/isdk/ai-tool.js/blob/5f9f0083c734722103ff5468e424b48c212a55f0/src/utils/prompt/template/jinja/src/runtime.ts#L393)
|
|
@@ -1,34 +1,24 @@
|
|
|
1
|
-
[
|
|
1
|
+
[**@isdk/ai-tool**](../README.md) • **Docs**
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
## Table of contents
|
|
6
|
-
|
|
7
|
-
### Constructors
|
|
8
|
-
|
|
9
|
-
- [constructor](HFTemplate.md#constructor)
|
|
10
|
-
|
|
11
|
-
### Properties
|
|
3
|
+
***
|
|
12
4
|
|
|
13
|
-
-
|
|
14
|
-
- [global](HFTemplate.md#global)
|
|
5
|
+
[@isdk/ai-tool](../globals.md) / HFTemplate
|
|
15
6
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
- [render](HFTemplate.md#render)
|
|
7
|
+
# Class: HFTemplate
|
|
19
8
|
|
|
20
9
|
## Constructors
|
|
21
10
|
|
|
22
|
-
###
|
|
11
|
+
### new HFTemplate()
|
|
23
12
|
|
|
24
|
-
|
|
13
|
+
> **new HFTemplate**(`template`, `options`): [`HFTemplate`](HFTemplate.md)
|
|
25
14
|
|
|
26
15
|
#### Parameters
|
|
27
16
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
17
|
+
• **template**: `string`
|
|
18
|
+
|
|
19
|
+
The template string
|
|
20
|
+
|
|
21
|
+
• **options**: `PreprocessOptions` = `{}`
|
|
32
22
|
|
|
33
23
|
#### Returns
|
|
34
24
|
|
|
@@ -36,39 +26,37 @@
|
|
|
36
26
|
|
|
37
27
|
#### Defined in
|
|
38
28
|
|
|
39
|
-
[packages/ai-tool/src/utils/prompt/template/jinja/src/index.ts:45](https://github.com/isdk/ai-tool.js/blob/
|
|
29
|
+
[packages/ai-tool/src/utils/prompt/template/jinja/src/index.ts:45](https://github.com/isdk/ai-tool.js/blob/5f9f0083c734722103ff5468e424b48c212a55f0/src/utils/prompt/template/jinja/src/index.ts#L45)
|
|
40
30
|
|
|
41
31
|
## Properties
|
|
42
32
|
|
|
43
33
|
### parsed
|
|
44
34
|
|
|
45
|
-
|
|
35
|
+
> **parsed**: `Program`
|
|
46
36
|
|
|
47
37
|
#### Defined in
|
|
48
38
|
|
|
49
|
-
[packages/ai-tool/src/utils/prompt/template/jinja/src/index.ts:38](https://github.com/isdk/ai-tool.js/blob/
|
|
39
|
+
[packages/ai-tool/src/utils/prompt/template/jinja/src/index.ts:38](https://github.com/isdk/ai-tool.js/blob/5f9f0083c734722103ff5468e424b48c212a55f0/src/utils/prompt/template/jinja/src/index.ts#L38)
|
|
50
40
|
|
|
51
|
-
|
|
41
|
+
***
|
|
52
42
|
|
|
53
43
|
### global
|
|
54
44
|
|
|
55
|
-
|
|
45
|
+
> `static` **global**: [`HFEnvironment`](HFEnvironment.md)
|
|
56
46
|
|
|
57
47
|
#### Defined in
|
|
58
48
|
|
|
59
|
-
[packages/ai-tool/src/utils/prompt/template/jinja/src/index.ts:40](https://github.com/isdk/ai-tool.js/blob/
|
|
49
|
+
[packages/ai-tool/src/utils/prompt/template/jinja/src/index.ts:40](https://github.com/isdk/ai-tool.js/blob/5f9f0083c734722103ff5468e424b48c212a55f0/src/utils/prompt/template/jinja/src/index.ts#L40)
|
|
60
50
|
|
|
61
51
|
## Methods
|
|
62
52
|
|
|
63
|
-
### render
|
|
53
|
+
### render()
|
|
64
54
|
|
|
65
|
-
|
|
55
|
+
> **render**(`items`): `string`
|
|
66
56
|
|
|
67
57
|
#### Parameters
|
|
68
58
|
|
|
69
|
-
|
|
70
|
-
| :------ | :------ |
|
|
71
|
-
| `items` | `Record`\<`string`, `unknown`\> |
|
|
59
|
+
• **items**: `Record`\<`string`, `unknown`\>
|
|
72
60
|
|
|
73
61
|
#### Returns
|
|
74
62
|
|
|
@@ -76,4 +64,4 @@ ___
|
|
|
76
64
|
|
|
77
65
|
#### Defined in
|
|
78
66
|
|
|
79
|
-
[packages/ai-tool/src/utils/prompt/template/jinja/src/index.ts:55](https://github.com/isdk/ai-tool.js/blob/
|
|
67
|
+
[packages/ai-tool/src/utils/prompt/template/jinja/src/index.ts:55](https://github.com/isdk/ai-tool.js/blob/5f9f0083c734722103ff5468e424b48c212a55f0/src/utils/prompt/template/jinja/src/index.ts#L55)
|