@mate-academy/llm-gateway 8.8.2 → 8.8.3
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/LLMError.d.ts +12 -0
- package/dist/LLMError.js +36 -0
- package/dist/LLMError.js.map +1 -0
- package/dist/LLMGateway.d.ts +30 -0
- package/dist/LLMGateway.js +56 -0
- package/dist/LLMGateway.js.map +1 -0
- package/dist/LLMGateway.typedefs.d.ts +5 -0
- package/dist/LLMGateway.typedefs.js +3 -0
- package/dist/LLMGateway.typedefs.js.map +1 -0
- package/dist/LLMService.constants.d.ts +26309 -0
- package/dist/LLMService.constants.js +35 -0
- package/dist/LLMService.constants.js.map +1 -0
- package/dist/LLMService.factory.d.ts +71 -0
- package/dist/LLMService.factory.js +102 -0
- package/dist/LLMService.factory.js.map +1 -0
- package/dist/LLMService.typedefs.d.ts +655 -0
- package/dist/LLMService.typedefs.js +72 -0
- package/dist/LLMService.typedefs.js.map +1 -0
- package/dist/advanced.d.ts +11 -0
- package/dist/advanced.js +32 -0
- package/dist/advanced.js.map +1 -0
- package/dist/client/LLMAgent.d.ts +76 -0
- package/dist/client/LLMAgent.js +36 -0
- package/dist/client/LLMAgent.js.map +1 -0
- package/dist/client/LLMClientEngine.d.ts +110 -0
- package/dist/client/LLMClientEngine.js +406 -0
- package/dist/client/LLMClientEngine.js.map +1 -0
- package/dist/client/agentRun.typedefs.d.ts +200 -0
- package/dist/client/agentRun.typedefs.js +25 -0
- package/dist/client/agentRun.typedefs.js.map +1 -0
- package/dist/client/agentRunner.d.ts +161 -0
- package/dist/client/agentRunner.js +517 -0
- package/dist/client/agentRunner.js.map +1 -0
- package/dist/client/codegen/fetchPromptRecords.d.ts +14 -0
- package/dist/client/codegen/fetchPromptRecords.js +90 -0
- package/dist/client/codegen/fetchPromptRecords.js.map +1 -0
- package/dist/client/codegen/generateSnapshot.d.ts +19 -0
- package/dist/client/codegen/generateSnapshot.js +28 -0
- package/dist/client/codegen/generateSnapshot.js.map +1 -0
- package/dist/client/codegen/index.d.ts +6 -0
- package/dist/client/codegen/index.js +23 -0
- package/dist/client/codegen/index.js.map +1 -0
- package/dist/client/codegen/promptCatalog.typedefs.d.ts +51 -0
- package/dist/client/codegen/promptCatalog.typedefs.js +3 -0
- package/dist/client/codegen/promptCatalog.typedefs.js.map +1 -0
- package/dist/client/codegen/promptName.d.ts +8 -0
- package/dist/client/codegen/promptName.js +21 -0
- package/dist/client/codegen/promptName.js.map +1 -0
- package/dist/client/codegen/renderSnapshot.constants.d.ts +7 -0
- package/dist/client/codegen/renderSnapshot.constants.js +16 -0
- package/dist/client/codegen/renderSnapshot.constants.js.map +1 -0
- package/dist/client/codegen/renderSnapshot.d.ts +9 -0
- package/dist/client/codegen/renderSnapshot.js +109 -0
- package/dist/client/codegen/renderSnapshot.js.map +1 -0
- package/dist/client/codegen/renderSnapshot.typedefs.d.ts +19 -0
- package/dist/client/codegen/renderSnapshot.typedefs.js +3 -0
- package/dist/client/codegen/renderSnapshot.typedefs.js.map +1 -0
- package/dist/client/coerceToolResult.d.ts +10 -0
- package/dist/client/coerceToolResult.js +38 -0
- package/dist/client/coerceToolResult.js.map +1 -0
- package/dist/client/createLLMClient.d.ts +10 -0
- package/dist/client/createLLMClient.js +47 -0
- package/dist/client/createLLMClient.js.map +1 -0
- package/dist/client/defineLLMPrompts.d.ts +34 -0
- package/dist/client/defineLLMPrompts.js +13 -0
- package/dist/client/defineLLMPrompts.js.map +1 -0
- package/dist/client/errors.d.ts +57 -0
- package/dist/client/errors.js +70 -0
- package/dist/client/errors.js.map +1 -0
- package/dist/client/index.d.ts +13 -0
- package/dist/client/index.js +30 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/llmClient.typedefs.d.ts +265 -0
- package/dist/client/llmClient.typedefs.js +11 -0
- package/dist/client/llmClient.typedefs.js.map +1 -0
- package/dist/client/llmConfig.schema.d.ts +53 -0
- package/dist/client/llmConfig.schema.js +49 -0
- package/dist/client/llmConfig.schema.js.map +1 -0
- package/dist/client/plainMessages.d.ts +12 -0
- package/dist/client/plainMessages.js +19 -0
- package/dist/client/plainMessages.js.map +1 -0
- package/dist/client/promptClientPort.typedefs.d.ts +60 -0
- package/dist/client/promptClientPort.typedefs.js +3 -0
- package/dist/client/promptClientPort.typedefs.js.map +1 -0
- package/dist/client/promptRegistry.runtime.d.ts +121 -0
- package/dist/client/promptRegistry.runtime.js +264 -0
- package/dist/client/promptRegistry.runtime.js.map +1 -0
- package/dist/client/promptSnapshot.typedefs.d.ts +55 -0
- package/dist/client/promptSnapshot.typedefs.js +3 -0
- package/dist/client/promptSnapshot.typedefs.js.map +1 -0
- package/dist/client/promptVariables.d.ts +7 -0
- package/dist/client/promptVariables.js +13 -0
- package/dist/client/promptVariables.js.map +1 -0
- package/dist/client/snapshotRuntime.d.ts +17 -0
- package/dist/client/snapshotRuntime.js +42 -0
- package/dist/client/snapshotRuntime.js.map +1 -0
- package/dist/client/snapshotRuntime.typedefs.d.ts +13 -0
- package/dist/client/snapshotRuntime.typedefs.js +3 -0
- package/dist/client/snapshotRuntime.typedefs.js.map +1 -0
- package/dist/client/validationGate.d.ts +24 -0
- package/dist/client/validationGate.js +54 -0
- package/dist/client/validationGate.js.map +1 -0
- package/dist/codegen.d.ts +6 -0
- package/dist/codegen.js +23 -0
- package/dist/codegen.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +27 -0
- package/dist/index.js.map +1 -0
- package/dist/providers/GoogleGenerativeAI/GoogleGenerativeAI.constants.d.ts +873 -0
- package/dist/providers/GoogleGenerativeAI/GoogleGenerativeAI.constants.js +269 -0
- package/dist/providers/GoogleGenerativeAI/GoogleGenerativeAI.constants.js.map +1 -0
- package/dist/providers/GoogleGenerativeAI/GoogleGenerativeAI.entity.d.ts +24 -0
- package/dist/providers/GoogleGenerativeAI/GoogleGenerativeAI.entity.js +210 -0
- package/dist/providers/GoogleGenerativeAI/GoogleGenerativeAI.entity.js.map +1 -0
- package/dist/providers/GoogleGenerativeAI/GoogleGenerativeAI.typedefs.d.ts +22 -0
- package/dist/providers/GoogleGenerativeAI/GoogleGenerativeAI.typedefs.js +20 -0
- package/dist/providers/GoogleGenerativeAI/GoogleGenerativeAI.typedefs.js.map +1 -0
- package/dist/providers/GoogleGenerativeAI/GoogleGenerativeAIService.factory.d.ts +6 -0
- package/dist/providers/GoogleGenerativeAI/GoogleGenerativeAIService.factory.js +18 -0
- package/dist/providers/GoogleGenerativeAI/GoogleGenerativeAIService.factory.js.map +1 -0
- package/dist/providers/GoogleGenerativeAI/index.d.ts +5 -0
- package/dist/providers/GoogleGenerativeAI/index.js +22 -0
- package/dist/providers/GoogleGenerativeAI/index.js.map +1 -0
- package/dist/providers/GoogleGenerativeAI/schemas/GoogleSchemaAdapter.d.ts +12 -0
- package/dist/providers/GoogleGenerativeAI/schemas/GoogleSchemaAdapter.js +72 -0
- package/dist/providers/GoogleGenerativeAI/schemas/GoogleSchemaAdapter.js.map +1 -0
- package/dist/providers/GoogleGenerativeAI/services/GoogleGenerativeAIAssistance.service.d.ts +71 -0
- package/dist/providers/GoogleGenerativeAI/services/GoogleGenerativeAIAssistance.service.js +876 -0
- package/dist/providers/GoogleGenerativeAI/services/GoogleGenerativeAIAssistance.service.js.map +1 -0
- package/dist/providers/GoogleGenerativeAI/services/GoogleGenerativeAICompletion.service.d.ts +25 -0
- package/dist/providers/GoogleGenerativeAI/services/GoogleGenerativeAICompletion.service.js +216 -0
- package/dist/providers/GoogleGenerativeAI/services/GoogleGenerativeAICompletion.service.js.map +1 -0
- package/dist/providers/GoogleGenerativeAI/services/GoogleGenerativeAISpeechToText.service.d.ts +10 -0
- package/dist/providers/GoogleGenerativeAI/services/GoogleGenerativeAISpeechToText.service.js +136 -0
- package/dist/providers/GoogleGenerativeAI/services/GoogleGenerativeAISpeechToText.service.js.map +1 -0
- package/dist/providers/GoogleGenerativeAI/services/GoogleGenerativeAITextToSpeech.service.d.ts +11 -0
- package/dist/providers/GoogleGenerativeAI/services/GoogleGenerativeAITextToSpeech.service.js +97 -0
- package/dist/providers/GoogleGenerativeAI/services/GoogleGenerativeAITextToSpeech.service.js.map +1 -0
- package/dist/providers/GoogleGenerativeAI/services/index.d.ts +4 -0
- package/dist/providers/GoogleGenerativeAI/services/index.js +21 -0
- package/dist/providers/GoogleGenerativeAI/services/index.js.map +1 -0
- package/dist/providers/LLMAPI/LLMAPI.constants.d.ts +35832 -0
- package/dist/providers/LLMAPI/LLMAPI.constants.js +8601 -0
- package/dist/providers/LLMAPI/LLMAPI.constants.js.map +1 -0
- package/dist/providers/LLMAPI/LLMAPI.entity.d.ts +6 -0
- package/dist/providers/LLMAPI/LLMAPI.entity.js +48 -0
- package/dist/providers/LLMAPI/LLMAPI.entity.js.map +1 -0
- package/dist/providers/LLMAPI/LLMAPI.typedefs.d.ts +516 -0
- package/dist/providers/LLMAPI/LLMAPI.typedefs.js +564 -0
- package/dist/providers/LLMAPI/LLMAPI.typedefs.js.map +1 -0
- package/dist/providers/LLMAPI/LLMAPI.voices.d.ts +376 -0
- package/dist/providers/LLMAPI/LLMAPI.voices.js +739 -0
- package/dist/providers/LLMAPI/LLMAPI.voices.js.map +1 -0
- package/dist/providers/LLMAPI/LLMAPIService.factory.d.ts +6 -0
- package/dist/providers/LLMAPI/LLMAPIService.factory.js +19 -0
- package/dist/providers/LLMAPI/LLMAPIService.factory.js.map +1 -0
- package/dist/providers/LLMAPI/index.d.ts +7 -0
- package/dist/providers/LLMAPI/index.js +24 -0
- package/dist/providers/LLMAPI/index.js.map +1 -0
- package/dist/providers/LLMAPI/schemas/LLMAPISchemaAdapter.d.ts +3 -0
- package/dist/providers/LLMAPI/schemas/LLMAPISchemaAdapter.js +8 -0
- package/dist/providers/LLMAPI/schemas/LLMAPISchemaAdapter.js.map +1 -0
- package/dist/providers/LLMAPI/services/LLMAPIAssistance.service.d.ts +76 -0
- package/dist/providers/LLMAPI/services/LLMAPIAssistance.service.js +825 -0
- package/dist/providers/LLMAPI/services/LLMAPIAssistance.service.js.map +1 -0
- package/dist/providers/LLMAPI/services/LLMAPICompletion.service.d.ts +25 -0
- package/dist/providers/LLMAPI/services/LLMAPICompletion.service.js +177 -0
- package/dist/providers/LLMAPI/services/LLMAPICompletion.service.js.map +1 -0
- package/dist/providers/LLMAPI/services/LLMAPISpeechToText.service.d.ts +17 -0
- package/dist/providers/LLMAPI/services/LLMAPISpeechToText.service.js +34 -0
- package/dist/providers/LLMAPI/services/LLMAPISpeechToText.service.js.map +1 -0
- package/dist/providers/LLMAPI/services/LLMAPITextToSpeech.service.d.ts +20 -0
- package/dist/providers/LLMAPI/services/LLMAPITextToSpeech.service.js +36 -0
- package/dist/providers/LLMAPI/services/LLMAPITextToSpeech.service.js.map +1 -0
- package/dist/providers/LLMAPI/services/index.d.ts +4 -0
- package/dist/providers/LLMAPI/services/index.js +21 -0
- package/dist/providers/LLMAPI/services/index.js.map +1 -0
- package/dist/providers/LLMAPI/utilities/index.d.ts +4 -0
- package/dist/providers/LLMAPI/utilities/index.js +13 -0
- package/dist/providers/LLMAPI/utilities/index.js.map +1 -0
- package/dist/providers/LLMAPI/utilities/parseXmlToolCalls.d.ts +7 -0
- package/dist/providers/LLMAPI/utilities/parseXmlToolCalls.js +35 -0
- package/dist/providers/LLMAPI/utilities/parseXmlToolCalls.js.map +1 -0
- package/dist/providers/LLMAPI/utilities/stripThinkingTags.d.ts +1 -0
- package/dist/providers/LLMAPI/utilities/stripThinkingTags.js +7 -0
- package/dist/providers/LLMAPI/utilities/stripThinkingTags.js.map +1 -0
- package/dist/providers/LLMAPI/utilities/structuredOutput.d.ts +13 -0
- package/dist/providers/LLMAPI/utilities/structuredOutput.js +29 -0
- package/dist/providers/LLMAPI/utilities/structuredOutput.js.map +1 -0
- package/dist/providers/LLMAPI/utilities/validateStructuredResponse.d.ts +10 -0
- package/dist/providers/LLMAPI/utilities/validateStructuredResponse.js +21 -0
- package/dist/providers/LLMAPI/utilities/validateStructuredResponse.js.map +1 -0
- package/dist/providers/OpenAI/OpenAI.constants.d.ts +1664 -0
- package/dist/providers/OpenAI/OpenAI.constants.js +310 -0
- package/dist/providers/OpenAI/OpenAI.constants.js.map +1 -0
- package/dist/providers/OpenAI/OpenAI.entity.d.ts +15 -0
- package/dist/providers/OpenAI/OpenAI.entity.js +162 -0
- package/dist/providers/OpenAI/OpenAI.entity.js.map +1 -0
- package/dist/providers/OpenAI/OpenAI.typedefs.d.ts +61 -0
- package/dist/providers/OpenAI/OpenAI.typedefs.js +39 -0
- package/dist/providers/OpenAI/OpenAI.typedefs.js.map +1 -0
- package/dist/providers/OpenAI/OpenAIService.factory.d.ts +6 -0
- package/dist/providers/OpenAI/OpenAIService.factory.js +18 -0
- package/dist/providers/OpenAI/OpenAIService.factory.js.map +1 -0
- package/dist/providers/OpenAI/index.d.ts +5 -0
- package/dist/providers/OpenAI/index.js +22 -0
- package/dist/providers/OpenAI/index.js.map +1 -0
- package/dist/providers/OpenAI/schemas/OpenAISchemaAdapter.d.ts +14 -0
- package/dist/providers/OpenAI/schemas/OpenAISchemaAdapter.js +87 -0
- package/dist/providers/OpenAI/schemas/OpenAISchemaAdapter.js.map +1 -0
- package/dist/providers/OpenAI/services/OpenAIAssistance.service.d.ts +42 -0
- package/dist/providers/OpenAI/services/OpenAIAssistance.service.js +712 -0
- package/dist/providers/OpenAI/services/OpenAIAssistance.service.js.map +1 -0
- package/dist/providers/OpenAI/services/OpenAICompletion.service.d.ts +7 -0
- package/dist/providers/OpenAI/services/OpenAICompletion.service.js +12 -0
- package/dist/providers/OpenAI/services/OpenAICompletion.service.js.map +1 -0
- package/dist/providers/OpenAI/services/OpenAISpeechToText.service.d.ts +17 -0
- package/dist/providers/OpenAI/services/OpenAISpeechToText.service.js +40 -0
- package/dist/providers/OpenAI/services/OpenAISpeechToText.service.js.map +1 -0
- package/dist/providers/OpenAI/services/OpenAITextToSpeech.service.d.ts +13 -0
- package/dist/providers/OpenAI/services/OpenAITextToSpeech.service.js +32 -0
- package/dist/providers/OpenAI/services/OpenAITextToSpeech.service.js.map +1 -0
- package/dist/providers/OpenAI/services/buildFunctionCallOutput.d.ts +3 -0
- package/dist/providers/OpenAI/services/buildFunctionCallOutput.js +19 -0
- package/dist/providers/OpenAI/services/buildFunctionCallOutput.js.map +1 -0
- package/dist/providers/OpenAI/services/index.d.ts +4 -0
- package/dist/providers/OpenAI/services/index.js +21 -0
- package/dist/providers/OpenAI/services/index.js.map +1 -0
- package/dist/providers/OpenAICompatible/OpenAICompatibleCompletion.service.d.ts +30 -0
- package/dist/providers/OpenAICompatible/OpenAICompatibleCompletion.service.js +233 -0
- package/dist/providers/OpenAICompatible/OpenAICompatibleCompletion.service.js.map +1 -0
- package/dist/providers/OpenAICompatible/OpenAICompatibleSpeechToText.service.d.ts +22 -0
- package/dist/providers/OpenAICompatible/OpenAICompatibleSpeechToText.service.js +98 -0
- package/dist/providers/OpenAICompatible/OpenAICompatibleSpeechToText.service.js.map +1 -0
- package/dist/providers/OpenAICompatible/OpenAICompatibleTextToSpeech.service.d.ts +22 -0
- package/dist/providers/OpenAICompatible/OpenAICompatibleTextToSpeech.service.js +67 -0
- package/dist/providers/OpenAICompatible/OpenAICompatibleTextToSpeech.service.js.map +1 -0
- package/dist/providers/index.d.ts +3 -0
- package/dist/providers/index.js +20 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/services/LLMAssistanceService.abstract.d.ts +39 -0
- package/dist/services/LLMAssistanceService.abstract.js +101 -0
- package/dist/services/LLMAssistanceService.abstract.js.map +1 -0
- package/dist/services/LLMBaseService.abstract.d.ts +161 -0
- package/dist/services/LLMBaseService.abstract.js +392 -0
- package/dist/services/LLMBaseService.abstract.js.map +1 -0
- package/dist/services/LLMCompletionService.abstract.d.ts +16 -0
- package/dist/services/LLMCompletionService.abstract.js +12 -0
- package/dist/services/LLMCompletionService.abstract.js.map +1 -0
- package/dist/services/LLMServicePurposeFactory.abstract.d.ts +12 -0
- package/dist/services/LLMServicePurposeFactory.abstract.js +7 -0
- package/dist/services/LLMServicePurposeFactory.abstract.js.map +1 -0
- package/dist/services/LLMSpeechToTextService.abstract.d.ts +8 -0
- package/dist/services/LLMSpeechToTextService.abstract.js +12 -0
- package/dist/services/LLMSpeechToTextService.abstract.js.map +1 -0
- package/dist/services/LLMTextToSpeechService.abstract.d.ts +8 -0
- package/dist/services/LLMTextToSpeechService.abstract.js +12 -0
- package/dist/services/LLMTextToSpeechService.abstract.js.map +1 -0
- package/dist/services/agentRounds/LLMAgentRounds.d.ts +32 -0
- package/dist/services/agentRounds/LLMAgentRounds.js +77 -0
- package/dist/services/agentRounds/LLMAgentRounds.js.map +1 -0
- package/dist/services/agentRounds/agentRounds.typedefs.d.ts +48 -0
- package/dist/services/agentRounds/agentRounds.typedefs.js +3 -0
- package/dist/services/agentRounds/agentRounds.typedefs.js.map +1 -0
- package/dist/services/agentRounds/index.d.ts +2 -0
- package/dist/services/agentRounds/index.js +19 -0
- package/dist/services/agentRounds/index.js.map +1 -0
- package/dist/services/chatState/CompletionsChatState.d.ts +35 -0
- package/dist/services/chatState/CompletionsChatState.js +118 -0
- package/dist/services/chatState/CompletionsChatState.js.map +1 -0
- package/dist/services/chatState/index.d.ts +1 -0
- package/dist/services/chatState/index.js +6 -0
- package/dist/services/chatState/index.js.map +1 -0
- package/dist/services/fileStorage/FileStorageToolExecutor.d.ts +15 -0
- package/dist/services/fileStorage/FileStorageToolExecutor.js +172 -0
- package/dist/services/fileStorage/FileStorageToolExecutor.js.map +1 -0
- package/dist/services/fileStorage/InMemoryFileStorage.d.ts +20 -0
- package/dist/services/fileStorage/InMemoryFileStorage.js +67 -0
- package/dist/services/fileStorage/InMemoryFileStorage.js.map +1 -0
- package/dist/services/fileStorage/fileStorageTools.d.ts +26 -0
- package/dist/services/fileStorage/fileStorageTools.js +68 -0
- package/dist/services/fileStorage/fileStorageTools.js.map +1 -0
- package/dist/services/fileStorage/index.d.ts +4 -0
- package/dist/services/fileStorage/index.js +11 -0
- package/dist/services/fileStorage/index.js.map +1 -0
- package/dist/services/index.d.ts +7 -0
- package/dist/services/index.js +24 -0
- package/dist/services/index.js.map +1 -0
- package/dist/utilities/calculateCosts.d.ts +4 -0
- package/dist/utilities/calculateCosts.js +56 -0
- package/dist/utilities/calculateCosts.js.map +1 -0
- package/dist/utilities/functional.utils.d.ts +1 -0
- package/dist/utilities/functional.utils.js +9 -0
- package/dist/utilities/functional.utils.js.map +1 -0
- package/dist/utilities/index.d.ts +9 -0
- package/dist/utilities/index.js +26 -0
- package/dist/utilities/index.js.map +1 -0
- package/dist/utilities/llmTracing/index.d.ts +3 -0
- package/dist/utilities/llmTracing/index.js +20 -0
- package/dist/utilities/llmTracing/index.js.map +1 -0
- package/dist/utilities/llmTracing/llmTracing.constants.d.ts +7 -0
- package/dist/utilities/llmTracing/llmTracing.constants.js +11 -0
- package/dist/utilities/llmTracing/llmTracing.constants.js.map +1 -0
- package/dist/utilities/llmTracing/llmTracing.typedefs.d.ts +126 -0
- package/dist/utilities/llmTracing/llmTracing.typedefs.js +3 -0
- package/dist/utilities/llmTracing/llmTracing.typedefs.js.map +1 -0
- package/dist/utilities/llmTracing/noopLLMTracing.d.ts +3 -0
- package/dist/utilities/llmTracing/noopLLMTracing.js +36 -0
- package/dist/utilities/llmTracing/noopLLMTracing.js.map +1 -0
- package/dist/utilities/logger/LLMLoggerInterface.d.ts +36 -0
- package/dist/utilities/logger/LLMLoggerInterface.js +3 -0
- package/dist/utilities/logger/LLMLoggerInterface.js.map +1 -0
- package/dist/utilities/logger/index.d.ts +1 -0
- package/dist/utilities/logger/index.js +18 -0
- package/dist/utilities/logger/index.js.map +1 -0
- package/dist/utilities/promptBuilder.d.ts +58 -0
- package/dist/utilities/promptBuilder.js +92 -0
- package/dist/utilities/promptBuilder.js.map +1 -0
- package/dist/utilities/reporter/LLMReporterInterface.d.ts +46 -0
- package/dist/utilities/reporter/LLMReporterInterface.js +3 -0
- package/dist/utilities/reporter/LLMReporterInterface.js.map +1 -0
- package/dist/utilities/reporter/index.d.ts +1 -0
- package/dist/utilities/reporter/index.js +18 -0
- package/dist/utilities/reporter/index.js.map +1 -0
- package/dist/utilities/schema/LLMSchema.d.ts +112 -0
- package/dist/utilities/schema/LLMSchema.js +223 -0
- package/dist/utilities/schema/LLMSchema.js.map +1 -0
- package/dist/utilities/schema/LLMSchema.typedefs.d.ts +55 -0
- package/dist/utilities/schema/LLMSchema.typedefs.js +3 -0
- package/dist/utilities/schema/LLMSchema.typedefs.js.map +1 -0
- package/dist/utilities/schema/SchemaAdapterRegistry.d.ts +26 -0
- package/dist/utilities/schema/SchemaAdapterRegistry.js +32 -0
- package/dist/utilities/schema/SchemaAdapterRegistry.js.map +1 -0
- package/dist/utilities/schema/index.d.ts +2 -0
- package/dist/utilities/schema/index.js +19 -0
- package/dist/utilities/schema/index.js.map +1 -0
- package/dist/utilities/serializeError.d.ts +9 -0
- package/dist/utilities/serializeError.js +69 -0
- package/dist/utilities/serializeError.js.map +1 -0
- package/dist/utilities/tokenizer.d.ts +4 -0
- package/dist/utilities/tokenizer.js +14 -0
- package/dist/utilities/tokenizer.js.map +1 -0
- package/dist/utilities/tools/LLMTool.d.ts +5 -0
- package/dist/utilities/tools/LLMTool.js +10 -0
- package/dist/utilities/tools/LLMTool.js.map +1 -0
- package/dist/utilities/tools/index.d.ts +2 -0
- package/dist/utilities/tools/index.js +8 -0
- package/dist/utilities/tools/index.js.map +1 -0
- package/dist/utilities/tools/normalizeToolResult.d.ts +15 -0
- package/dist/utilities/tools/normalizeToolResult.js +18 -0
- package/dist/utilities/tools/normalizeToolResult.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LLMToolLoopStopReasons = exports.LLMUploadFileMimeTypes = exports.LLMMessageContentType = exports.LLMRoles = exports.LLMPurposes = exports.LLMProviders = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Enum of supported LLM providers.
|
|
6
|
+
*/
|
|
7
|
+
var LLMProviders;
|
|
8
|
+
(function (LLMProviders) {
|
|
9
|
+
LLMProviders["OpenAI"] = "OpenAI";
|
|
10
|
+
LLMProviders["GoogleGenerativeAI"] = "GoogleGenerativeAI";
|
|
11
|
+
LLMProviders["LLMAPI"] = "LLMAPI";
|
|
12
|
+
})(LLMProviders || (exports.LLMProviders = LLMProviders = {}));
|
|
13
|
+
/**
|
|
14
|
+
* Supported service purposes/types that the LLM gateway provides.
|
|
15
|
+
*/
|
|
16
|
+
var LLMPurposes;
|
|
17
|
+
(function (LLMPurposes) {
|
|
18
|
+
LLMPurposes["Completion"] = "completion";
|
|
19
|
+
LLMPurposes["Assistance"] = "assistance";
|
|
20
|
+
LLMPurposes["SpeechToText"] = "speech_to_text";
|
|
21
|
+
LLMPurposes["TextToSpeech"] = "text_to_speech";
|
|
22
|
+
})(LLMPurposes || (exports.LLMPurposes = LLMPurposes = {}));
|
|
23
|
+
/**
|
|
24
|
+
* Roles that can be assigned to messages in an LLM conversation.
|
|
25
|
+
*/
|
|
26
|
+
var LLMRoles;
|
|
27
|
+
(function (LLMRoles) {
|
|
28
|
+
LLMRoles["User"] = "user";
|
|
29
|
+
LLMRoles["Assistant"] = "assistant";
|
|
30
|
+
})(LLMRoles || (exports.LLMRoles = LLMRoles = {}));
|
|
31
|
+
/**
|
|
32
|
+
* Possible content types for messages in an LLM conversation.
|
|
33
|
+
*/
|
|
34
|
+
var LLMMessageContentType;
|
|
35
|
+
(function (LLMMessageContentType) {
|
|
36
|
+
LLMMessageContentType["TEXT"] = "text";
|
|
37
|
+
LLMMessageContentType["IMAGE_URL"] = "image_url";
|
|
38
|
+
LLMMessageContentType["AUDIO_FILE"] = "audio_file";
|
|
39
|
+
})(LLMMessageContentType || (exports.LLMMessageContentType = LLMMessageContentType = {}));
|
|
40
|
+
/**
|
|
41
|
+
* Supported MIME types for files that can be uploaded to LLM services.
|
|
42
|
+
*/
|
|
43
|
+
var LLMUploadFileMimeTypes;
|
|
44
|
+
(function (LLMUploadFileMimeTypes) {
|
|
45
|
+
LLMUploadFileMimeTypes["IMAGE_PNG"] = "image/png";
|
|
46
|
+
LLMUploadFileMimeTypes["IMAGE_JPEG"] = "image/jpeg";
|
|
47
|
+
LLMUploadFileMimeTypes["IMAGE_JPG"] = "image/jpg";
|
|
48
|
+
LLMUploadFileMimeTypes["IMAGE_GIF"] = "image/gif";
|
|
49
|
+
LLMUploadFileMimeTypes["IMAGE_WEBP"] = "image/webp";
|
|
50
|
+
LLMUploadFileMimeTypes["IMAGE_SVG_XML"] = "image/svg+xml";
|
|
51
|
+
LLMUploadFileMimeTypes["IMAGE_BMP"] = "image/bmp";
|
|
52
|
+
LLMUploadFileMimeTypes["PLAIN_TEXT"] = "text/plain";
|
|
53
|
+
LLMUploadFileMimeTypes["MARKDOWN"] = "text/markdown";
|
|
54
|
+
LLMUploadFileMimeTypes["AUDIO_MP3"] = "audio/mp3";
|
|
55
|
+
LLMUploadFileMimeTypes["AUDIO_MPEG"] = "audio/mpeg";
|
|
56
|
+
LLMUploadFileMimeTypes["AUDIO_WAV"] = "audio/wav";
|
|
57
|
+
LLMUploadFileMimeTypes["AUDIO_WEBM"] = "audio/webm";
|
|
58
|
+
LLMUploadFileMimeTypes["AUDIO_OGG"] = "audio/ogg";
|
|
59
|
+
})(LLMUploadFileMimeTypes || (exports.LLMUploadFileMimeTypes = LLMUploadFileMimeTypes = {}));
|
|
60
|
+
/**
|
|
61
|
+
* Why a provider's model⇄tool loop stopped. `Completed` is the ordinary end
|
|
62
|
+
* (a model round returned no tool calls), `MaxIterations` means the loop hit
|
|
63
|
+
* `maxToolIterations` with tool calls still pending, and `TerminalTool` means
|
|
64
|
+
* a tool declaring `terminal` ran and ended the turn.
|
|
65
|
+
*/
|
|
66
|
+
var LLMToolLoopStopReasons;
|
|
67
|
+
(function (LLMToolLoopStopReasons) {
|
|
68
|
+
LLMToolLoopStopReasons["Completed"] = "completed";
|
|
69
|
+
LLMToolLoopStopReasons["MaxIterations"] = "max_iterations";
|
|
70
|
+
LLMToolLoopStopReasons["TerminalTool"] = "terminal_tool";
|
|
71
|
+
})(LLMToolLoopStopReasons || (exports.LLMToolLoopStopReasons = LLMToolLoopStopReasons = {}));
|
|
72
|
+
//# sourceMappingURL=LLMService.typedefs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LLMService.typedefs.js","sourceRoot":"","sources":["../src/LLMService.typedefs.ts"],"names":[],"mappings":";;;AAmCA;;GAEG;AACH,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,iCAAiB,CAAA;IACjB,yDAAyC,CAAA;IACzC,iCAAiB,CAAA;AACnB,CAAC,EAJW,YAAY,4BAAZ,YAAY,QAIvB;AAoBD;;GAEG;AACH,IAAY,WAKX;AALD,WAAY,WAAW;IACrB,wCAAyB,CAAA;IACzB,wCAAyB,CAAA;IACzB,8CAA+B,CAAA;IAC/B,8CAA+B,CAAA;AACjC,CAAC,EALW,WAAW,2BAAX,WAAW,QAKtB;AAiLD;;GAEG;AACH,IAAY,QAGX;AAHD,WAAY,QAAQ;IAClB,yBAAa,CAAA;IACb,mCAAuB,CAAA;AACzB,CAAC,EAHW,QAAQ,wBAAR,QAAQ,QAGnB;AAED;;GAEG;AACH,IAAY,qBAIX;AAJD,WAAY,qBAAqB;IAC/B,sCAAa,CAAA;IACb,gDAAuB,CAAA;IACvB,kDAAyB,CAAA;AAC3B,CAAC,EAJW,qBAAqB,qCAArB,qBAAqB,QAIhC;AAsMD;;GAEG;AACH,IAAY,sBAeX;AAfD,WAAY,sBAAsB;IAChC,iDAAuB,CAAA;IACvB,mDAAyB,CAAA;IACzB,iDAAuB,CAAA;IACvB,iDAAuB,CAAA;IACvB,mDAAyB,CAAA;IACzB,yDAA+B,CAAA;IAC/B,iDAAuB,CAAA;IACvB,mDAAyB,CAAA;IACzB,oDAA0B,CAAA;IAC1B,iDAAuB,CAAA;IACvB,mDAAyB,CAAA;IACzB,iDAAuB,CAAA;IACvB,mDAAyB,CAAA;IACzB,iDAAuB,CAAA;AACzB,CAAC,EAfW,sBAAsB,sCAAtB,sBAAsB,QAejC;AA8OD;;;;;GAKG;AACH,IAAY,sBAIX;AAJD,WAAY,sBAAsB;IAChC,iDAAuB,CAAA;IACvB,0DAAgC,CAAA;IAChC,wDAA8B,CAAA;AAChC,CAAC,EAJW,sBAAsB,sCAAtB,sBAAsB,QAIjC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Escape hatch entry point. Re-exports the internal engine — `LLMServiceFactory`,
|
|
3
|
+
* the provider services, and the model maps — for the rare call site that needs
|
|
4
|
+
* raw control the v2 client does not expose. Discouraged: prefer `createLLMClient`
|
|
5
|
+
* + the typed registry. This surface bypasses prompt management, the validation
|
|
6
|
+
* gate, and config-in-prompt routing.
|
|
7
|
+
*/
|
|
8
|
+
export { LLMServiceFactory } from './LLMService.factory';
|
|
9
|
+
export { LLM_SERVICE_FACTORIES, LLM_SERVICE_MODELS, } from './LLMService.constants';
|
|
10
|
+
export * from './providers';
|
|
11
|
+
export * from './services';
|
package/dist/advanced.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.LLM_SERVICE_MODELS = exports.LLM_SERVICE_FACTORIES = exports.LLMServiceFactory = void 0;
|
|
18
|
+
/**
|
|
19
|
+
* Escape hatch entry point. Re-exports the internal engine — `LLMServiceFactory`,
|
|
20
|
+
* the provider services, and the model maps — for the rare call site that needs
|
|
21
|
+
* raw control the v2 client does not expose. Discouraged: prefer `createLLMClient`
|
|
22
|
+
* + the typed registry. This surface bypasses prompt management, the validation
|
|
23
|
+
* gate, and config-in-prompt routing.
|
|
24
|
+
*/
|
|
25
|
+
var LLMService_factory_1 = require("./LLMService.factory");
|
|
26
|
+
Object.defineProperty(exports, "LLMServiceFactory", { enumerable: true, get: function () { return LLMService_factory_1.LLMServiceFactory; } });
|
|
27
|
+
var LLMService_constants_1 = require("./LLMService.constants");
|
|
28
|
+
Object.defineProperty(exports, "LLM_SERVICE_FACTORIES", { enumerable: true, get: function () { return LLMService_constants_1.LLM_SERVICE_FACTORIES; } });
|
|
29
|
+
Object.defineProperty(exports, "LLM_SERVICE_MODELS", { enumerable: true, get: function () { return LLMService_constants_1.LLM_SERVICE_MODELS; } });
|
|
30
|
+
__exportStar(require("./providers"), exports);
|
|
31
|
+
__exportStar(require("./services"), exports);
|
|
32
|
+
//# sourceMappingURL=advanced.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"advanced.js","sourceRoot":"","sources":["../src/advanced.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;;;GAMG;AACH,2DAAyD;AAAhD,uHAAA,iBAAiB,OAAA;AAC1B,+DAGgC;AAF9B,6HAAA,qBAAqB,OAAA;AACrB,0HAAA,kBAAkB,OAAA;AAEpB,8CAA4B;AAC5B,6CAA2B"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { type LLMToolDefinition } from '../LLMService.typedefs';
|
|
2
|
+
import { type LLMSchemaInterface } from '../utilities/schema';
|
|
3
|
+
import { type LLMPromptRegistry } from '../client/defineLLMPrompts';
|
|
4
|
+
import { type LLMVariableValue } from '../client/promptSnapshot.typedefs';
|
|
5
|
+
import { type LLMDelegationGate, type LLMPromptVariables, type LLMSubagentVariableSource } from '../client/llmClient.typedefs';
|
|
6
|
+
/**
|
|
7
|
+
* A bounded specialist the root agent may delegate to, as a plain object.
|
|
8
|
+
* `prompt` names the registry entry whose Langfuse prompt is the subagent's
|
|
9
|
+
* instructions (and whose config routes its model); `name`/`description` are
|
|
10
|
+
* what the root model sees when deciding to delegate. A plain-object subagent
|
|
11
|
+
* cannot declare its own subagents — use `LLMAgent` instances (via
|
|
12
|
+
* `llm.defineAgent`) when deeper composition is needed.
|
|
13
|
+
*/
|
|
14
|
+
export type LLMAgentSubagentDefinition<Registry extends LLMPromptRegistry, VariableMap extends Record<keyof Registry, string>> = {
|
|
15
|
+
[Key in keyof Registry]: {
|
|
16
|
+
prompt: Key;
|
|
17
|
+
name: string;
|
|
18
|
+
description: string;
|
|
19
|
+
tools?: LLMToolDefinition[];
|
|
20
|
+
canExecute?: LLMDelegationGate;
|
|
21
|
+
maxToolIterations?: number;
|
|
22
|
+
} & LLMSubagentVariableSource<VariableMap[Key]>;
|
|
23
|
+
}[keyof Registry];
|
|
24
|
+
/**
|
|
25
|
+
* Anything accepted in a `subagents` list: a plain definition object or an
|
|
26
|
+
* `LLMAgent` instance — both describe the same delegation tool.
|
|
27
|
+
*/
|
|
28
|
+
export type LLMAgentSubagent<Registry extends LLMPromptRegistry, VariableMap extends Record<keyof Registry, string>> = LLMAgentSubagentDefinition<Registry, VariableMap> | LLMAgent<Registry, VariableMap>;
|
|
29
|
+
/**
|
|
30
|
+
* The declarative description of one agent. `prompt` names the registry entry
|
|
31
|
+
* whose Langfuse prompt is the agent's instructions (and whose config routes
|
|
32
|
+
* its model). `name`/`description` are required when the agent is used as a
|
|
33
|
+
* subagent — the name becomes the delegation tool the parent model calls.
|
|
34
|
+
* `variables` given here are a base merged under the per-run variables (for a
|
|
35
|
+
* subagent they are the only source, unless `inputSchema` lets the parent
|
|
36
|
+
* model supply more).
|
|
37
|
+
*/
|
|
38
|
+
export interface LLMAgentDefinition<Registry extends LLMPromptRegistry, VariableMap extends Record<keyof Registry, string>, Key extends keyof Registry> {
|
|
39
|
+
prompt: Key;
|
|
40
|
+
name?: string;
|
|
41
|
+
description?: string;
|
|
42
|
+
variables?: LLMPromptVariables<VariableMap[Key]>;
|
|
43
|
+
tools?: LLMToolDefinition[];
|
|
44
|
+
subagents?: LLMAgentSubagent<Registry, VariableMap>[];
|
|
45
|
+
/**
|
|
46
|
+
* The arguments the parent model must supply when delegating to this agent,
|
|
47
|
+
* replacing the default single `prompt` string. Each argument joins the
|
|
48
|
+
* subagent's prompt variables (over the definition's own), so the delegated
|
|
49
|
+
* prompt can reference them as `{{name}}`. Only meaningful as a subagent.
|
|
50
|
+
*/
|
|
51
|
+
inputSchema?: LLMSchemaInterface;
|
|
52
|
+
/** Refuses a delegation call before it runs; see `LLMDelegationGate`. */
|
|
53
|
+
canExecute?: LLMDelegationGate;
|
|
54
|
+
maxToolIterations?: number;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* An immutable agent definition bound to the prompt registry. Optional sugar
|
|
58
|
+
* over the plain-object `runAgent` options: build instances with
|
|
59
|
+
* `llm.defineAgent(...)` — the client factory carries the registry generics,
|
|
60
|
+
* so `prompt`, `variables`, and the `runAgent` return type stay fully typed.
|
|
61
|
+
* Agents compose: a subagent may itself be an `LLMAgent` with its own
|
|
62
|
+
* subagents; because instances are immutable, a delegation cycle cannot be
|
|
63
|
+
* constructed and nesting depth is always finite.
|
|
64
|
+
*/
|
|
65
|
+
export declare class LLMAgent<Registry extends LLMPromptRegistry = LLMPromptRegistry, VariableMap extends Record<keyof Registry, string> = Record<keyof Registry, string>, Key extends keyof Registry = keyof Registry> {
|
|
66
|
+
readonly prompt: Key;
|
|
67
|
+
readonly name: string | undefined;
|
|
68
|
+
readonly description: string | undefined;
|
|
69
|
+
readonly variables: Record<string, LLMVariableValue> | undefined;
|
|
70
|
+
readonly tools: LLMToolDefinition[] | undefined;
|
|
71
|
+
readonly subagents: LLMAgentSubagent<Registry, VariableMap>[] | undefined;
|
|
72
|
+
readonly inputSchema: LLMSchemaInterface | undefined;
|
|
73
|
+
readonly canExecute: LLMDelegationGate | undefined;
|
|
74
|
+
readonly maxToolIterations: number | undefined;
|
|
75
|
+
constructor(definition: LLMAgentDefinition<Registry, VariableMap, Key>);
|
|
76
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LLMAgent = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* An immutable agent definition bound to the prompt registry. Optional sugar
|
|
6
|
+
* over the plain-object `runAgent` options: build instances with
|
|
7
|
+
* `llm.defineAgent(...)` — the client factory carries the registry generics,
|
|
8
|
+
* so `prompt`, `variables`, and the `runAgent` return type stay fully typed.
|
|
9
|
+
* Agents compose: a subagent may itself be an `LLMAgent` with its own
|
|
10
|
+
* subagents; because instances are immutable, a delegation cycle cannot be
|
|
11
|
+
* constructed and nesting depth is always finite.
|
|
12
|
+
*/
|
|
13
|
+
class LLMAgent {
|
|
14
|
+
prompt;
|
|
15
|
+
name;
|
|
16
|
+
description;
|
|
17
|
+
variables;
|
|
18
|
+
tools;
|
|
19
|
+
subagents;
|
|
20
|
+
inputSchema;
|
|
21
|
+
canExecute;
|
|
22
|
+
maxToolIterations;
|
|
23
|
+
constructor(definition) {
|
|
24
|
+
this.prompt = definition.prompt;
|
|
25
|
+
this.name = definition.name;
|
|
26
|
+
this.description = definition.description;
|
|
27
|
+
this.variables = definition.variables;
|
|
28
|
+
this.tools = definition.tools;
|
|
29
|
+
this.subagents = definition.subagents;
|
|
30
|
+
this.inputSchema = definition.inputSchema;
|
|
31
|
+
this.canExecute = definition.canExecute;
|
|
32
|
+
this.maxToolIterations = definition.maxToolIterations;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.LLMAgent = LLMAgent;
|
|
36
|
+
//# sourceMappingURL=LLMAgent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LLMAgent.js","sourceRoot":"","sources":["../../src/client/LLMAgent.ts"],"names":[],"mappings":";;;AA2EA;;;;;;;;GAQG;AACH,MAAa,QAAQ;IAMV,MAAM,CAAM;IAEZ,IAAI,CAAqB;IAEzB,WAAW,CAAqB;IAEhC,SAAS,CAA+C;IAExD,KAAK,CAAkC;IAEvC,SAAS,CAAwD;IAEjE,WAAW,CAAiC;IAE5C,UAAU,CAAgC;IAE1C,iBAAiB,CAAqB;IAE/C,YAAY,UAA0D;QACpE,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;QAChC,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;QAC5B,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC,WAAW,CAAC;QAC1C,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;QACtC,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC;QAC9B,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;QACtC,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC,WAAW,CAAC;QAC1C,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,UAAU,CAAC;QACxC,IAAI,CAAC,iBAAiB,GAAG,UAAU,CAAC,iBAAiB,CAAC;IACxD,CAAC;CACF;AAnCD,4BAmCC"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { type LLMCallTraceContext, type LLMToolResult } from '../LLMService.typedefs';
|
|
2
|
+
import { type LLMReporterInterface } from '../utilities/reporter';
|
|
3
|
+
import { type LLMSchemaInterface } from '../utilities/schema';
|
|
4
|
+
import { type LLMPromptBinding, type LLMPromptRegistry } from '../client/defineLLMPrompts';
|
|
5
|
+
import { type LLMAgentInlineRunOptions, type LLMAgentRunResult } from '../client/agentRun.typedefs';
|
|
6
|
+
import { LLMAgent, type LLMAgentDefinition } from '../client/LLMAgent';
|
|
7
|
+
import { type LLMAgentCallServices, type LLMPromptResolutionCall } from '../client/agentRunner';
|
|
8
|
+
import { type LLMClientCallContext, type LLMClientEngineConfig, type LLMGenerateOptions, type LLMGenerateResult, type LLMPlainMessage, type LLMPromptDescription, type LLMProviderServiceScope, type LLMToolResultContext, type LLMTraceContextScope } from '../client/llmClient.typedefs';
|
|
9
|
+
import { type LLMVariableValue } from '../client/promptSnapshot.typedefs';
|
|
10
|
+
import { type ResolvedPrompt } from '../client/promptRegistry.runtime';
|
|
11
|
+
/**
|
|
12
|
+
* The client's single implementation. `createLLMClient` owns its construction
|
|
13
|
+
* and exposes only the `LLMClient` surface, so every call path — `generate`,
|
|
14
|
+
* `countTokens`, `runAgent`, `describePrompt` — shares one prompt resolution,
|
|
15
|
+
* one credentials lookup, one reporter/trace context, and one error taxonomy.
|
|
16
|
+
*/
|
|
17
|
+
export declare class LLMClientEngine<Registry extends LLMPromptRegistry> implements LLMAgentCallServices {
|
|
18
|
+
private readonly gateway;
|
|
19
|
+
private readonly registry;
|
|
20
|
+
private readonly runtime;
|
|
21
|
+
private readonly credentials;
|
|
22
|
+
private readonly reporter;
|
|
23
|
+
private readonly buildReporterContextFor;
|
|
24
|
+
private readonly logger;
|
|
25
|
+
private readonly staticContext;
|
|
26
|
+
private readonly mode;
|
|
27
|
+
private readonly toolResultNormalizer;
|
|
28
|
+
private readonly agentRunner;
|
|
29
|
+
constructor(config: LLMClientEngineConfig<Registry>);
|
|
30
|
+
generate<Key extends keyof Registry, Schema extends LLMSchemaInterface = never>(prompt: Key, options: LLMGenerateOptions<Record<string, LLMVariableValue>, Schema>): Promise<unknown>;
|
|
31
|
+
defineAgent<Key extends keyof Registry>(definition: LLMAgentDefinition<Registry, Record<keyof Registry, string>, Key>): LLMAgent<Registry, Record<keyof Registry, string>, Key>;
|
|
32
|
+
runAgent<Key extends keyof Registry>(promptOrAgent: Key | LLMAgent<Registry, Record<keyof Registry, string>>, options: LLMAgentInlineRunOptions<Record<string, LLMVariableValue>, Registry, Record<keyof Registry, string>>): Promise<LLMAgentRunResult<LLMGenerateResult<Registry[Key]>>>;
|
|
33
|
+
countTokens<Key extends keyof Registry>(prompt: Key, options: {
|
|
34
|
+
variables: Record<string, LLMVariableValue>;
|
|
35
|
+
history?: LLMPlainMessage[];
|
|
36
|
+
}): Promise<number>;
|
|
37
|
+
describePrompt<Key extends keyof Registry>(prompt: Key): Promise<LLMPromptDescription>;
|
|
38
|
+
resolvePrompt(promptName: string, binding: LLMPromptBinding, variables: Record<string, LLMVariableValue>, call: LLMPromptResolutionCall): Promise<ResolvedPrompt>;
|
|
39
|
+
/**
|
|
40
|
+
* The single place a tool's return value becomes what the model reads. The
|
|
41
|
+
* package's own coercion always runs first, so a client-supplied normalizer
|
|
42
|
+
* never sees a malformed value and cannot reintroduce one.
|
|
43
|
+
*/
|
|
44
|
+
normalizeToolResult(context: LLMToolResultContext): LLMToolResult;
|
|
45
|
+
withAgentObservation<Result>(name: string, input: unknown, fn: () => Promise<Result>): Promise<Result>;
|
|
46
|
+
private runCompletion;
|
|
47
|
+
/**
|
|
48
|
+
* Builds the provider message envelope from the resolved prompt. A `text`
|
|
49
|
+
* prompt is one user message. A `chat` prompt preserves the structure the
|
|
50
|
+
* prompt declares: a leading `system` message maps to `instructions`, the final
|
|
51
|
+
* `user` message is the request, and any messages between them join the
|
|
52
|
+
* call-supplied history in order.
|
|
53
|
+
*/
|
|
54
|
+
private buildMessageEnvelope;
|
|
55
|
+
private findLastUserIndex;
|
|
56
|
+
private callProvider;
|
|
57
|
+
unwrapResult(resolved: ResolvedPrompt, schema: LLMSchemaInterface | undefined, sendResult: {
|
|
58
|
+
text?: string;
|
|
59
|
+
data?: unknown;
|
|
60
|
+
parseError?: string;
|
|
61
|
+
}): unknown;
|
|
62
|
+
toTaxonomyError(error: unknown, resolved: ResolvedPrompt, abortSignal?: AbortSignal): Error;
|
|
63
|
+
buildAssistanceService(options: LLMProviderServiceScope): Promise<import("..").LLMAssistanceService<import("../LLMService.typedefs").LLMProviders, LLMReporterInterface<any>>>;
|
|
64
|
+
getBinding(promptName: string): LLMPromptBinding | undefined;
|
|
65
|
+
private buildCompletionService;
|
|
66
|
+
/**
|
|
67
|
+
* Resolves credentials for the product this call belongs to. The per-call
|
|
68
|
+
* context wins over the static one: the client is built once per process, so
|
|
69
|
+
* its static product is only ever the one its builder knew, while a call site
|
|
70
|
+
* that resolves the product from its own subject knows better.
|
|
71
|
+
*/
|
|
72
|
+
private resolveProviderOptions;
|
|
73
|
+
private buildUserMessage;
|
|
74
|
+
private buildHistory;
|
|
75
|
+
private toCompletionMessage;
|
|
76
|
+
/**
|
|
77
|
+
* Delegates the reporter's payload to the composition root. The gateway never
|
|
78
|
+
* shapes it: those fields are a downstream contract (DWH columns and the
|
|
79
|
+
* dashboards built on their exact values), so inventing a key or a string
|
|
80
|
+
* here would silently break analytics rather than fail a build.
|
|
81
|
+
*
|
|
82
|
+
* The active trace scope's context travels along as `scopeContext`, so the
|
|
83
|
+
* composition root can fall back to what the surrounding operation declared
|
|
84
|
+
* when the call itself names nothing.
|
|
85
|
+
*/
|
|
86
|
+
buildReporterContext(resolved: ResolvedPrompt, callContext: LLMClientCallContext | undefined): unknown;
|
|
87
|
+
/**
|
|
88
|
+
* Builds the per-call trace context every client path threads into the gateway
|
|
89
|
+
* service. The structural `prompt` names the observation and carries the
|
|
90
|
+
* managed prompt version, so the generation the service records on success and
|
|
91
|
+
* on error is the single one Langfuse links to that prompt — the client never
|
|
92
|
+
* records a second observation of its own.
|
|
93
|
+
*
|
|
94
|
+
* `userId`, `sessionId` and `tags` travel as typed trace fields and never
|
|
95
|
+
* through `serializeCallContext`, which is the metadata path. The user
|
|
96
|
+
* therefore appears twice — typed here and, as it always has, inside the
|
|
97
|
+
* metadata bag the existing dashboards read.
|
|
98
|
+
*/
|
|
99
|
+
buildTraceContext(scope: LLMTraceContextScope): LLMCallTraceContext;
|
|
100
|
+
/**
|
|
101
|
+
* The call context holds the user as whatever the application uses for its
|
|
102
|
+
* own ids, while Langfuse holds it as a string. Absent stays absent, so a
|
|
103
|
+
* call that names no user leaves the trace's user field for the scope to fill.
|
|
104
|
+
*/
|
|
105
|
+
private toTraceUserId;
|
|
106
|
+
private assertOverridesAllowed;
|
|
107
|
+
private serializeCallContext;
|
|
108
|
+
private extractStatus;
|
|
109
|
+
private isRetryableStatus;
|
|
110
|
+
}
|