@isdk/ai-tool 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-4FKBOPZI.mjs +1 -0
- package/dist/{chunk-VIG2GB47.mjs → chunk-TGTHY57V.mjs} +1 -1
- package/dist/funcs.d.mts +1 -2
- package/dist/funcs.d.ts +1 -2
- package/dist/funcs.js +1 -1
- package/dist/funcs.mjs +1 -1
- package/dist/{index-BCco-g_I.d.mts → index-BLW3R7VS.d.mts} +114 -69
- package/dist/{index-BCco-g_I.d.ts → index-BLW3R7VS.d.ts} +114 -69
- package/dist/index.d.mts +101 -38
- package/dist/index.d.ts +101 -38
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/test/util.js +1 -1
- package/dist/test/util.mjs +1 -1
- package/docs/api/{namespaces → @isdk/namespaces}/EventStates/README.md +2 -2
- package/docs/api/{namespaces → @isdk/namespaces}/EventStates/variables/ABORT.md +2 -2
- package/docs/api/{namespaces → @isdk/namespaces}/EventStates/variables/CONTINUE.md +2 -2
- package/docs/api/{namespaces → @isdk/namespaces}/EventStates/variables/DONE.md +2 -2
- package/docs/api/{namespaces → @isdk/namespaces}/EventStates/variables/STOPPED.md +2 -2
- package/docs/api/@isdk/namespaces/uuidv5/README.md +12 -0
- package/docs/api/{namespaces → @isdk/namespaces}/uuidv5/variables/DNS.md +2 -2
- package/docs/api/{namespaces → @isdk/namespaces}/uuidv5/variables/URL.md +2 -2
- package/docs/api/_media/pubsub.md +427 -105
- package/docs/api/_media/server_client_tools.md +5 -3
- package/docs/api/_media/toolFunc.md +3 -1
- package/docs/api/classes/AbortError.md +8 -8
- package/docs/api/classes/AlreadyExistsError.md +8 -8
- package/docs/api/classes/BaseError.md +14 -14
- package/docs/api/classes/BinarySemaphore.md +39 -39
- package/docs/api/classes/CancelableAbility.md +43 -39
- package/docs/api/classes/ClientToolTransport.md +22 -22
- package/docs/api/classes/ClientTools.md +182 -154
- package/docs/api/classes/CommonError.md +12 -12
- package/docs/api/classes/ConfigFile.md +6 -6
- package/docs/api/classes/EnvPromptTemplate.md +14 -14
- package/docs/api/classes/EventClient.md +258 -201
- package/docs/api/classes/EventEmitter.md +14 -14
- package/docs/api/classes/EventServer.md +220 -237
- package/docs/api/classes/EventToolFunc.md +144 -116
- package/docs/api/classes/FStringPromptTemplate.md +14 -14
- package/docs/api/classes/FewShotPromptTemplate.md +30 -26
- package/docs/api/classes/GolangPromptTemplate.md +13 -13
- package/docs/api/classes/HttpClientToolTransport.md +23 -23
- package/docs/api/classes/HttpServerToolTransport.md +40 -27
- package/docs/api/classes/IntSet.md +21 -21
- package/docs/api/classes/LRUCache.md +18 -18
- package/docs/api/classes/NotFoundError.md +8 -8
- package/docs/api/classes/NotImplementationError.md +8 -8
- package/docs/api/classes/PromptExampleSelector.md +17 -15
- package/docs/api/classes/PromptTemplate.md +15 -15
- package/docs/api/classes/ReadableStreamError.md +12 -12
- package/docs/api/classes/ResClientTools.md +658 -143
- package/docs/api/classes/ResServerTools.md +643 -133
- package/docs/api/classes/RpcMethodsClientTool.md +3303 -0
- package/docs/api/classes/RpcMethodsServerTool.md +3248 -0
- package/docs/api/classes/SSEChannel.md +142 -52
- package/docs/api/classes/Semaphore.md +40 -40
- package/docs/api/classes/ServerToolTransport.md +32 -27
- package/docs/api/classes/ServerTools.md +167 -139
- package/docs/api/classes/SignalGate.md +19 -17
- package/docs/api/classes/SseClientPubSubTransport.md +38 -10
- package/docs/api/classes/SseServerPubSubTransport.md +115 -42
- package/docs/api/classes/TaskAbortController.md +13 -13
- package/docs/api/classes/ToolFunc.md +157 -129
- package/docs/api/classes/ToolTransport.md +13 -13
- package/docs/api/classes/YamlTypeBaseObject.md +5 -5
- package/docs/api/enumerations/AsyncFeatureBits.md +4 -4
- package/docs/api/enumerations/AsyncFeatures.md +4 -4
- package/docs/api/enumerations/HashAlgorithm.md +12 -12
- package/docs/api/functions/AIArgProcessor.md +2 -2
- package/docs/api/functions/AIStream.md +8 -4
- package/docs/api/functions/ChoiceArgProcessor.md +2 -2
- package/docs/api/functions/DefaultDateFormat.md +2 -2
- package/docs/api/functions/ObjectArgsToArgsInfo.md +1 -1
- package/docs/api/functions/RateLimit.md +2 -2
- package/docs/api/functions/TemplateArgProcessor.md +2 -2
- package/docs/api/functions/addDate.md +7 -3
- package/docs/api/functions/assignDirs.md +1 -1
- package/docs/api/functions/beforeShutdown.md +1 -1
- package/docs/api/functions/calcPerplexity.md +2 -2
- package/docs/api/functions/calcPerplexitySimple.md +1 -1
- package/docs/api/functions/canonicalize.md +1 -1
- package/docs/api/functions/completeSentences.md +1 -1
- package/docs/api/functions/concatText.md +1 -1
- package/docs/api/functions/countLLMTokens.md +1 -1
- package/docs/api/functions/countRegexMatches.md +1 -1
- package/docs/api/functions/createAbilityInjector.md +16 -8
- package/docs/api/functions/createCallbacksTransformer.md +7 -3
- package/docs/api/functions/createEmptyReadableStream.md +1 -1
- package/docs/api/functions/createEndWithRepetitionDetector.md +2 -2
- package/docs/api/functions/createError.md +1 -1
- package/docs/api/functions/createEventStreamTransformer.md +8 -4
- package/docs/api/functions/createHfValueFunc.md +1 -1
- package/docs/api/functions/createLRUCache.md +2 -2
- package/docs/api/functions/createYamlObjectTag.md +1 -1
- package/docs/api/functions/dateToText.md +1 -1
- package/docs/api/functions/decodeCharset.md +2 -2
- package/docs/api/functions/defaultsWithConcat.md +1 -1
- package/docs/api/functions/detectCharset.md +2 -2
- package/docs/api/functions/encodeLLMTokens.md +1 -1
- package/docs/api/functions/ensureQuoted.md +1 -1
- package/docs/api/functions/eventable.md +6 -8
- package/docs/api/functions/expandConfig.md +2 -2
- package/docs/api/functions/expandObjEnv.md +1 -1
- package/docs/api/functions/expandPath.md +2 -2
- package/docs/api/functions/expandPathInObject.md +2 -2
- package/docs/api/functions/expandPaths.md +2 -2
- package/docs/api/functions/fileIsExists.md +1 -1
- package/docs/api/functions/filterValidFnScope.md +2 -2
- package/docs/api/functions/findIndexNonEmptyFrom.md +1 -1
- package/docs/api/functions/findPort.md +1 -1
- package/docs/api/functions/formatISO.md +1 -1
- package/docs/api/functions/formatTextWithSpace.md +2 -2
- package/docs/api/functions/funcGetMeta.md +1 -1
- package/docs/api/functions/funcWithMeta.md +2 -2
- package/docs/api/functions/genUrlParamsStr.md +8 -2
- package/docs/api/functions/getAllEnumKeys.md +4 -2
- package/docs/api/functions/getConfigFileNames.md +2 -2
- package/docs/api/functions/getConfigs.md +2 -2
- package/docs/api/functions/getFileMetaInfo.md +1 -1
- package/docs/api/functions/getHashAlgoBySize.md +1 -1
- package/docs/api/functions/getKeysPath.md +4 -2
- package/docs/api/functions/getLLMTokenizer.md +1 -1
- package/docs/api/functions/getMultiLevelExtname.md +1 -1
- package/docs/api/functions/getPackageDir.md +1 -1
- package/docs/api/functions/getRealFilepath.md +1 -1
- package/docs/api/functions/getResponseErrorReadableStream.md +2 -2
- package/docs/api/functions/getXDGConfigs.md +1 -1
- package/docs/api/functions/hasDirectoryIn.md +2 -2
- package/docs/api/functions/hash.md +1 -1
- package/docs/api/functions/hashFile.md +2 -2
- package/docs/api/functions/hashObject.md +2 -2
- package/docs/api/functions/hashStream.md +1 -1
- package/docs/api/functions/initShutdown.md +1 -1
- package/docs/api/functions/isLangUsingSpaces.md +1 -1
- package/docs/api/functions/isListItemString.md +1 -1
- package/docs/api/functions/isModelNameMatched.md +2 -2
- package/docs/api/functions/isPunctuationChar.md +1 -1
- package/docs/api/functions/isQuoted.md +1 -1
- package/docs/api/functions/isRegExp.md +1 -1
- package/docs/api/functions/isSameString.md +1 -1
- package/docs/api/functions/isSectionString.md +2 -2
- package/docs/api/functions/isSentenceEnding.md +1 -1
- package/docs/api/functions/isSepLineString.md +1 -1
- package/docs/api/functions/isStrWrapped.md +1 -1
- package/docs/api/functions/isSubdirectory.md +1 -1
- package/docs/api/functions/isTitleString.md +2 -2
- package/docs/api/functions/isWebStream.md +1 -1
- package/docs/api/functions/joinSplitWords.md +1 -1
- package/docs/api/functions/jsonFilterToWhere.md +2 -2
- package/docs/api/functions/jsonToMarkdownStr.md +2 -2
- package/docs/api/functions/loadAIConfig.md +1 -1
- package/docs/api/functions/loadConfig.md +1 -1
- package/docs/api/functions/loadConfigFile.md +1 -1
- package/docs/api/functions/loadFileFromPaths.md +2 -2
- package/docs/api/functions/loadTextFromPaths.md +3 -3
- package/docs/api/functions/lrucache.md +1 -1
- package/docs/api/functions/matchUrlProtocol.md +1 -1
- package/docs/api/functions/memoize.md +5 -3
- package/docs/api/functions/mergeArray.md +1 -1
- package/docs/api/functions/messagesToText.md +1 -1
- package/docs/api/functions/nanoid.md +45 -0
- package/docs/api/functions/normalizePath.md +1 -1
- package/docs/api/functions/paramsSizeToScaleStr.md +1 -1
- package/docs/api/functions/parseCommand.md +3 -3
- package/docs/api/functions/parseDateFormat.md +7 -3
- package/docs/api/functions/parseISO.md +7 -3
- package/docs/api/functions/parseJsJson.md +2 -2
- package/docs/api/functions/parseJsJsonSimpleSync.md +2 -2
- package/docs/api/functions/parseObjectArgInfo.md +2 -2
- package/docs/api/functions/parseObjectArgumentInfos.md +2 -2
- package/docs/api/functions/parseObjectArguments.md +2 -2
- package/docs/api/functions/parseObjectArgumentsAsArgInfos.md +2 -2
- package/docs/api/functions/parseYaml.md +1 -1
- package/docs/api/functions/pruneSubdirectories.md +1 -1
- package/docs/api/functions/pruneSubdirectoriesInPlace.md +1 -1
- package/docs/api/functions/quoteStr.md +1 -1
- package/docs/api/functions/readFilenamesRecursiveSync.md +2 -2
- package/docs/api/functions/readTextFileChunks.md +2 -2
- package/docs/api/functions/readTextFileChunksEx.md +2 -2
- package/docs/api/functions/readableFromAsyncIterable.md +4 -2
- package/docs/api/functions/registerCoreTools.md +1 -1
- package/docs/api/functions/removeMarkdownBold.md +2 -2
- package/docs/api/functions/removeMarkdownBoldAndItalic.md +2 -2
- package/docs/api/functions/removeMarkdownItalic.md +2 -2
- package/docs/api/functions/replaceWithPlaceholder.md +2 -2
- package/docs/api/functions/restoreFromPlacehoders.md +2 -2
- package/docs/api/functions/sanitizeFilename.md +1 -1
- package/docs/api/functions/sanitizeFilepath.md +1 -1
- package/docs/api/functions/saveConfigFile.md +1 -1
- package/docs/api/functions/scaleStrToParamsSize.md +1 -1
- package/docs/api/functions/shutdown.md +1 -1
- package/docs/api/functions/simplifyObjectArguments.md +1 -1
- package/docs/api/functions/sleep.md +1 -1
- package/docs/api/functions/sortedValues.md +4 -2
- package/docs/api/functions/splitChunks.md +2 -2
- package/docs/api/functions/splitParagraph.md +2 -2
- package/docs/api/functions/splitSentence.md +1 -1
- package/docs/api/functions/splitWords.md +1 -1
- package/docs/api/functions/stringifyYaml.md +1 -1
- package/docs/api/functions/stripConsoleColor.md +1 -1
- package/docs/api/functions/textToDate.md +1 -1
- package/docs/api/functions/throwError.md +1 -1
- package/docs/api/functions/toDate.md +7 -3
- package/docs/api/functions/toDateTime.md +1 -1
- package/docs/api/functions/trimStartOfStreamHelper.md +3 -3
- package/docs/api/functions/truncTo.md +1 -1
- package/docs/api/functions/truncateByToken.md +2 -2
- package/docs/api/functions/truncateToTokenLimit.md +2 -2
- package/docs/api/functions/truncateToTokenLimitEx.md +2 -2
- package/docs/api/functions/uuid.md +15 -6
- package/docs/api/functions/uuidStringify.md +1 -1
- package/docs/api/functions/uuidv1.md +5 -3
- package/docs/api/functions/uuidv4.md +5 -3
- package/docs/api/functions/uuidv5.md +5 -3
- package/docs/api/functions/uuidv6.md +61 -0
- package/docs/api/functions/uuidv7.md +61 -0
- package/docs/api/functions/wrapEventEmitter.md +1 -1
- package/docs/api/functions/xxhash.md +1 -1
- package/docs/api/functions/xxhash32.md +1 -1
- package/docs/api/functions/xxhash64.md +1 -1
- package/docs/api/functions/xxhashAsStr.md +1 -1
- package/docs/api/functions/yieldExec.md +1 -1
- package/docs/api/globals.md +17 -6
- package/docs/api/interfaces/AIChatAssistantMessageParam.md +12 -12
- package/docs/api/interfaces/AIChatContentPartImage.md +3 -3
- package/docs/api/interfaces/AIChatContentPartText.md +3 -3
- package/docs/api/interfaces/AIChatMessageParamBase.md +7 -7
- package/docs/api/interfaces/AIChatMessageToolCall.md +4 -4
- package/docs/api/interfaces/AIChatSystemMessageParam.md +9 -9
- package/docs/api/interfaces/AIChatToolChoiceFuncObject.md +3 -3
- package/docs/api/interfaces/AIChatToolChoiceObject.md +2 -2
- package/docs/api/interfaces/AIChatToolFunc.md +5 -5
- package/docs/api/interfaces/AIChatToolFuncParam.md +3 -3
- package/docs/api/interfaces/AIChatToolMessageParam.md +10 -10
- package/docs/api/interfaces/AIChatToolParam.md +2 -2
- package/docs/api/interfaces/AIChatToolTypeObject.md +2 -2
- package/docs/api/interfaces/AIChatUserMessageParam.md +13 -13
- package/docs/api/interfaces/AIChoiceConfig.md +8 -8
- package/docs/api/interfaces/AIResult.md +12 -8
- package/docs/api/interfaces/AIStreamParser.md +8 -6
- package/docs/api/interfaces/AIStreamParserOptions.md +2 -2
- package/docs/api/interfaces/BaseFunc.md +17 -17
- package/docs/api/interfaces/BaseFuncItem.md +15 -15
- package/docs/api/interfaces/BinarySemaphoreAcquireOptions.md +2 -2
- package/docs/api/interfaces/BinarySemaphoreOptions.md +5 -5
- package/docs/api/interfaces/BinarySemaphoreReleaseOptions.md +2 -2
- package/docs/api/interfaces/BinarySemaphoreReleaserFunc.md +3 -3
- package/docs/api/interfaces/CancelableAbilityOptions.md +4 -4
- package/docs/api/interfaces/ClientFuncItem.md +21 -25
- package/docs/api/interfaces/EventClientFuncParams.md +5 -5
- package/docs/api/interfaces/EventServerFuncParams.md +14 -6
- package/docs/api/interfaces/FewShotPromptTemplateOptions.md +9 -7
- package/docs/api/interfaces/FuncItem.md +18 -18
- package/docs/api/interfaces/FuncParam.md +5 -5
- package/docs/api/interfaces/FuncParams.md +1 -1
- package/docs/api/interfaces/Funcs.md +1 -1
- package/docs/api/interfaces/HashAlgoParams.md +4 -4
- package/docs/api/interfaces/IClientToolTransport.md +9 -9
- package/docs/api/interfaces/IFileMetaInfo.md +8 -8
- package/docs/api/interfaces/IPubSubClientTransport.md +31 -7
- package/docs/api/interfaces/IPubSubServerTransport.md +92 -47
- package/docs/api/interfaces/IReadTextFileChunksOptions.md +13 -13
- package/docs/api/interfaces/IServerToolTransport.md +19 -14
- package/docs/api/interfaces/IToolTransport.md +6 -6
- package/docs/api/interfaces/ITruncateToTokenLimitOptions.md +11 -11
- package/docs/api/interfaces/JsonFilter.md +1 -1
- package/docs/api/interfaces/ParseObjectArgumentOptions.md +11 -11
- package/docs/api/interfaces/ProbabilityItem.md +4 -4
- package/docs/api/interfaces/PromptExampleSelectorOptions.md +3 -3
- package/docs/api/interfaces/PubSubClientStream.md +26 -14
- package/docs/api/interfaces/PubSubServerSession.md +8 -8
- package/docs/api/interfaces/RemoteFuncItem.md +21 -25
- package/docs/api/interfaces/ReplacePlacehoderOptions.md +5 -5
- package/docs/api/interfaces/ResClientFuncParams.md +5 -5
- package/docs/api/interfaces/ResServerFuncParams.md +14 -10
- package/docs/api/interfaces/RpcMethodsClientFuncParams.md +25 -0
- package/docs/api/interfaces/RpcMethodsServerFuncParams.md +61 -0
- package/docs/api/interfaces/SectionStringOptions.md +3 -3
- package/docs/api/interfaces/SemaphoreOptions.md +7 -7
- package/docs/api/interfaces/SemaphoreTaskItem.md +6 -6
- package/docs/api/interfaces/ServerFuncItem.md +22 -26
- package/docs/api/interfaces/ServerFuncParams.md +4 -3
- package/docs/api/interfaces/SplitSentenceOptions.md +5 -5
- package/docs/api/interfaces/StreamCallbacksAndOptions.md +11 -7
- package/docs/api/interfaces/TaskAbortControllers.md +1 -1
- package/docs/api/interfaces/TaskPromise.md +17 -9
- package/docs/api/interfaces/ToolFuncPackage.md +5 -5
- package/docs/api/type-aliases/AIChatContentPart.md +2 -2
- package/docs/api/type-aliases/AIChatMessageParam.md +2 -2
- package/docs/api/type-aliases/AIChatRole.md +2 -2
- package/docs/api/type-aliases/AIChatToolChoiceParam.md +2 -2
- package/docs/api/type-aliases/AIMessageType.md +2 -2
- package/docs/api/type-aliases/AIModelNameRule.md +2 -2
- package/docs/api/type-aliases/AIModelNameRuleFn.md +2 -2
- package/docs/api/type-aliases/AIModelNameRules.md +2 -2
- package/docs/api/type-aliases/AITextGenerationFinishReason.md +2 -2
- package/docs/api/type-aliases/ActionName.md +2 -2
- package/docs/api/type-aliases/ArrayMergeWay.md +2 -2
- package/docs/api/type-aliases/AsyncTaskId.md +2 -2
- package/docs/api/type-aliases/BeforeShutdownListener.md +2 -2
- package/docs/api/type-aliases/EventErrorListenerFn.md +2 -2
- package/docs/api/type-aliases/EventListenerFn.md +2 -2
- package/docs/api/type-aliases/FuncParamType.md +2 -2
- package/docs/api/type-aliases/PromptExamples.md +5 -3
- package/docs/api/type-aliases/PubSubClientId.md +2 -2
- package/docs/api/type-aliases/PubSubCtx.md +24 -4
- package/docs/api/type-aliases/RpcMethodHandler.md +2 -2
- package/docs/api/type-aliases/SSEClient.md +53 -0
- package/docs/api/type-aliases/SemaphoreIsReadyFuncType.md +2 -2
- package/docs/api/type-aliases/TFunc.md +2 -2
- package/docs/api/type-aliases/UUIDVersions.md +11 -0
- package/docs/api/variables/AIChatRoles.md +1 -1
- package/docs/api/variables/AIMessageTypes.md +1 -1
- package/docs/api/variables/AITextGenerationFinishReasons.md +1 -1
- package/docs/api/variables/ActionNames.md +1 -1
- package/docs/api/variables/ArrayMergeWay.md +2 -2
- package/docs/api/variables/ArrayMergeWaySymbol.md +2 -2
- package/docs/api/variables/ClientEventPrefix.md +11 -0
- package/docs/api/variables/ClientToolFuncSchema.md +4 -2
- package/docs/api/variables/DEFAULT_CONFIG_NAME.md +1 -1
- package/docs/api/variables/DefaultAsyncSemaphoreCapacity.md +1 -1
- package/docs/api/variables/EventBusName.md +1 -1
- package/docs/api/variables/EventName.md +1 -1
- package/docs/api/variables/FuncMetaSymbol.md +2 -2
- package/docs/api/variables/LLM_TOKENIZER_NAMES.md +4 -4
- package/docs/api/variables/LLM_TOKENIZER_NAMES_MAP.md +1 -1
- package/docs/api/variables/PASSING_SCORE.md +1 -1
- package/docs/api/variables/RStreamErrCode.md +1 -1
- package/docs/api/variables/RemoteToolFuncSchema.md +4 -2
- package/docs/api/variables/ResponseRStreamErrCode.md +1 -1
- package/docs/api/variables/RpcMethodsClientToolSchema.md +51 -0
- package/docs/api/variables/RpcMethodsServerToolSchema.md +21 -0
- package/docs/api/variables/SHUTDOWN_SIGNALS.md +1 -1
- package/docs/api/variables/SSEChannelAlreadyClosedErrCode.md +1 -1
- package/docs/api/variables/SecondaryCache.md +1 -1
- package/docs/api/variables/ServerToolFuncSchema.md +4 -2
- package/docs/api/variables/StrangeHumanName.md +1 -1
- package/docs/api/variables/ToolAsyncCancelableBit.md +1 -1
- package/docs/api/variables/ToolAsyncMultiTaskBit.md +1 -1
- package/docs/api/variables/ToolAsyncPriorityBit.md +1 -1
- package/docs/api/variables/ToolFuncSchema.md +4 -2
- package/docs/api/variables/backendEventable.md +11 -0
- package/docs/api/variables/base32768.md +1 -1
- package/docs/api/variables/event.md +1 -1
- package/docs/api/variables/eventClient.md +1 -1
- package/docs/api/variables/eventServer.md +1 -1
- package/docs/api/variables/lrucache.md +1 -1
- package/docs/api/variables/makeToolFuncCancelable.md +11 -0
- package/docs/api/{functions → variables}/wait.md +16 -14
- package/docs/pubsub.md +427 -105
- package/docs/server_client_tools.md +5 -3
- package/docs/toolFunc.md +3 -1
- package/package.json +10 -9
- package/dist/chunk-LNTIQQNN.mjs +0 -1
- package/docs/api/functions/backendEventable.md +0 -29
- package/docs/api/functions/makeToolFuncCancelable.md +0 -29
- package/docs/api/interfaces/PubSubClient.md +0 -27
- package/docs/api/namespaces/uuidv5/README.md +0 -12
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
# Class: PromptExampleSelector\<T\>
|
|
8
8
|
|
|
9
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/prompt/prompt-example-selector.ts:46](https://github.com/isdk/ai-tool.js/blob/
|
|
9
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/prompt/prompt-example-selector.ts:46](https://github.com/isdk/ai-tool.js/blob/d0765f898f217d97c57c6949502b4a7bef5dce5e/src/utils/prompt/prompt-example-selector.ts#L46)
|
|
10
10
|
|
|
11
11
|
The `PromptExampleSelector` class provides a mechanism to selectively choose examples from a given set based on
|
|
12
12
|
configurable options such as maximum length and probability threshold. This class is meant to be extended and customized
|
|
@@ -36,17 +36,19 @@ for await (const selectedExample of selector) {
|
|
|
36
36
|
|
|
37
37
|
## Type Parameters
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
### T
|
|
40
|
+
|
|
41
|
+
`T` = `any`
|
|
40
42
|
|
|
41
43
|
The type of the prompt examples.
|
|
42
44
|
|
|
43
45
|
## Constructors
|
|
44
46
|
|
|
45
|
-
###
|
|
47
|
+
### Constructor
|
|
46
48
|
|
|
47
|
-
> **new PromptExampleSelector**\<`T`\>(`examples`, `options
|
|
49
|
+
> **new PromptExampleSelector**\<`T`\>(`examples`, `options?`): `PromptExampleSelector`\<`T`\>
|
|
48
50
|
|
|
49
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/prompt/prompt-example-selector.ts:62](https://github.com/isdk/ai-tool.js/blob/
|
|
51
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/prompt/prompt-example-selector.ts:62](https://github.com/isdk/ai-tool.js/blob/d0765f898f217d97c57c6949502b4a7bef5dce5e/src/utils/prompt/prompt-example-selector.ts#L62)
|
|
50
52
|
|
|
51
53
|
Constructs a new `PromptExampleSelector` instance with the given examples and options.
|
|
52
54
|
|
|
@@ -66,7 +68,7 @@ An optional configuration object.
|
|
|
66
68
|
|
|
67
69
|
#### Returns
|
|
68
70
|
|
|
69
|
-
|
|
71
|
+
`PromptExampleSelector`\<`T`\>
|
|
70
72
|
|
|
71
73
|
## Properties
|
|
72
74
|
|
|
@@ -74,7 +76,7 @@ An optional configuration object.
|
|
|
74
76
|
|
|
75
77
|
> **examples**: [`PromptExamples`](../type-aliases/PromptExamples.md)\<`T`\>
|
|
76
78
|
|
|
77
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/prompt/prompt-example-selector.ts:55](https://github.com/isdk/ai-tool.js/blob/
|
|
79
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/prompt/prompt-example-selector.ts:55](https://github.com/isdk/ai-tool.js/blob/d0765f898f217d97c57c6949502b4a7bef5dce5e/src/utils/prompt/prompt-example-selector.ts#L55)
|
|
78
80
|
|
|
79
81
|
The collection of prompt examples.
|
|
80
82
|
|
|
@@ -84,7 +86,7 @@ The collection of prompt examples.
|
|
|
84
86
|
|
|
85
87
|
> **maxLength**: `undefined` \| `number`
|
|
86
88
|
|
|
87
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/prompt/prompt-example-selector.ts:47](https://github.com/isdk/ai-tool.js/blob/
|
|
89
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/prompt/prompt-example-selector.ts:47](https://github.com/isdk/ai-tool.js/blob/d0765f898f217d97c57c6949502b4a7bef5dce5e/src/utils/prompt/prompt-example-selector.ts#L47)
|
|
88
90
|
|
|
89
91
|
***
|
|
90
92
|
|
|
@@ -92,7 +94,7 @@ Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/prompt/prompt-example-sel
|
|
|
92
94
|
|
|
93
95
|
> **threshold**: `undefined` \| `number`
|
|
94
96
|
|
|
95
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/prompt/prompt-example-selector.ts:51](https://github.com/isdk/ai-tool.js/blob/
|
|
97
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/prompt/prompt-example-selector.ts:51](https://github.com/isdk/ai-tool.js/blob/d0765f898f217d97c57c6949502b4a7bef5dce5e/src/utils/prompt/prompt-example-selector.ts#L51)
|
|
96
98
|
|
|
97
99
|
The probability threshold (0-1) for selecting an example. If `undefined`, no filtering by probability occurs.
|
|
98
100
|
|
|
@@ -102,7 +104,7 @@ The probability threshold (0-1) for selecting an example. If `undefined`, no fil
|
|
|
102
104
|
|
|
103
105
|
> **\[asyncIterator\]**(): `AsyncGenerator`\<`Awaited`\<`T`\>, `void`, `unknown`\>
|
|
104
106
|
|
|
105
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/prompt/prompt-example-selector.ts:119](https://github.com/isdk/ai-tool.js/blob/
|
|
107
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/prompt/prompt-example-selector.ts:119](https://github.com/isdk/ai-tool.js/blob/d0765f898f217d97c57c6949502b4a7bef5dce5e/src/utils/prompt/prompt-example-selector.ts#L119)
|
|
106
108
|
|
|
107
109
|
Returns an asynchronous iterator for the selected examples.
|
|
108
110
|
|
|
@@ -116,9 +118,9 @@ An asynchronous iterator over the selected examples.
|
|
|
116
118
|
|
|
117
119
|
### initialize()
|
|
118
120
|
|
|
119
|
-
> **initialize**(`examples`, `options
|
|
121
|
+
> **initialize**(`examples`, `options?`): `void`
|
|
120
122
|
|
|
121
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/prompt/prompt-example-selector.ts:71](https://github.com/isdk/ai-tool.js/blob/
|
|
123
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/prompt/prompt-example-selector.ts:71](https://github.com/isdk/ai-tool.js/blob/d0765f898f217d97c57c6949502b4a7bef5dce5e/src/utils/prompt/prompt-example-selector.ts#L71)
|
|
122
124
|
|
|
123
125
|
Initializes the selector with examples and options.
|
|
124
126
|
|
|
@@ -144,9 +146,9 @@ An optional configuration object.
|
|
|
144
146
|
|
|
145
147
|
### selectExample()
|
|
146
148
|
|
|
147
|
-
> **selectExample**(`example`, `threshold
|
|
149
|
+
> **selectExample**(`example`, `threshold?`): `void` \| `T`
|
|
148
150
|
|
|
149
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/prompt/prompt-example-selector.ts:92](https://github.com/isdk/ai-tool.js/blob/
|
|
151
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/prompt/prompt-example-selector.ts:92](https://github.com/isdk/ai-tool.js/blob/d0765f898f217d97c57c6949502b4a7bef5dce5e/src/utils/prompt/prompt-example-selector.ts#L92)
|
|
150
152
|
|
|
151
153
|
Select an example. Can overwrite this in subclasses.
|
|
152
154
|
|
|
@@ -176,7 +178,7 @@ The selected example, or `undefined` if not selected.
|
|
|
176
178
|
|
|
177
179
|
> **selectExamples**(`examples`): `AsyncGenerator`\<`Awaited`\<`T`\>, `void`, `unknown`\>
|
|
178
180
|
|
|
179
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/prompt/prompt-example-selector.ts:103](https://github.com/isdk/ai-tool.js/blob/
|
|
181
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/prompt/prompt-example-selector.ts:103](https://github.com/isdk/ai-tool.js/blob/d0765f898f217d97c57c6949502b4a7bef5dce5e/src/utils/prompt/prompt-example-selector.ts#L103)
|
|
180
182
|
|
|
181
183
|
Asynchronously selects examples from the given examples, applying the configured threshold (if any).
|
|
182
184
|
|
|
@@ -41,16 +41,16 @@ console.log(result); // Output: "Formatted: Hello World"
|
|
|
41
41
|
|
|
42
42
|
## Extended by
|
|
43
43
|
|
|
44
|
+
- [`FewShotPromptTemplate`](FewShotPromptTemplate.md)
|
|
44
45
|
- [`EnvPromptTemplate`](EnvPromptTemplate.md)
|
|
45
46
|
- [`FStringPromptTemplate`](FStringPromptTemplate.md)
|
|
46
47
|
- [`GolangPromptTemplate`](GolangPromptTemplate.md)
|
|
47
|
-
- [`FewShotPromptTemplate`](FewShotPromptTemplate.md)
|
|
48
48
|
|
|
49
49
|
## Constructors
|
|
50
50
|
|
|
51
|
-
###
|
|
51
|
+
### Constructor
|
|
52
52
|
|
|
53
|
-
> **new PromptTemplate**(`template
|
|
53
|
+
> **new PromptTemplate**(`template?`, `options?`): `StringTemplate`
|
|
54
54
|
|
|
55
55
|
Defined in: @isdk/ai-tools/packages/template-engines/dist/index.d.ts:187
|
|
56
56
|
|
|
@@ -72,7 +72,7 @@ Additional configuration options for the template.
|
|
|
72
72
|
|
|
73
73
|
#### Returns
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
`StringTemplate`
|
|
76
76
|
|
|
77
77
|
#### Example
|
|
78
78
|
|
|
@@ -324,7 +324,7 @@ A formatted string or a promise resolving to the formatted string.
|
|
|
324
324
|
|
|
325
325
|
### \_initialize()
|
|
326
326
|
|
|
327
|
-
> **\_initialize**(`options
|
|
327
|
+
> **\_initialize**(`options?`): `void`
|
|
328
328
|
|
|
329
329
|
Defined in: @isdk/ai-tools/packages/template-engines/dist/index.d.ts:192
|
|
330
330
|
|
|
@@ -380,7 +380,7 @@ console.log(filteredData); // Output: { name: "Alice" }
|
|
|
380
380
|
|
|
381
381
|
### format()
|
|
382
382
|
|
|
383
|
-
> **format**(`data
|
|
383
|
+
> **format**(`data?`): `Promise`\<`string`\>
|
|
384
384
|
|
|
385
385
|
Defined in: @isdk/ai-tools/packages/template-engines/dist/index.d.ts:219
|
|
386
386
|
|
|
@@ -415,7 +415,7 @@ console.log(result); // Output: "Hello"
|
|
|
415
415
|
|
|
416
416
|
### initialize()
|
|
417
417
|
|
|
418
|
-
> **initialize**(`options
|
|
418
|
+
> **initialize**(`options?`): `void`
|
|
419
419
|
|
|
420
420
|
Defined in: @isdk/ai-tools/packages/template-engines/dist/index.d.ts:197
|
|
421
421
|
|
|
@@ -441,7 +441,7 @@ Configuration options for initialization.
|
|
|
441
441
|
|
|
442
442
|
### partial()
|
|
443
443
|
|
|
444
|
-
> **partial**(`data`):
|
|
444
|
+
> **partial**(`data`): `StringTemplate`
|
|
445
445
|
|
|
446
446
|
Defined in: @isdk/ai-tools/packages/template-engines/dist/index.d.ts:247
|
|
447
447
|
|
|
@@ -458,7 +458,7 @@ The partial data to pre-fill in the new template.
|
|
|
458
458
|
|
|
459
459
|
#### Returns
|
|
460
460
|
|
|
461
|
-
|
|
461
|
+
`StringTemplate`
|
|
462
462
|
|
|
463
463
|
A new `StringTemplate` instance with the partial data applied.
|
|
464
464
|
|
|
@@ -488,7 +488,7 @@ console.log(dateResult.date instanceof Date); // Output: true
|
|
|
488
488
|
|
|
489
489
|
### toJSON()
|
|
490
490
|
|
|
491
|
-
> **toJSON**(`options
|
|
491
|
+
> **toJSON**(`options?`): [`PromptTemplateOptions`](../interfaces/PromptTemplateOptions.md)
|
|
492
492
|
|
|
493
493
|
Defined in: @isdk/ai-tools/packages/template-engines/dist/index.d.ts:264
|
|
494
494
|
|
|
@@ -574,7 +574,7 @@ Defined in: @isdk/ai-tools/node\_modules/.pnpm/custom-factory@2.3.0/node\_module
|
|
|
574
574
|
|
|
575
575
|
### \_register()
|
|
576
576
|
|
|
577
|
-
> `static` **\_register**(`aClass`, `aOptions
|
|
577
|
+
> `static` **\_register**(`aClass`, `aOptions?`): `boolean`
|
|
578
578
|
|
|
579
579
|
Defined in: @isdk/ai-tools/node\_modules/.pnpm/custom-factory@2.3.0/node\_modules/custom-factory/lib/base-factory.d.ts:145
|
|
580
580
|
|
|
@@ -813,7 +813,7 @@ defaults to returning the name unchanged. By overloading this method, case-insen
|
|
|
813
813
|
|
|
814
814
|
### formatNameFromClass()
|
|
815
815
|
|
|
816
|
-
> `static` **formatNameFromClass**(`aClass`, `aBaseNameOnly
|
|
816
|
+
> `static` **formatNameFromClass**(`aClass`, `aBaseNameOnly?`): `string`
|
|
817
817
|
|
|
818
818
|
Defined in: @isdk/ai-tools/node\_modules/.pnpm/custom-factory@2.3.0/node\_modules/custom-factory/lib/base-factory.d.ts:130
|
|
819
819
|
|
|
@@ -845,7 +845,7 @@ the name to register
|
|
|
845
845
|
|
|
846
846
|
### from()
|
|
847
847
|
|
|
848
|
-
> `static` **from**(`template
|
|
848
|
+
> `static` **from**(`template?`, `options?`): `StringTemplate`
|
|
849
849
|
|
|
850
850
|
Defined in: @isdk/ai-tools/packages/template-engines/dist/index.d.ts:86
|
|
851
851
|
|
|
@@ -867,7 +867,7 @@ Additional configuration options for the template.
|
|
|
867
867
|
|
|
868
868
|
#### Returns
|
|
869
869
|
|
|
870
|
-
|
|
870
|
+
`StringTemplate`
|
|
871
871
|
|
|
872
872
|
A new `StringTemplate` instance.
|
|
873
873
|
|
|
@@ -1075,7 +1075,7 @@ console.log(isValid); // Output: true
|
|
|
1075
1075
|
|
|
1076
1076
|
### matchTemplateSegment()
|
|
1077
1077
|
|
|
1078
|
-
> `static` **matchTemplateSegment**(`templateOpt`, `index
|
|
1078
|
+
> `static` **matchTemplateSegment**(`templateOpt`, `index?`): `undefined` \| `RegExpExecArray`
|
|
1079
1079
|
|
|
1080
1080
|
Defined in: @isdk/ai-tools/packages/template-engines/dist/index.d.ts:157
|
|
1081
1081
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
# Class: ReadableStreamError
|
|
8
8
|
|
|
9
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/stream/error-readable-stream.ts:6](https://github.com/isdk/ai-tool.js/blob/
|
|
9
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/stream/error-readable-stream.ts:6](https://github.com/isdk/ai-tool.js/blob/d0765f898f217d97c57c6949502b4a7bef5dce5e/src/utils/stream/error-readable-stream.ts#L6)
|
|
10
10
|
|
|
11
11
|
BaseError class that extends the Error class.
|
|
12
12
|
|
|
@@ -43,11 +43,11 @@ fromJSON - Creates a new BaseError instance from a JSON representation.
|
|
|
43
43
|
|
|
44
44
|
## Constructors
|
|
45
45
|
|
|
46
|
-
###
|
|
46
|
+
### Constructor
|
|
47
47
|
|
|
48
|
-
> **new ReadableStreamError**(`msg`, `code`):
|
|
48
|
+
> **new ReadableStreamError**(`msg`, `code`): `ReadableStreamError`
|
|
49
49
|
|
|
50
|
-
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/stream/error-readable-stream.ts:7](https://github.com/isdk/ai-tool.js/blob/
|
|
50
|
+
Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/stream/error-readable-stream.ts:7](https://github.com/isdk/ai-tool.js/blob/d0765f898f217d97c57c6949502b4a7bef5dce5e/src/utils/stream/error-readable-stream.ts#L7)
|
|
51
51
|
|
|
52
52
|
#### Parameters
|
|
53
53
|
|
|
@@ -61,11 +61,11 @@ Defined in: [@isdk/ai-tools/packages/ai-tool/src/utils/stream/error-readable-str
|
|
|
61
61
|
|
|
62
62
|
#### Returns
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
`ReadableStreamError`
|
|
65
65
|
|
|
66
66
|
#### Overrides
|
|
67
67
|
|
|
68
|
-
[`BaseError`](BaseError.md).[`constructor`](BaseError.md#
|
|
68
|
+
[`BaseError`](BaseError.md).[`constructor`](BaseError.md#constructor)
|
|
69
69
|
|
|
70
70
|
## Properties
|
|
71
71
|
|
|
@@ -105,7 +105,7 @@ the error code
|
|
|
105
105
|
|
|
106
106
|
#### Inherited from
|
|
107
107
|
|
|
108
|
-
[`BaseError`](BaseError.md).[`code`](BaseError.md#code
|
|
108
|
+
[`BaseError`](BaseError.md).[`code`](BaseError.md#code)
|
|
109
109
|
|
|
110
110
|
***
|
|
111
111
|
|
|
@@ -131,7 +131,7 @@ Defined in: @isdk/ai-tools/node\_modules/.pnpm/typescript@5.7.3/node\_modules/ty
|
|
|
131
131
|
|
|
132
132
|
#### Inherited from
|
|
133
133
|
|
|
134
|
-
[`BaseError`](BaseError.md).[`message`](BaseError.md#message
|
|
134
|
+
[`BaseError`](BaseError.md).[`message`](BaseError.md#message)
|
|
135
135
|
|
|
136
136
|
***
|
|
137
137
|
|
|
@@ -143,7 +143,7 @@ Defined in: @isdk/ai-tools/node\_modules/.pnpm/typescript@5.7.3/node\_modules/ty
|
|
|
143
143
|
|
|
144
144
|
#### Inherited from
|
|
145
145
|
|
|
146
|
-
[`BaseError`](BaseError.md).[`name`](BaseError.md#name
|
|
146
|
+
[`BaseError`](BaseError.md).[`name`](BaseError.md#name)
|
|
147
147
|
|
|
148
148
|
***
|
|
149
149
|
|
|
@@ -169,7 +169,7 @@ The error code associated with the error.
|
|
|
169
169
|
|
|
170
170
|
#### Inherited from
|
|
171
171
|
|
|
172
|
-
[`BaseError`](BaseError.md).[`code`](BaseError.md#code-
|
|
172
|
+
[`BaseError`](BaseError.md).[`code`](BaseError.md#code-1)
|
|
173
173
|
|
|
174
174
|
***
|
|
175
175
|
|
|
@@ -239,7 +239,7 @@ A JSON representation of the error.
|
|
|
239
239
|
|
|
240
240
|
### captureStackTrace()
|
|
241
241
|
|
|
242
|
-
> `static` **captureStackTrace**(`targetObject`, `constructorOpt
|
|
242
|
+
> `static` **captureStackTrace**(`targetObject`, `constructorOpt?`): `void`
|
|
243
243
|
|
|
244
244
|
Defined in: @isdk/ai-tools/node\_modules/.pnpm/@types+node@24.3.0/node\_modules/@types/node/globals.d.ts:146
|
|
245
245
|
|
|
@@ -345,7 +345,7 @@ Defined in: @isdk/ai-tools/node\_modules/.pnpm/@isdk+common-error@0.2.0/node\_mo
|
|
|
345
345
|
|
|
346
346
|
### createErrorClass()
|
|
347
347
|
|
|
348
|
-
> `static` **createErrorClass**(`aType`, `aErrorCode
|
|
348
|
+
> `static` **createErrorClass**(`aType`, `aErrorCode?`, `ParentErrorClass?`): *typeof* [`BaseError`](BaseError.md)
|
|
349
349
|
|
|
350
350
|
Defined in: @isdk/ai-tools/node\_modules/.pnpm/@isdk+common-error@0.2.0/node\_modules/@isdk/common-error/dist/index.d.ts:66
|
|
351
351
|
|