@gaia-framework/backend-core 7.0.0 → 7.1.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/CHANGELOG.md +26 -0
- package/build/openapi/openapi.json +502 -2
- package/build/openapi/openapi.yaml +362 -9
- package/build/openapi/voice-media-worker.json +1 -1
- package/build/openapi/voice-media-worker.yaml +1 -1
- package/build/openapi/worker-health.json +1 -1
- package/build/openapi/worker-health.yaml +1 -1
- package/build/src/config/schema.d.ts +87 -0
- package/build/src/config/schema.d.ts.map +1 -1
- package/build/src/config/schema.js +57 -1
- package/build/src/config/schema.js.map +1 -1
- package/build/src/core/application/dtos/llms/responses/LLMInfoDto.d.ts +2 -1
- package/build/src/core/application/dtos/llms/responses/LLMInfoDto.d.ts.map +1 -1
- package/build/src/core/application/mappers/llms/LLMInfoMapper.d.ts.map +1 -1
- package/build/src/core/application/mappers/llms/LLMInfoMapper.js +2 -0
- package/build/src/core/application/mappers/llms/LLMInfoMapper.js.map +1 -1
- package/build/src/core/application/services/media/VideoGenerationRequestService.js +2 -2
- package/build/src/core/application/services/media/VideoGenerationRequestService.js.map +1 -1
- package/build/src/core/application/services/runs/RunAppServiceImpl.d.ts.map +1 -1
- package/build/src/core/application/services/runs/RunAppServiceImpl.js +16 -4
- package/build/src/core/application/services/runs/RunAppServiceImpl.js.map +1 -1
- package/build/src/core/application/services/tasks/ScheduledRunDispatchService.d.ts.map +1 -1
- package/build/src/core/application/services/tasks/ScheduledRunDispatchService.js +9 -2
- package/build/src/core/application/services/tasks/ScheduledRunDispatchService.js.map +1 -1
- package/build/src/core/application/services/voice/session/VoiceContextService.js +1 -1
- package/build/src/core/application/services/voice/session/VoiceContextService.js.map +1 -1
- package/build/src/core/domain/models/llms/LLMInfo.d.ts +2 -1
- package/build/src/core/domain/models/llms/LLMInfo.d.ts.map +1 -1
- package/build/src/core/domain/models/runs/RunApproval.d.ts +1 -1
- package/build/src/core/domain/models/runs/RunApproval.d.ts.map +1 -1
- package/build/src/core/domain/models/runs/RunApproval.js.map +1 -1
- package/build/src/core/domain/models/speech/Transcription.d.ts +1 -0
- package/build/src/core/domain/models/speech/Transcription.d.ts.map +1 -1
- package/build/src/core/domain/models/videos/VideoGenerationRequest.d.ts +2 -0
- package/build/src/core/domain/models/videos/VideoGenerationRequest.d.ts.map +1 -1
- package/build/src/core/domain/models/videos/VideoGenerationRequest.js +5 -1
- package/build/src/core/domain/models/videos/VideoGenerationRequest.js.map +1 -1
- package/build/src/core/domain/services/chat/ConversationContextService.d.ts +1 -1
- package/build/src/core/domain/services/chat/ConversationContextService.d.ts.map +1 -1
- package/build/src/core/domain/services/chat/ConversationContextServiceImpl.d.ts +1 -1
- package/build/src/core/domain/services/chat/ConversationContextServiceImpl.d.ts.map +1 -1
- package/build/src/core/domain/services/chat/ConversationContextServiceImpl.js +12 -3
- package/build/src/core/domain/services/chat/ConversationContextServiceImpl.js.map +1 -1
- package/build/src/core/domain/services/chat/LLMExecutionServiceImpl.d.ts.map +1 -1
- package/build/src/core/domain/services/chat/LLMExecutionServiceImpl.js +4 -1
- package/build/src/core/domain/services/chat/LLMExecutionServiceImpl.js.map +1 -1
- package/build/src/core/domain/services/chat/VideoInputPolicy.d.ts +5 -0
- package/build/src/core/domain/services/chat/VideoInputPolicy.d.ts.map +1 -0
- package/build/src/core/domain/services/chat/VideoInputPolicy.js +14 -0
- package/build/src/core/domain/services/chat/VideoInputPolicy.js.map +1 -0
- package/build/src/core/domain/services/media/TranscriptionPolicy.js +1 -1
- package/build/src/core/domain/services/media/TranscriptionPolicy.js.map +1 -1
- package/build/src/core/domain/services/models/ModelServiceImpl.d.ts.map +1 -1
- package/build/src/core/domain/services/models/ModelServiceImpl.js +4 -2
- package/build/src/core/domain/services/models/ModelServiceImpl.js.map +1 -1
- package/build/src/core/domain/services/runs/RunToolApprovalProviderCapability.d.ts.map +1 -1
- package/build/src/core/domain/services/runs/RunToolApprovalProviderCapability.js +4 -2
- package/build/src/core/domain/services/runs/RunToolApprovalProviderCapability.js.map +1 -1
- package/build/src/core/infrastructure/ai/alibaba/AlibabaWorkspace.d.ts +8 -0
- package/build/src/core/infrastructure/ai/alibaba/AlibabaWorkspace.d.ts.map +1 -0
- package/build/src/core/infrastructure/ai/alibaba/AlibabaWorkspace.js +16 -0
- package/build/src/core/infrastructure/ai/alibaba/AlibabaWorkspace.js.map +1 -0
- package/build/src/core/infrastructure/ai/embedding/providers/google/GoogleAIEmbeddingService.d.ts +2 -3
- package/build/src/core/infrastructure/ai/embedding/providers/google/GoogleAIEmbeddingService.d.ts.map +1 -1
- package/build/src/core/infrastructure/ai/embedding/providers/google/GoogleAIEmbeddingService.js +42 -17
- package/build/src/core/infrastructure/ai/embedding/providers/google/GoogleAIEmbeddingService.js.map +1 -1
- package/build/src/core/infrastructure/ai/google/GoogleGenAiConnection.d.ts +15 -0
- package/build/src/core/infrastructure/ai/google/GoogleGenAiConnection.d.ts.map +1 -0
- package/build/src/core/infrastructure/ai/google/GoogleGenAiConnection.js +21 -0
- package/build/src/core/infrastructure/ai/google/GoogleGenAiConnection.js.map +1 -0
- package/build/src/core/infrastructure/ai/images/alibaba/QwenImageProviders.d.ts +36 -0
- package/build/src/core/infrastructure/ai/images/alibaba/QwenImageProviders.d.ts.map +1 -0
- package/build/src/core/infrastructure/ai/images/alibaba/QwenImageProviders.js +108 -0
- package/build/src/core/infrastructure/ai/images/alibaba/QwenImageProviders.js.map +1 -0
- package/build/src/core/infrastructure/ai/images/google/GoogleAIImageGenerationProvider.d.ts +3 -3
- package/build/src/core/infrastructure/ai/images/google/GoogleAIImageGenerationProvider.d.ts.map +1 -1
- package/build/src/core/infrastructure/ai/images/google/GoogleAIImageGenerationProvider.js +36 -25
- package/build/src/core/infrastructure/ai/images/google/GoogleAIImageGenerationProvider.js.map +1 -1
- package/build/src/core/infrastructure/ai/images/togetherai/TogetherImageGenerationProvider.d.ts +12 -0
- package/build/src/core/infrastructure/ai/images/togetherai/TogetherImageGenerationProvider.d.ts.map +1 -0
- package/build/src/core/infrastructure/ai/images/togetherai/TogetherImageGenerationProvider.js +97 -0
- package/build/src/core/infrastructure/ai/images/togetherai/TogetherImageGenerationProvider.js.map +1 -0
- package/build/src/core/infrastructure/ai/llm/context/codecs/RunMediaContextCodecs.js +3 -1
- package/build/src/core/infrastructure/ai/llm/context/codecs/RunMediaContextCodecs.js.map +1 -1
- package/build/src/core/infrastructure/ai/llm/providers/alibaba/AlibabaCatalog.d.ts +12 -0
- package/build/src/core/infrastructure/ai/llm/providers/alibaba/AlibabaCatalog.d.ts.map +1 -0
- package/build/src/core/infrastructure/ai/llm/providers/alibaba/AlibabaCatalog.js +46 -0
- package/build/src/core/infrastructure/ai/llm/providers/alibaba/AlibabaCatalog.js.map +1 -0
- package/build/src/core/infrastructure/ai/llm/providers/alibaba/AlibabaLLMProvider.d.ts +24 -0
- package/build/src/core/infrastructure/ai/llm/providers/alibaba/AlibabaLLMProvider.d.ts.map +1 -0
- package/build/src/core/infrastructure/ai/llm/providers/alibaba/AlibabaLLMProvider.js +100 -0
- package/build/src/core/infrastructure/ai/llm/providers/alibaba/AlibabaLLMProvider.js.map +1 -0
- package/build/src/core/infrastructure/ai/llm/providers/bedrock/BedrockCatalog.d.ts +53 -0
- package/build/src/core/infrastructure/ai/llm/providers/bedrock/BedrockCatalog.d.ts.map +1 -0
- package/build/src/core/infrastructure/ai/llm/providers/bedrock/BedrockCatalog.js +178 -0
- package/build/src/core/infrastructure/ai/llm/providers/bedrock/BedrockCatalog.js.map +1 -0
- package/build/src/core/infrastructure/ai/llm/providers/bedrock/BedrockLLMProvider.d.ts +19 -0
- package/build/src/core/infrastructure/ai/llm/providers/bedrock/BedrockLLMProvider.d.ts.map +1 -0
- package/build/src/core/infrastructure/ai/llm/providers/bedrock/BedrockLLMProvider.js +59 -0
- package/build/src/core/infrastructure/ai/llm/providers/bedrock/BedrockLLMProvider.js.map +1 -0
- package/build/src/core/infrastructure/ai/llm/providers/bedrock/BedrockMessages.d.ts +8 -0
- package/build/src/core/infrastructure/ai/llm/providers/bedrock/BedrockMessages.d.ts.map +1 -0
- package/build/src/core/infrastructure/ai/llm/providers/bedrock/BedrockMessages.js +72 -0
- package/build/src/core/infrastructure/ai/llm/providers/bedrock/BedrockMessages.js.map +1 -0
- package/build/src/core/infrastructure/ai/llm/providers/bedrock/BedrockOutput.d.ts +28 -0
- package/build/src/core/infrastructure/ai/llm/providers/bedrock/BedrockOutput.d.ts.map +1 -0
- package/build/src/core/infrastructure/ai/llm/providers/bedrock/BedrockOutput.js +117 -0
- package/build/src/core/infrastructure/ai/llm/providers/bedrock/BedrockOutput.js.map +1 -0
- package/build/src/core/infrastructure/ai/llm/providers/bedrock/BedrockService.d.ts +44 -0
- package/build/src/core/infrastructure/ai/llm/providers/bedrock/BedrockService.d.ts.map +1 -0
- package/build/src/core/infrastructure/ai/llm/providers/bedrock/BedrockService.js +148 -0
- package/build/src/core/infrastructure/ai/llm/providers/bedrock/BedrockService.js.map +1 -0
- package/build/src/core/infrastructure/ai/llm/providers/google/GoogleAIService.d.ts +6 -2
- package/build/src/core/infrastructure/ai/llm/providers/google/GoogleAIService.d.ts.map +1 -1
- package/build/src/core/infrastructure/ai/llm/providers/google/GoogleAIService.js +47 -37
- package/build/src/core/infrastructure/ai/llm/providers/google/GoogleAIService.js.map +1 -1
- package/build/src/core/infrastructure/ai/llm/providers/google/GoogleApprovalCoordinator.d.ts +3 -1
- package/build/src/core/infrastructure/ai/llm/providers/google/GoogleApprovalCoordinator.d.ts.map +1 -1
- package/build/src/core/infrastructure/ai/llm/providers/google/GoogleApprovalCoordinator.js +16 -8
- package/build/src/core/infrastructure/ai/llm/providers/google/GoogleApprovalCoordinator.js.map +1 -1
- package/build/src/core/infrastructure/ai/llm/providers/google/GoogleChatRoute.d.ts +12 -0
- package/build/src/core/infrastructure/ai/llm/providers/google/GoogleChatRoute.d.ts.map +1 -0
- package/build/src/core/infrastructure/ai/llm/providers/google/GoogleChatRoute.js +12 -0
- package/build/src/core/infrastructure/ai/llm/providers/google/GoogleChatRoute.js.map +1 -0
- package/build/src/core/infrastructure/ai/llm/providers/google/GoogleConfig.d.ts.map +1 -1
- package/build/src/core/infrastructure/ai/llm/providers/google/GoogleConfig.js +6 -1
- package/build/src/core/infrastructure/ai/llm/providers/google/GoogleConfig.js.map +1 -1
- package/build/src/core/infrastructure/ai/llm/providers/google/GoogleLLMProvider.d.ts +1 -1
- package/build/src/core/infrastructure/ai/llm/providers/google/GoogleLLMProvider.d.ts.map +1 -1
- package/build/src/core/infrastructure/ai/llm/providers/google/GoogleLLMProvider.js +12 -6
- package/build/src/core/infrastructure/ai/llm/providers/google/GoogleLLMProvider.js.map +1 -1
- package/build/src/core/infrastructure/ai/llm/providers/google/GoogleStructuredOutputPolicy.d.ts.map +1 -1
- package/build/src/core/infrastructure/ai/llm/providers/google/GoogleStructuredOutputPolicy.js +3 -0
- package/build/src/core/infrastructure/ai/llm/providers/google/GoogleStructuredOutputPolicy.js.map +1 -1
- package/build/src/core/infrastructure/ai/llm/providers/google/GoogleTokenCountRequest.d.ts +1 -1
- package/build/src/core/infrastructure/ai/llm/providers/google/GoogleTokenCountRequest.d.ts.map +1 -1
- package/build/src/core/infrastructure/ai/llm/providers/google/GoogleTokenCountRequest.js +14 -1
- package/build/src/core/infrastructure/ai/llm/providers/google/GoogleTokenCountRequest.js.map +1 -1
- package/build/src/core/infrastructure/ai/llm/providers/google/GoogleToolLoop.d.ts +1 -0
- package/build/src/core/infrastructure/ai/llm/providers/google/GoogleToolLoop.d.ts.map +1 -1
- package/build/src/core/infrastructure/ai/llm/providers/google/GoogleToolLoop.js +2 -2
- package/build/src/core/infrastructure/ai/llm/providers/google/GoogleToolLoop.js.map +1 -1
- package/build/src/core/infrastructure/ai/llm/providers/google/GoogleVideoFiles.d.ts +19 -0
- package/build/src/core/infrastructure/ai/llm/providers/google/GoogleVideoFiles.d.ts.map +1 -0
- package/build/src/core/infrastructure/ai/llm/providers/google/GoogleVideoFiles.js +170 -0
- package/build/src/core/infrastructure/ai/llm/providers/google/GoogleVideoFiles.js.map +1 -0
- package/build/src/core/infrastructure/ai/llm/providers/google/VertexChatProfiles.d.ts +4 -0
- package/build/src/core/infrastructure/ai/llm/providers/google/VertexChatProfiles.d.ts.map +1 -0
- package/build/src/core/infrastructure/ai/llm/providers/google/VertexChatProfiles.js +42 -0
- package/build/src/core/infrastructure/ai/llm/providers/google/VertexChatProfiles.js.map +1 -0
- package/build/src/core/infrastructure/ai/llm/providers/google/VertexChatVideo.d.ts +25 -0
- package/build/src/core/infrastructure/ai/llm/providers/google/VertexChatVideo.d.ts.map +1 -0
- package/build/src/core/infrastructure/ai/llm/providers/google/VertexChatVideo.js +106 -0
- package/build/src/core/infrastructure/ai/llm/providers/google/VertexChatVideo.js.map +1 -0
- package/build/src/core/infrastructure/ai/llm/providers/google/realtime/GoogleLiveSocket.d.ts +5 -1
- package/build/src/core/infrastructure/ai/llm/providers/google/realtime/GoogleLiveSocket.d.ts.map +1 -1
- package/build/src/core/infrastructure/ai/llm/providers/google/realtime/GoogleLiveSocket.js +37 -5
- package/build/src/core/infrastructure/ai/llm/providers/google/realtime/GoogleLiveSocket.js.map +1 -1
- package/build/src/core/infrastructure/ai/llm/providers/google/realtime/GoogleRealtimeConfig.d.ts +2 -2
- package/build/src/core/infrastructure/ai/llm/providers/google/realtime/GoogleRealtimeConfig.d.ts.map +1 -1
- package/build/src/core/infrastructure/ai/llm/providers/google/realtime/GoogleRealtimeConfig.js +4 -0
- package/build/src/core/infrastructure/ai/llm/providers/google/realtime/GoogleRealtimeConfig.js.map +1 -1
- package/build/src/core/infrastructure/ai/llm/providers/google/realtime/GoogleRealtimeEventHandlerREgistry.d.ts +1 -1
- package/build/src/core/infrastructure/ai/llm/providers/google/realtime/GoogleRealtimeEventHandlerREgistry.d.ts.map +1 -1
- package/build/src/core/infrastructure/ai/llm/providers/google/realtime/GoogleRealtimeEventHandlerREgistry.js +2 -2
- package/build/src/core/infrastructure/ai/llm/providers/google/realtime/GoogleRealtimeEventHandlerREgistry.js.map +1 -1
- package/build/src/core/infrastructure/ai/llm/providers/google/realtime/GoogleRealtimeProvider.d.ts +6 -1
- package/build/src/core/infrastructure/ai/llm/providers/google/realtime/GoogleRealtimeProvider.d.ts.map +1 -1
- package/build/src/core/infrastructure/ai/llm/providers/google/realtime/GoogleRealtimeProvider.js +29 -12
- package/build/src/core/infrastructure/ai/llm/providers/google/realtime/GoogleRealtimeProvider.js.map +1 -1
- package/build/src/core/infrastructure/ai/llm/providers/google/realtime/GoogleRealtimeToolApprovals.d.ts +1 -1
- package/build/src/core/infrastructure/ai/llm/providers/google/realtime/GoogleRealtimeToolApprovals.d.ts.map +1 -1
- package/build/src/core/infrastructure/ai/llm/providers/google/realtime/GoogleRealtimeToolApprovals.js +2 -2
- package/build/src/core/infrastructure/ai/llm/providers/google/realtime/GoogleRealtimeToolApprovals.js.map +1 -1
- package/build/src/core/infrastructure/ai/llm/providers/google/realtime/GoogleRealtimeTranslationProvider.d.ts +13 -2
- package/build/src/core/infrastructure/ai/llm/providers/google/realtime/GoogleRealtimeTranslationProvider.d.ts.map +1 -1
- package/build/src/core/infrastructure/ai/llm/providers/google/realtime/GoogleRealtimeTranslationProvider.js +22 -9
- package/build/src/core/infrastructure/ai/llm/providers/google/realtime/GoogleRealtimeTranslationProvider.js.map +1 -1
- package/build/src/core/infrastructure/ai/llm/providers/huggingface/HuggingFaceCatalog.d.ts +10 -0
- package/build/src/core/infrastructure/ai/llm/providers/huggingface/HuggingFaceCatalog.d.ts.map +1 -0
- package/build/src/core/infrastructure/ai/llm/providers/huggingface/HuggingFaceCatalog.js +74 -0
- package/build/src/core/infrastructure/ai/llm/providers/huggingface/HuggingFaceCatalog.js.map +1 -0
- package/build/src/core/infrastructure/ai/llm/providers/huggingface/HuggingFaceLLMProvider.d.ts +25 -0
- package/build/src/core/infrastructure/ai/llm/providers/huggingface/HuggingFaceLLMProvider.d.ts.map +1 -0
- package/build/src/core/infrastructure/ai/llm/providers/huggingface/HuggingFaceLLMProvider.js +104 -0
- package/build/src/core/infrastructure/ai/llm/providers/huggingface/HuggingFaceLLMProvider.js.map +1 -0
- package/build/src/core/infrastructure/ai/llm/providers/huggingface/HuggingFaceResponses.d.ts +40 -0
- package/build/src/core/infrastructure/ai/llm/providers/huggingface/HuggingFaceResponses.d.ts.map +1 -0
- package/build/src/core/infrastructure/ai/llm/providers/huggingface/HuggingFaceResponses.js +39 -0
- package/build/src/core/infrastructure/ai/llm/providers/huggingface/HuggingFaceResponses.js.map +1 -0
- package/build/src/core/infrastructure/ai/llm/providers/meta/MetaLLMProvider.d.ts.map +1 -1
- package/build/src/core/infrastructure/ai/llm/providers/meta/MetaLLMProvider.js +2 -30
- package/build/src/core/infrastructure/ai/llm/providers/meta/MetaLLMProvider.js.map +1 -1
- package/build/src/core/infrastructure/ai/llm/providers/nvidia/NvidiaCatalog.d.ts +9 -0
- package/build/src/core/infrastructure/ai/llm/providers/nvidia/NvidiaCatalog.d.ts.map +1 -0
- package/build/src/core/infrastructure/ai/llm/providers/nvidia/NvidiaCatalog.js +87 -0
- package/build/src/core/infrastructure/ai/llm/providers/nvidia/NvidiaCatalog.js.map +1 -0
- package/build/src/core/infrastructure/ai/llm/providers/nvidia/NvidiaService.d.ts +2 -2
- package/build/src/core/infrastructure/ai/llm/providers/nvidia/NvidiaService.d.ts.map +1 -1
- package/build/src/core/infrastructure/ai/llm/providers/nvidia/NvidiaService.js +7 -10
- package/build/src/core/infrastructure/ai/llm/providers/nvidia/NvidiaService.js.map +1 -1
- package/build/src/core/infrastructure/ai/llm/providers/openai/responses/createPortableResponsesContext.d.ts +5 -0
- package/build/src/core/infrastructure/ai/llm/providers/openai/responses/createPortableResponsesContext.d.ts.map +1 -0
- package/build/src/core/infrastructure/ai/llm/providers/openai/responses/createPortableResponsesContext.js +33 -0
- package/build/src/core/infrastructure/ai/llm/providers/openai/responses/createPortableResponsesContext.js.map +1 -0
- package/build/src/core/infrastructure/ai/llm/providers/togetherai/TogetherCatalog.d.ts +13 -0
- package/build/src/core/infrastructure/ai/llm/providers/togetherai/TogetherCatalog.d.ts.map +1 -0
- package/build/src/core/infrastructure/ai/llm/providers/togetherai/TogetherCatalog.js +95 -0
- package/build/src/core/infrastructure/ai/llm/providers/togetherai/TogetherCatalog.js.map +1 -0
- package/build/src/core/infrastructure/ai/llm/providers/togetherai/TogetherLLMProvider.d.ts +29 -0
- package/build/src/core/infrastructure/ai/llm/providers/togetherai/TogetherLLMProvider.d.ts.map +1 -0
- package/build/src/core/infrastructure/ai/llm/providers/togetherai/TogetherLLMProvider.js +167 -0
- package/build/src/core/infrastructure/ai/llm/providers/togetherai/TogetherLLMProvider.js.map +1 -0
- package/build/src/core/infrastructure/ai/speech/GoogleSpeechConnection.d.ts +5 -0
- package/build/src/core/infrastructure/ai/speech/GoogleSpeechConnection.d.ts.map +1 -0
- package/build/src/core/infrastructure/ai/speech/GoogleSpeechConnection.js +26 -0
- package/build/src/core/infrastructure/ai/speech/GoogleSpeechConnection.js.map +1 -0
- package/build/src/core/infrastructure/ai/speech/stt/AzureSpeechToTextProvider.d.ts +7 -7
- package/build/src/core/infrastructure/ai/speech/stt/AzureSpeechToTextProvider.d.ts.map +1 -1
- package/build/src/core/infrastructure/ai/speech/stt/AzureSpeechToTextProvider.js +159 -63
- package/build/src/core/infrastructure/ai/speech/stt/AzureSpeechToTextProvider.js.map +1 -1
- package/build/src/core/infrastructure/ai/speech/stt/GoogleLiveTranscriptionProvider.d.ts +6 -2
- package/build/src/core/infrastructure/ai/speech/stt/GoogleLiveTranscriptionProvider.d.ts.map +1 -1
- package/build/src/core/infrastructure/ai/speech/stt/GoogleLiveTranscriptionProvider.js +22 -13
- package/build/src/core/infrastructure/ai/speech/stt/GoogleLiveTranscriptionProvider.js.map +1 -1
- package/build/src/core/infrastructure/ai/speech/stt/GoogleSpeechToTextProvider.d.ts +12 -6
- package/build/src/core/infrastructure/ai/speech/stt/GoogleSpeechToTextProvider.d.ts.map +1 -1
- package/build/src/core/infrastructure/ai/speech/stt/GoogleSpeechToTextProvider.js +64 -15
- package/build/src/core/infrastructure/ai/speech/stt/GoogleSpeechToTextProvider.js.map +1 -1
- package/build/src/core/infrastructure/ai/speech/stt/TogetherSpeechToTextProvider.d.ts +15 -0
- package/build/src/core/infrastructure/ai/speech/stt/TogetherSpeechToTextProvider.d.ts.map +1 -0
- package/build/src/core/infrastructure/ai/speech/stt/TogetherSpeechToTextProvider.js +81 -0
- package/build/src/core/infrastructure/ai/speech/stt/TogetherSpeechToTextProvider.js.map +1 -0
- package/build/src/core/infrastructure/ai/speech/tts/TogetherTextToSpeechProvider.d.ts +26 -0
- package/build/src/core/infrastructure/ai/speech/tts/TogetherTextToSpeechProvider.d.ts.map +1 -0
- package/build/src/core/infrastructure/ai/speech/tts/TogetherTextToSpeechProvider.js +80 -0
- package/build/src/core/infrastructure/ai/speech/tts/TogetherTextToSpeechProvider.js.map +1 -0
- package/build/src/core/infrastructure/ai/speech/tts/google/GoogleTextToSpeechProvider.d.ts +20 -17
- package/build/src/core/infrastructure/ai/speech/tts/google/GoogleTextToSpeechProvider.d.ts.map +1 -1
- package/build/src/core/infrastructure/ai/speech/tts/google/GoogleTextToSpeechProvider.js +20 -9
- package/build/src/core/infrastructure/ai/speech/tts/google/GoogleTextToSpeechProvider.js.map +1 -1
- package/build/src/core/infrastructure/ai/speech/tts/google/GoogleTtsProtocol.d.ts +2 -1
- package/build/src/core/infrastructure/ai/speech/tts/google/GoogleTtsProtocol.d.ts.map +1 -1
- package/build/src/core/infrastructure/ai/speech/tts/google/GoogleTtsProtocol.js +6 -4
- package/build/src/core/infrastructure/ai/speech/tts/google/GoogleTtsProtocol.js.map +1 -1
- package/build/src/core/infrastructure/ai/speech/tts/google/GoogleTtsWorker.js +24 -8
- package/build/src/core/infrastructure/ai/speech/tts/google/GoogleTtsWorker.js.map +1 -1
- package/build/src/core/infrastructure/ai/tools/implementations/images/ImageEditingTool.js +1 -1
- package/build/src/core/infrastructure/ai/tools/implementations/images/ImageEditingTool.js.map +1 -1
- package/build/src/core/infrastructure/ai/tools/implementations/images/schemas.d.ts +2 -2
- package/build/src/core/infrastructure/ai/tools/implementations/images/schemas.js +2 -2
- package/build/src/core/infrastructure/ai/tools/implementations/images/schemas.js.map +1 -1
- package/build/src/core/infrastructure/ai/tools/implementations/videos/VideoGenerationToolService.d.ts.map +1 -1
- package/build/src/core/infrastructure/ai/tools/implementations/videos/VideoGenerationToolService.js +5 -4
- package/build/src/core/infrastructure/ai/tools/implementations/videos/VideoGenerationToolService.js.map +1 -1
- package/build/src/core/infrastructure/ai/videos/VideoGenerationProviderRegistryImpl.d.ts.map +1 -1
- package/build/src/core/infrastructure/ai/videos/VideoGenerationProviderRegistryImpl.js +4 -1
- package/build/src/core/infrastructure/ai/videos/VideoGenerationProviderRegistryImpl.js.map +1 -1
- package/build/src/core/infrastructure/ai/videos/alibaba/HappyHorseVideoProvider.d.ts +18 -0
- package/build/src/core/infrastructure/ai/videos/alibaba/HappyHorseVideoProvider.d.ts.map +1 -0
- package/build/src/core/infrastructure/ai/videos/alibaba/HappyHorseVideoProvider.js +88 -0
- package/build/src/core/infrastructure/ai/videos/alibaba/HappyHorseVideoProvider.js.map +1 -0
- package/build/src/core/infrastructure/ai/videos/google/GoogleVideoGenerationProvider.d.ts +4 -2
- package/build/src/core/infrastructure/ai/videos/google/GoogleVideoGenerationProvider.d.ts.map +1 -1
- package/build/src/core/infrastructure/ai/videos/google/GoogleVideoGenerationProvider.js +109 -45
- package/build/src/core/infrastructure/ai/videos/google/GoogleVideoGenerationProvider.js.map +1 -1
- package/build/src/core/infrastructure/ai/videos/google/VertexVeoOutput.d.ts +10 -0
- package/build/src/core/infrastructure/ai/videos/google/VertexVeoOutput.d.ts.map +1 -0
- package/build/src/core/infrastructure/ai/videos/google/VertexVeoOutput.js +43 -0
- package/build/src/core/infrastructure/ai/videos/google/VertexVeoOutput.js.map +1 -0
- package/build/src/core/infrastructure/ai/videos/google/omni/OmniVideoAdapter.d.ts +3 -2
- package/build/src/core/infrastructure/ai/videos/google/omni/OmniVideoAdapter.d.ts.map +1 -1
- package/build/src/core/infrastructure/ai/videos/google/omni/OmniVideoAdapter.js +7 -7
- package/build/src/core/infrastructure/ai/videos/google/omni/OmniVideoAdapter.js.map +1 -1
- package/build/src/core/infrastructure/ai/videos/google/omni/OmniVideoOutput.d.ts.map +1 -1
- package/build/src/core/infrastructure/ai/videos/google/omni/OmniVideoOutput.js +4 -4
- package/build/src/core/infrastructure/ai/videos/google/omni/OmniVideoOutput.js.map +1 -1
- package/build/src/core/infrastructure/ai/videos/google/omni/OmniVideoProtocol.d.ts +3 -2
- package/build/src/core/infrastructure/ai/videos/google/omni/OmniVideoProtocol.d.ts.map +1 -1
- package/build/src/core/infrastructure/ai/videos/google/omni/OmniVideoProtocol.js +13 -4
- package/build/src/core/infrastructure/ai/videos/google/omni/OmniVideoProtocol.js.map +1 -1
- package/build/src/core/infrastructure/ai/videos/google/omni/OmniVideoWorker.js +27 -23
- package/build/src/core/infrastructure/ai/videos/google/omni/OmniVideoWorker.js.map +1 -1
- package/build/src/core/infrastructure/ai/videos/togetherai/TogetherVideoGenerationProvider.d.ts +14 -0
- package/build/src/core/infrastructure/ai/videos/togetherai/TogetherVideoGenerationProvider.d.ts.map +1 -0
- package/build/src/core/infrastructure/ai/videos/togetherai/TogetherVideoGenerationProvider.js +113 -0
- package/build/src/core/infrastructure/ai/videos/togetherai/TogetherVideoGenerationProvider.js.map +1 -0
- package/build/src/core/infrastructure/api/v1/controllers/models/ModelsController.d.ts.map +1 -1
- package/build/src/core/infrastructure/api/v1/controllers/models/ModelsController.js +12 -2
- package/build/src/core/infrastructure/api/v1/controllers/models/ModelsController.js.map +1 -1
- package/build/src/core/infrastructure/api/v1/routers/media/audio/openapi/SpeechRouter.openapi.d.ts +1 -0
- package/build/src/core/infrastructure/api/v1/routers/media/audio/openapi/SpeechRouter.openapi.d.ts.map +1 -1
- package/build/src/core/infrastructure/api/v1/routers/media/audio/openapi/SpeechRouter.openapi.js +1 -0
- package/build/src/core/infrastructure/api/v1/routers/media/audio/openapi/SpeechRouter.openapi.js.map +1 -1
- package/build/src/core/infrastructure/api/v1/routers/models/ModelsRouter.openapi.d.ts +36 -34
- package/build/src/core/infrastructure/api/v1/routers/models/ModelsRouter.openapi.d.ts.map +1 -1
- package/build/src/core/infrastructure/api/v1/routers/models/ModelsRouter.openapi.js +51 -17
- package/build/src/core/infrastructure/api/v1/routers/models/ModelsRouter.openapi.js.map +1 -1
- package/build/src/core/infrastructure/api/v1/routers/models/catalogRepresentation.d.ts +4 -0
- package/build/src/core/infrastructure/api/v1/routers/models/catalogRepresentation.d.ts.map +1 -0
- package/build/src/core/infrastructure/api/v1/routers/models/catalogRepresentation.js +4 -0
- package/build/src/core/infrastructure/api/v1/routers/models/catalogRepresentation.js.map +1 -0
- package/build/src/core/infrastructure/api/v1/routers/runs/openapi/RunsRouter.openapi.js +1 -1
- package/build/src/core/infrastructure/api/v1/routers/runs/openapi/RunsRouter.openapi.js.map +1 -1
- package/build/src/core/infrastructure/di/builtInLLMProviders.d.ts.map +1 -1
- package/build/src/core/infrastructure/di/builtInLLMProviders.js +17 -2
- package/build/src/core/infrastructure/di/builtInLLMProviders.js.map +1 -1
- package/build/src/core/infrastructure/di/index.d.ts.map +1 -1
- package/build/src/core/infrastructure/di/index.js +56 -8
- package/build/src/core/infrastructure/di/index.js.map +1 -1
- package/build/src/core/infrastructure/di/types.d.ts +1 -0
- package/build/src/core/infrastructure/di/types.d.ts.map +1 -1
- package/build/src/core/infrastructure/di/types.js +1 -0
- package/build/src/core/infrastructure/di/types.js.map +1 -1
- package/build/src/core/infrastructure/mappers/chat/default/BasicChatMessageMapper.d.ts.map +1 -1
- package/build/src/core/infrastructure/mappers/chat/default/BasicChatMessageMapper.js +4 -6
- package/build/src/core/infrastructure/mappers/chat/default/BasicChatMessageMapper.js.map +1 -1
- package/build/src/core/infrastructure/mappers/chat/google/GeminiChatMessageMapper.d.ts.map +1 -1
- package/build/src/core/infrastructure/mappers/chat/google/GeminiChatMessageMapper.js +9 -0
- package/build/src/core/infrastructure/mappers/chat/google/GeminiChatMessageMapper.js.map +1 -1
- package/build/src/core/infrastructure/persistence/dao/knex/KnexMessageDao.d.ts.map +1 -1
- package/build/src/core/infrastructure/persistence/dao/knex/KnexMessageDao.js +6 -0
- package/build/src/core/infrastructure/persistence/dao/knex/KnexMessageDao.js.map +1 -1
- package/build/src/core/infrastructure/services/audio/TranscriptionWav.js +1 -1
- package/build/src/core/infrastructure/services/audio/TranscriptionWav.js.map +1 -1
- package/build/src/core/infrastructure/services/chat/ProviderRequestUsage.js +1 -1
- package/build/src/core/infrastructure/services/chat/ProviderRequestUsage.js.map +1 -1
- package/build/src/core/infrastructure/services/runs/approval/RunToolInvocationLifecycleImpl.js +1 -0
- package/build/src/core/infrastructure/services/runs/approval/RunToolInvocationLifecycleImpl.js.map +1 -1
- package/build/src/infrastructure/websockets/adapters/ws/WSAdapter.d.ts.map +1 -1
- package/build/src/infrastructure/websockets/adapters/ws/WSAdapter.js +2 -1
- package/build/src/infrastructure/websockets/adapters/ws/WSAdapter.js.map +1 -1
- package/build/src/modules/workspaces/infrastructure/recovery/operator/authority/observer/ExecutionSources.js +1 -1
- package/package.json +2 -1
- package/build/src/core/infrastructure/ai/llm/providers/nvidia/NvidiaConfig.d.ts +0 -3
- package/build/src/core/infrastructure/ai/llm/providers/nvidia/NvidiaConfig.d.ts.map +0 -1
- package/build/src/core/infrastructure/ai/llm/providers/nvidia/NvidiaConfig.js +0 -27
- package/build/src/core/infrastructure/ai/llm/providers/nvidia/NvidiaConfig.js.map +0 -1
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
+
};
|
|
13
|
+
import { ConfigService } from '@gaia-framework/config';
|
|
14
|
+
import { inject, injectable } from 'inversify';
|
|
15
|
+
import { z } from 'zod';
|
|
16
|
+
import { AIExecutionFailure, createAIExecutionFailure, } from '../../../../../domain/errors/AIExecutionFailure.js';
|
|
17
|
+
import CoreTypes from '../../../../di/types.js';
|
|
18
|
+
export const bedrockConfig = 'ai.llm.providers.amazon';
|
|
19
|
+
const foundation = z.object({
|
|
20
|
+
modelId: z.string(),
|
|
21
|
+
modelName: z.string(),
|
|
22
|
+
providerName: z.string(),
|
|
23
|
+
inputModalities: z.array(z.string()),
|
|
24
|
+
outputModalities: z.array(z.string()),
|
|
25
|
+
inferenceTypesSupported: z.array(z.string()),
|
|
26
|
+
modelLifecycle: z.object({ status: z.string() }),
|
|
27
|
+
responseStreamingSupported: z.boolean().optional(),
|
|
28
|
+
inferenceAPIsSupported: z
|
|
29
|
+
.object({
|
|
30
|
+
converse: z.object({ sync: z.boolean(), streaming: z.boolean() }).nullish(),
|
|
31
|
+
})
|
|
32
|
+
.nullish(),
|
|
33
|
+
converse: z
|
|
34
|
+
.object({
|
|
35
|
+
systemRoleSupported: z.boolean().nullish(),
|
|
36
|
+
maxTokensMaximum: z.number().positive().nullish(),
|
|
37
|
+
userImageTypesSupported: z.array(z.string()).nullish(),
|
|
38
|
+
})
|
|
39
|
+
.nullish(),
|
|
40
|
+
});
|
|
41
|
+
const profile = z.object({
|
|
42
|
+
inferenceProfileId: z.string(),
|
|
43
|
+
inferenceProfileName: z.string(),
|
|
44
|
+
status: z.string(),
|
|
45
|
+
models: z.array(z.object({ modelArn: z.string() })),
|
|
46
|
+
});
|
|
47
|
+
function supportsChat(model) {
|
|
48
|
+
if (model.modelLifecycle.status !== 'ACTIVE' ||
|
|
49
|
+
!model.inputModalities.includes('TEXT') ||
|
|
50
|
+
!model.outputModalities.includes('TEXT'))
|
|
51
|
+
return false;
|
|
52
|
+
if (model.inferenceAPIsSupported) {
|
|
53
|
+
const converse = model.inferenceAPIsSupported.converse;
|
|
54
|
+
return converse?.sync === true && converse.streaming;
|
|
55
|
+
}
|
|
56
|
+
// Older control-plane responses omit API capabilities. Only infer known Converse families.
|
|
57
|
+
return (model.responseStreamingSupported === true &&
|
|
58
|
+
/^(?:anthropic\.claude-(?!mythos-5$)|amazon\.(?:ergo-|nova-(?:2-lite|micro|lite|pro)))/.test(model.modelId));
|
|
59
|
+
}
|
|
60
|
+
function modelInfo(row, route, displayName) {
|
|
61
|
+
const imageFormats = row.converse?.userImageTypesSupported ?? [];
|
|
62
|
+
return {
|
|
63
|
+
id: 'amazon/' + route,
|
|
64
|
+
provider: 'Amazon Bedrock',
|
|
65
|
+
providerModel: route,
|
|
66
|
+
displayName,
|
|
67
|
+
type: 'llm',
|
|
68
|
+
supportsTools: /^(?:anthropic\.claude-|amazon\.(?:ergo-|nova-))/.test(row.modelId),
|
|
69
|
+
supportsInstructions: row.converse?.systemRoleSupported ?? true,
|
|
70
|
+
inputModalities: imageFormats.length ? ['text', 'image'] : ['text'],
|
|
71
|
+
outputModalities: ['text'],
|
|
72
|
+
maxOutputTokens: row.converse?.maxTokensMaximum ?? undefined,
|
|
73
|
+
imageFormats,
|
|
74
|
+
defaultSettings: { maxTokens: Math.min(4096, row.converse?.maxTokensMaximum ?? 4096) },
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
export function catalogModels(foundations, profiles) {
|
|
78
|
+
const rows = new Map(foundations.filter(supportsChat).map((row) => [row.modelId, row]));
|
|
79
|
+
const models = new Map();
|
|
80
|
+
for (const row of rows.values()) {
|
|
81
|
+
if (row.inferenceTypesSupported.includes('ON_DEMAND'))
|
|
82
|
+
models.set(row.modelId, modelInfo(row, row.modelId, row.modelName));
|
|
83
|
+
}
|
|
84
|
+
for (const route of profiles) {
|
|
85
|
+
if (route.status !== 'ACTIVE')
|
|
86
|
+
continue;
|
|
87
|
+
const modelId = route.models[0]?.modelArn.split('/').pop();
|
|
88
|
+
const row = modelId && rows.get(modelId);
|
|
89
|
+
if (row)
|
|
90
|
+
models.set(route.inferenceProfileId, modelInfo(row, route.inferenceProfileId, route.inferenceProfileName));
|
|
91
|
+
}
|
|
92
|
+
return [...models.values()].sort((a, b) => a.displayName.localeCompare(b.displayName));
|
|
93
|
+
}
|
|
94
|
+
let BedrockCatalog = class BedrockCatalog {
|
|
95
|
+
config;
|
|
96
|
+
cached;
|
|
97
|
+
pending;
|
|
98
|
+
constructor(config) {
|
|
99
|
+
this.config = config;
|
|
100
|
+
}
|
|
101
|
+
async getModels() {
|
|
102
|
+
if (!this.config.getOptionalBoolean(bedrockConfig + '.enabled'))
|
|
103
|
+
return [];
|
|
104
|
+
if (this.cached && Date.now() < this.cached.expires)
|
|
105
|
+
return this.cached.models;
|
|
106
|
+
this.pending ??= this.refresh().finally(() => {
|
|
107
|
+
this.pending = undefined;
|
|
108
|
+
});
|
|
109
|
+
return this.pending;
|
|
110
|
+
}
|
|
111
|
+
async refresh() {
|
|
112
|
+
try {
|
|
113
|
+
const [raw, profiles] = await Promise.all([this.read('/foundation-models'), this.profiles()]);
|
|
114
|
+
const { modelSummaries } = z.object({ modelSummaries: z.array(z.unknown()) }).parse(raw);
|
|
115
|
+
const rows = modelSummaries.flatMap((value) => {
|
|
116
|
+
const result = foundation.safeParse(value);
|
|
117
|
+
return result.success ? [result.data] : [];
|
|
118
|
+
});
|
|
119
|
+
const models = catalogModels(rows, profiles);
|
|
120
|
+
this.cached = { models, expires: Date.now() + 300_000 };
|
|
121
|
+
return models;
|
|
122
|
+
}
|
|
123
|
+
catch (error) {
|
|
124
|
+
if (error instanceof AIExecutionFailure && !error.retryable) {
|
|
125
|
+
this.cached = undefined;
|
|
126
|
+
throw error;
|
|
127
|
+
}
|
|
128
|
+
if (!this.cached)
|
|
129
|
+
throw createAIExecutionFailure('provider_unavailable');
|
|
130
|
+
this.cached.expires = Date.now() + 30_000;
|
|
131
|
+
return this.cached.models;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
async profiles() {
|
|
135
|
+
const rows = [];
|
|
136
|
+
const query = new URLSearchParams({ typeEquals: 'SYSTEM_DEFINED' });
|
|
137
|
+
const seen = new Set();
|
|
138
|
+
let token;
|
|
139
|
+
do {
|
|
140
|
+
const data = z
|
|
141
|
+
.object({ inferenceProfileSummaries: z.array(profile), nextToken: z.string().nullish() })
|
|
142
|
+
.parse(await this.read('/inference-profiles?' + query));
|
|
143
|
+
rows.push(...data.inferenceProfileSummaries);
|
|
144
|
+
token = data.nextToken;
|
|
145
|
+
if (token) {
|
|
146
|
+
if (seen.has(token))
|
|
147
|
+
throw createAIExecutionFailure('provider_unavailable');
|
|
148
|
+
seen.add(token);
|
|
149
|
+
query.set('nextToken', token);
|
|
150
|
+
}
|
|
151
|
+
} while (token);
|
|
152
|
+
return rows;
|
|
153
|
+
}
|
|
154
|
+
async read(path) {
|
|
155
|
+
const region = this.config.getString(bedrockConfig + '.region');
|
|
156
|
+
const suffix = region.startsWith('cn-') ? 'amazonaws.com.cn' : 'amazonaws.com';
|
|
157
|
+
const response = await fetch('https://bedrock.' + region + '.' + suffix + path, {
|
|
158
|
+
headers: { Authorization: 'Bearer ' + this.config.getString(bedrockConfig + '.apiKey') },
|
|
159
|
+
signal: AbortSignal.timeout(10_000),
|
|
160
|
+
redirect: 'error',
|
|
161
|
+
});
|
|
162
|
+
if (response.ok)
|
|
163
|
+
return response.json();
|
|
164
|
+
await response.body?.cancel();
|
|
165
|
+
if (response.status === 403)
|
|
166
|
+
throw createAIExecutionFailure('provider_access_denied');
|
|
167
|
+
if (response.status === 401)
|
|
168
|
+
throw createAIExecutionFailure('provider_authentication_failed');
|
|
169
|
+
throw createAIExecutionFailure('provider_unavailable');
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
BedrockCatalog = __decorate([
|
|
173
|
+
injectable(),
|
|
174
|
+
__param(0, inject(CoreTypes.ConfigService)),
|
|
175
|
+
__metadata("design:paramtypes", [ConfigService])
|
|
176
|
+
], BedrockCatalog);
|
|
177
|
+
export { BedrockCatalog };
|
|
178
|
+
//# sourceMappingURL=BedrockCatalog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BedrockCatalog.js","sourceRoot":"","sources":["../../../../../../../../src/core/infrastructure/ai/llm/providers/bedrock/BedrockCatalog.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,oDAAoD,CAAC;AAC5D,OAAO,SAAS,MAAM,yBAAyB,CAAC;AAEhD,MAAM,CAAC,MAAM,aAAa,GAAG,yBAAyB,CAAC;AACvD,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;IACxB,eAAe,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACpC,gBAAgB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC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AAC;QACtF,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG;YAAE,MAAM,wBAAwB,CAAC,gCAAgC,CAAC,CAAC;QAC9F,MAAM,wBAAwB,CAAC,sBAAsB,CAAC,CAAC;IACzD,CAAC;CACF,CAAA;AAvEY,cAAc;IAD1B,UAAU,EAAE;IAKE,WAAA,MAAM,CAAC,SAAS,CAAC,aAAa,CAAC,CAAA;qCAA0B,aAAa;GAJxE,cAAc,CAuE1B"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { LLMResponseOptions } from '../../../../../domain/ports/ai/llm/LLMProvider.js';
|
|
2
|
+
import { BaseLLMProvider } from '../../base/BaseLLMProvider.js';
|
|
3
|
+
import { LocalLLMChatProviderService } from '../local/LocalLLMChatProviderService.js';
|
|
4
|
+
import { BedrockCatalog } from './BedrockCatalog.js';
|
|
5
|
+
import { BedrockService } from './BedrockService.js';
|
|
6
|
+
export declare class BedrockLLMProvider extends BaseLLMProvider {
|
|
7
|
+
private readonly catalog;
|
|
8
|
+
private readonly service;
|
|
9
|
+
private readonly chat;
|
|
10
|
+
readonly id = "amazon";
|
|
11
|
+
constructor(catalog: BedrockCatalog, service: BedrockService, chat: LocalLLMChatProviderService);
|
|
12
|
+
supportsBoundedSubagentExecution(): boolean;
|
|
13
|
+
getModels(): Promise<import("./BedrockCatalog.js").BedrockModel[]>;
|
|
14
|
+
isValidModel(id: string): Promise<boolean>;
|
|
15
|
+
getResponse(options: LLMResponseOptions): Promise<import("../../../../../domain/ports/ai/llm/LLMProvider.js").LLMResponse>;
|
|
16
|
+
getResponseEvents(options: LLMResponseOptions): AsyncGenerator<import("../../../../../../main.js").LLMExecutionEvent, any, any>;
|
|
17
|
+
getResponseStream(options: LLMResponseOptions): AsyncGenerator<import("../../../../../../main.js").LLMExecutionEvent, any, any>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=BedrockLLMProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BedrockLLMProvider.d.ts","sourceRoot":"","sources":["../../../../../../../../src/core/infrastructure/ai/llm/providers/bedrock/BedrockLLMProvider.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mDAAmD,CAAC;AAE5F,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,2BAA2B,EAAE,MAAM,yCAAyC,CAAC;AACtF,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,qBACa,kBAAmB,SAAQ,eAAe;IAI3B,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACD,OAAO,CAAC,QAAQ,CAAC,IAAI;IALtE,QAAQ,CAAC,EAAE,YAAY;gBAGoB,OAAO,EAAE,cAAc,EACvB,OAAO,EAAE,cAAc,EACA,IAAI,EAAE,2BAA2B;IAKnG,gCAAgC;IAGhC,SAAS;IAGH,YAAY,CAAC,EAAE,EAAE,MAAM;IAG7B,WAAW,CAAC,OAAO,EAAE,kBAAkB;IAGvC,iBAAiB,CAAC,OAAO,EAAE,kBAAkB;IAG7C,iBAAiB,CAAC,OAAO,EAAE,kBAAkB;CAG9C"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
+
};
|
|
13
|
+
import { inject, injectable } from 'inversify';
|
|
14
|
+
import CoreTypes from '../../../../di/types.js';
|
|
15
|
+
import { BaseLLMProvider } from '../../base/BaseLLMProvider.js';
|
|
16
|
+
import { LocalLLMChatProviderService } from '../local/LocalLLMChatProviderService.js';
|
|
17
|
+
import { BedrockCatalog } from './BedrockCatalog.js';
|
|
18
|
+
import { BedrockService } from './BedrockService.js';
|
|
19
|
+
let BedrockLLMProvider = class BedrockLLMProvider extends BaseLLMProvider {
|
|
20
|
+
catalog;
|
|
21
|
+
service;
|
|
22
|
+
chat;
|
|
23
|
+
id = 'amazon';
|
|
24
|
+
constructor(catalog, service, chat) {
|
|
25
|
+
super();
|
|
26
|
+
this.catalog = catalog;
|
|
27
|
+
this.service = service;
|
|
28
|
+
this.chat = chat;
|
|
29
|
+
}
|
|
30
|
+
supportsBoundedSubagentExecution() {
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
getModels() {
|
|
34
|
+
return this.catalog.getModels();
|
|
35
|
+
}
|
|
36
|
+
async isValidModel(id) {
|
|
37
|
+
return id.startsWith('amazon/') && (await this.getModels()).some((model) => model.id === id);
|
|
38
|
+
}
|
|
39
|
+
getResponse(options) {
|
|
40
|
+
return this.chat.getResponse(this.service, options);
|
|
41
|
+
}
|
|
42
|
+
getResponseEvents(options) {
|
|
43
|
+
return this.chat.getResponseEvents(this.service, options);
|
|
44
|
+
}
|
|
45
|
+
getResponseStream(options) {
|
|
46
|
+
return this.chat.getResponseStream(this.service, options);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
BedrockLLMProvider = __decorate([
|
|
50
|
+
injectable(),
|
|
51
|
+
__param(0, inject(BedrockCatalog)),
|
|
52
|
+
__param(1, inject(BedrockService)),
|
|
53
|
+
__param(2, inject(CoreTypes.LocalLLMChatProviderService)),
|
|
54
|
+
__metadata("design:paramtypes", [BedrockCatalog,
|
|
55
|
+
BedrockService,
|
|
56
|
+
LocalLLMChatProviderService])
|
|
57
|
+
], BedrockLLMProvider);
|
|
58
|
+
export { BedrockLLMProvider };
|
|
59
|
+
//# sourceMappingURL=BedrockLLMProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BedrockLLMProvider.js","sourceRoot":"","sources":["../../../../../../../../src/core/infrastructure/ai/llm/providers/bedrock/BedrockLLMProvider.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,SAAS,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,2BAA2B,EAAE,MAAM,yCAAyC,CAAC;AACtF,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAG9C,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,eAAe;IAIV;IACA;IACuB;IALzD,EAAE,GAAG,QAAQ,CAAC;IAEvB,YAC2C,OAAuB,EACvB,OAAuB,EACA,IAAiC;QAEjG,KAAK,EAAE,CAAC;QAJiC,YAAO,GAAP,OAAO,CAAgB;QACvB,YAAO,GAAP,OAAO,CAAgB;QACA,SAAI,GAAJ,IAAI,CAA6B;IAGnG,CAAC;IAED,gCAAgC;QAC9B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,SAAS;QACP,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;IAClC,CAAC;IACD,KAAK,CAAC,YAAY,CAAC,EAAU;QAC3B,OAAO,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;IAC/F,CAAC;IACD,WAAW,CAAC,OAA2B;QACrC,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACtD,CAAC;IACD,iBAAiB,CAAC,OAA2B;QAC3C,OAAO,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC5D,CAAC;IACD,iBAAiB,CAAC,OAA2B;QAC3C,OAAO,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC5D,CAAC;CACF,CAAA;AA7BY,kBAAkB;IAD9B,UAAU,EAAE;IAKR,WAAA,MAAM,CAAC,cAAc,CAAC,CAAA;IACtB,WAAA,MAAM,CAAC,cAAc,CAAC,CAAA;IACtB,WAAA,MAAM,CAAC,SAAS,CAAC,2BAA2B,CAAC,CAAA;qCAFI,cAAc;QACd,cAAc;QACM,2BAA2B;GANxF,kBAAkB,CA6B9B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Message, SystemContentBlock } from '@aws-sdk/client-bedrock-runtime';
|
|
2
|
+
import type { ChatCompletionMessageParam } from 'openai/resources/chat/completions.js';
|
|
3
|
+
import type { BedrockModel } from './BedrockCatalog.js';
|
|
4
|
+
export declare function bedrockMessages(history: readonly ChatCompletionMessageParam[], model: BedrockModel): {
|
|
5
|
+
system?: SystemContentBlock[] | undefined;
|
|
6
|
+
messages: Message[];
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=BedrockMessages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BedrockMessages.d.ts","sourceRoot":"","sources":["../../../../../../../../src/core/infrastructure/ai/llm/providers/bedrock/BedrockMessages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA6B,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAC9G,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAEvF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAsBxD,wBAAgB,eAAe,CAAC,OAAO,EAAE,SAAS,0BAA0B,EAAE,EAAE,KAAK,EAAE,YAAY;;;EAwClG"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { createAIExecutionFailure } from '../../../../../domain/errors/AIExecutionFailure.js';
|
|
2
|
+
function textBlocks(content, model) {
|
|
3
|
+
if (typeof content === 'string')
|
|
4
|
+
return content.trim() ? [{ text: content }] : [];
|
|
5
|
+
return (content ?? []).flatMap((part) => {
|
|
6
|
+
if (part.type === 'text')
|
|
7
|
+
return part.text.trim() ? [{ text: part.text }] : [];
|
|
8
|
+
if (part.type !== 'image_url')
|
|
9
|
+
throw createAIExecutionFailure('provider_request_rejected');
|
|
10
|
+
const match = /^data:image\/(jpeg|png|gif|webp);base64,([a-z\d+/=]+)$/i.exec(part.image_url.url);
|
|
11
|
+
if (!match || !model.imageFormats.includes(match[1].toLowerCase())) {
|
|
12
|
+
throw createAIExecutionFailure('provider_request_rejected');
|
|
13
|
+
}
|
|
14
|
+
return [
|
|
15
|
+
{
|
|
16
|
+
image: {
|
|
17
|
+
format: match[1].toLowerCase(),
|
|
18
|
+
source: { bytes: Buffer.from(match[2], 'base64') },
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
];
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
export function bedrockMessages(history, model) {
|
|
25
|
+
const messages = [];
|
|
26
|
+
const system = [];
|
|
27
|
+
for (const message of history) {
|
|
28
|
+
if (message.role === 'system' || message.role === 'developer') {
|
|
29
|
+
const parts = textBlocks(message.content, model);
|
|
30
|
+
for (const part of parts)
|
|
31
|
+
if (part.text)
|
|
32
|
+
system.push({ text: part.text });
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
if (message.role === 'function')
|
|
36
|
+
throw createAIExecutionFailure('provider_request_rejected');
|
|
37
|
+
const role = message.role === 'assistant' ? 'assistant' : 'user';
|
|
38
|
+
let blocks = textBlocks(message.content, model);
|
|
39
|
+
if (message.role === 'tool') {
|
|
40
|
+
blocks = [
|
|
41
|
+
{
|
|
42
|
+
toolResult: {
|
|
43
|
+
toolUseId: message.tool_call_id,
|
|
44
|
+
content: [{ text: blocks.map((b) => b.text).join('\n') || 'null' }],
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
];
|
|
48
|
+
}
|
|
49
|
+
if (message.role === 'assistant') {
|
|
50
|
+
for (const call of message.tool_calls ?? []) {
|
|
51
|
+
if (call.type !== 'function')
|
|
52
|
+
throw createAIExecutionFailure('provider_request_rejected');
|
|
53
|
+
blocks.push({
|
|
54
|
+
toolUse: {
|
|
55
|
+
toolUseId: call.id,
|
|
56
|
+
name: call.function.name,
|
|
57
|
+
input: JSON.parse(call.function.arguments),
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
if (!blocks.length)
|
|
63
|
+
continue;
|
|
64
|
+
const previous = messages.at(-1);
|
|
65
|
+
if (previous?.role === role)
|
|
66
|
+
previous.content.push(...blocks);
|
|
67
|
+
else
|
|
68
|
+
messages.push({ role, content: blocks });
|
|
69
|
+
}
|
|
70
|
+
return { messages, ...(system.length && { system }) };
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=BedrockMessages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BedrockMessages.js","sourceRoot":"","sources":["../../../../../../../../src/core/infrastructure/ai/llm/providers/bedrock/BedrockMessages.ts"],"names":[],"mappings":"AAEA,OAAO,EAA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AAI,KAAK,UAAU;oBAAE,MAAM,wBAAwB,CAAC,2BAA2B,CAAC,CAAC;gBAC1F,MAAM,CAAC,IAAI,CAAC;oBACV,OAAO,EAAE;wBACP,SAAS,EAAE,IAAI,CAAC,EAAE;wBAClB,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI;wBACxB,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC;qBAC3C;iBACF,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,MAAM;YAAE,SAAS;QAC7B,MAAM,QAAQ,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QACjC,IAAI,QAAQ,EAAE,IAAI,KAAK,IAAI;YAAE,QAAQ,CAAC,OAAQ,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,CAAC;;YAC1D,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;IAChD,CAAC;IACD,OAAO,EAAE,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,MAAM,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;AACxD,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ConverseCommandOutput, ConverseStreamOutput } from '@aws-sdk/client-bedrock-runtime';
|
|
2
|
+
import type { OpenAICompatibleChatCompletionChunk } from '../../../../models/chat/completions/OpenAICompatibleChatCompletionProtocol.js';
|
|
3
|
+
export declare function bedrockCompletion(result: ConverseCommandOutput, requireComplete: boolean): {
|
|
4
|
+
id: string | undefined;
|
|
5
|
+
usage: {
|
|
6
|
+
prompt_tokens: number;
|
|
7
|
+
completion_tokens: number;
|
|
8
|
+
total_tokens: number;
|
|
9
|
+
} | undefined;
|
|
10
|
+
choices: {
|
|
11
|
+
index: number;
|
|
12
|
+
finish_reason: string;
|
|
13
|
+
message: {
|
|
14
|
+
tool_calls?: {
|
|
15
|
+
id: string | undefined;
|
|
16
|
+
type: string;
|
|
17
|
+
function: {
|
|
18
|
+
name: string | undefined;
|
|
19
|
+
arguments: string;
|
|
20
|
+
};
|
|
21
|
+
}[] | undefined;
|
|
22
|
+
role: string;
|
|
23
|
+
content: string | null;
|
|
24
|
+
};
|
|
25
|
+
}[];
|
|
26
|
+
};
|
|
27
|
+
export declare function bedrockChunks(events: AsyncIterable<ConverseStreamOutput>, requireComplete: boolean): AsyncGenerator<OpenAICompatibleChatCompletionChunk>;
|
|
28
|
+
//# sourceMappingURL=BedrockOutput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BedrockOutput.d.ts","sourceRoot":"","sources":["../../../../../../../../src/core/infrastructure/ai/llm/providers/bedrock/BedrockOutput.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,oBAAoB,EAGrB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,+EAA+E,CAAC;AA6BzI,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,qBAAqB,EAAE,eAAe,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;;;;EA4BxF;AAED,wBAAuB,aAAa,CAClC,MAAM,EAAE,aAAa,CAAC,oBAAoB,CAAC,EAC3C,eAAe,EAAE,OAAO,GACvB,cAAc,CAAC,mCAAmC,CAAC,CAqDrD"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { createAIExecutionFailure } from '../../../../../domain/errors/AIExecutionFailure.js';
|
|
2
|
+
function finish(reason, requireComplete) {
|
|
3
|
+
switch (reason) {
|
|
4
|
+
case 'end_turn':
|
|
5
|
+
case 'stop_sequence':
|
|
6
|
+
return 'stop';
|
|
7
|
+
case 'tool_use':
|
|
8
|
+
return 'tool_calls';
|
|
9
|
+
case 'max_tokens':
|
|
10
|
+
if (!requireComplete)
|
|
11
|
+
return 'length';
|
|
12
|
+
break;
|
|
13
|
+
case 'guardrail_intervened':
|
|
14
|
+
case 'content_filtered':
|
|
15
|
+
return 'content_filter';
|
|
16
|
+
}
|
|
17
|
+
throw createAIExecutionFailure('llm_response_incomplete');
|
|
18
|
+
}
|
|
19
|
+
function usage(value) {
|
|
20
|
+
if (!value || value.inputTokens === undefined || value.outputTokens === undefined)
|
|
21
|
+
return undefined;
|
|
22
|
+
const input = value.inputTokens + (value.cacheReadInputTokens ?? 0) + (value.cacheWriteInputTokens ?? 0);
|
|
23
|
+
return {
|
|
24
|
+
prompt_tokens: input,
|
|
25
|
+
completion_tokens: value.outputTokens,
|
|
26
|
+
total_tokens: input + value.outputTokens,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export function bedrockCompletion(result, requireComplete) {
|
|
30
|
+
const blocks = result.output?.message?.content ?? [];
|
|
31
|
+
const calls = blocks.flatMap(({ toolUse }) => toolUse
|
|
32
|
+
? [
|
|
33
|
+
{
|
|
34
|
+
id: toolUse.toolUseId,
|
|
35
|
+
type: 'function',
|
|
36
|
+
function: { name: toolUse.name, arguments: JSON.stringify(toolUse.input ?? {}) },
|
|
37
|
+
},
|
|
38
|
+
]
|
|
39
|
+
: []);
|
|
40
|
+
const text = blocks.map((block) => block.text ?? '').join('');
|
|
41
|
+
const reason = finish(result.stopReason, requireComplete);
|
|
42
|
+
if ((reason === 'tool_calls') !== Boolean(calls.length))
|
|
43
|
+
throw createAIExecutionFailure('llm_response_incomplete');
|
|
44
|
+
return {
|
|
45
|
+
id: result.$metadata.requestId,
|
|
46
|
+
usage: usage(result.usage),
|
|
47
|
+
choices: [
|
|
48
|
+
{
|
|
49
|
+
index: 0,
|
|
50
|
+
finish_reason: reason,
|
|
51
|
+
message: { role: 'assistant', content: text || null, ...(calls.length && { tool_calls: calls }) },
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
export async function* bedrockChunks(events, requireComplete) {
|
|
57
|
+
const slots = new Map();
|
|
58
|
+
let stopped = false;
|
|
59
|
+
for await (const event of events) {
|
|
60
|
+
const start = event.contentBlockStart;
|
|
61
|
+
const delta = event.contentBlockDelta;
|
|
62
|
+
if (start?.start?.toolUse && start.contentBlockIndex !== undefined) {
|
|
63
|
+
const { name, toolUseId } = start.start.toolUse;
|
|
64
|
+
const index = slots.size;
|
|
65
|
+
slots.set(start.contentBlockIndex, index);
|
|
66
|
+
yield {
|
|
67
|
+
choices: [
|
|
68
|
+
{
|
|
69
|
+
index: 0,
|
|
70
|
+
delta: { tool_calls: [{ index, type: 'function', id: toolUseId, function: { name } }] },
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
else if (delta?.delta?.toolUse?.input !== undefined) {
|
|
76
|
+
const index = slots.get(delta.contentBlockIndex);
|
|
77
|
+
if (index === undefined)
|
|
78
|
+
throw createAIExecutionFailure('llm_response_incomplete');
|
|
79
|
+
yield {
|
|
80
|
+
choices: [
|
|
81
|
+
{
|
|
82
|
+
index: 0,
|
|
83
|
+
delta: { tool_calls: [{ index, function: { arguments: delta.delta.toolUse.input } }] },
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
else if (delta?.delta?.text) {
|
|
89
|
+
yield { choices: [{ index: 0, delta: { content: delta.delta.text } }] };
|
|
90
|
+
}
|
|
91
|
+
else if (event.messageStop) {
|
|
92
|
+
const reason = finish(event.messageStop.stopReason, requireComplete);
|
|
93
|
+
if ((reason === 'tool_calls') !== Boolean(slots.size))
|
|
94
|
+
throw createAIExecutionFailure('llm_response_incomplete');
|
|
95
|
+
stopped = true;
|
|
96
|
+
yield { choices: [{ index: 0, delta: {}, finish_reason: reason }] };
|
|
97
|
+
}
|
|
98
|
+
else if (event.metadata) {
|
|
99
|
+
const chunk = { choices: [], usage: usage(event.metadata.usage) };
|
|
100
|
+
yield chunk;
|
|
101
|
+
}
|
|
102
|
+
else if (event.throttlingException) {
|
|
103
|
+
throw createAIExecutionFailure('provider_rate_limited');
|
|
104
|
+
}
|
|
105
|
+
else if (event.internalServerException ||
|
|
106
|
+
event.serviceUnavailableException ||
|
|
107
|
+
event.modelStreamErrorException) {
|
|
108
|
+
throw createAIExecutionFailure('provider_unavailable');
|
|
109
|
+
}
|
|
110
|
+
else if (event.validationException) {
|
|
111
|
+
throw createAIExecutionFailure('provider_request_rejected');
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
if (!stopped)
|
|
115
|
+
throw createAIExecutionFailure('llm_response_incomplete');
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=BedrockOutput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BedrockOutput.js","sourceRoot":"","sources":["../../../../../../../../src/core/infrastructure/ai/llm/providers/bedrock/BedrockOutput.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,wBAAwB,EAAE,MAAM,oDAAoD,CAAC;AAG9F,SAAS,MAAM,CAAC,MAA8B,EAAE,eAAwB;IACtE,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,UAAU,CAAC;QAChB,KAAK,eAAe;YAClB,OAAO,MAAM,CAAC;QAChB,KAAK,UAAU;YACb,OAAO,YAAY,CAAC;QACtB,KAAK,YAAY;YACf,IAAI,CAAC,eAAe;gBAAE,OAAO,QAAQ,CAAC;YACtC,MAAM;QACR,KAAK,sBAAsB,CAAC;QAC5B,KAAK,kBAAkB;YACrB,OAAO,gBAAgB,CAAC;IAC5B,CAAC;IACD,MAAM,wBAAwB,CAAC,yBAAyB,CAAC,CAAC;AAC5D,CAAC;AAED,SAAS,KAAK,CAAC,KAAkB;IAC/B,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,WAAW,KAAK,SAAS,IAAI,KAAK,CAAC,YAAY,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IACpG,MAAM,KAAK,GAAG,KAAK,CAAC,WAAW,GAAG,CAAC,KAAK,CAAC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KAAK,CAAC;QACd,CAAC;aAAM,IAAI,KAAK,CAAC,mBAAmB,EAAE,CAAC;YACrC,MAAM,wBAAwB,CAAC,uBAAuB,CAAC,CAAC;QAC1D,CAAC;aAAM,IACL,KAAK,CAAC,uBAAuB;YAC7B,KAAK,CAAC,2BAA2B;YACjC,KAAK,CAAC,yBAAyB,EAC/B,CAAC;YACD,MAAM,wBAAwB,CAAC,sBAAsB,CAAC,CAAC;QACzD,CAAC;aAAM,IAAI,KAAK,CAAC,mBAAmB,EAAE,CAAC;YACrC,MAAM,wBAAwB,CAAC,2BAA2B,CAAC,CAAC;QAC9D,CAAC;IACH,CAAC;IACD,IAAI,CAAC,OAAO;QAAE,MAAM,wBAAwB,CAAC,yBAAyB,CAAC,CAAC;AAC1E,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ConfigService } from '@gaia-framework/config';
|
|
2
|
+
import type { ChatCompletionMessageParam } from 'openai/resources/chat/completions.js';
|
|
3
|
+
import type { LLMResponseOptions } from '../../../../../domain/ports/ai/llm/LLMProvider.js';
|
|
4
|
+
import { ToolProcessor } from '../../../tools/processing/ToolProcessor.js';
|
|
5
|
+
import type { LocalLLMChatAdapter } from '../local/LocalLLMChatProviderService.js';
|
|
6
|
+
import { BedrockCatalog, type BedrockModel } from './BedrockCatalog.js';
|
|
7
|
+
export declare class BedrockService implements LocalLLMChatAdapter {
|
|
8
|
+
private readonly config;
|
|
9
|
+
private readonly catalog;
|
|
10
|
+
private readonly tools;
|
|
11
|
+
readonly providerId = "amazon";
|
|
12
|
+
private runtime?;
|
|
13
|
+
constructor(config: ConfigService, catalog: BedrockCatalog, tools: ToolProcessor);
|
|
14
|
+
getModelInfo(id: string): Promise<BedrockModel>;
|
|
15
|
+
validateRequest(model: BedrockModel, options: LLMResponseOptions): Promise<void>;
|
|
16
|
+
private client;
|
|
17
|
+
private request;
|
|
18
|
+
complete(history: readonly ChatCompletionMessageParam[], model: BedrockModel, options: LLMResponseOptions): Promise<{
|
|
19
|
+
id: string | undefined;
|
|
20
|
+
usage: {
|
|
21
|
+
prompt_tokens: number;
|
|
22
|
+
completion_tokens: number;
|
|
23
|
+
total_tokens: number;
|
|
24
|
+
} | undefined;
|
|
25
|
+
choices: {
|
|
26
|
+
index: number;
|
|
27
|
+
finish_reason: string;
|
|
28
|
+
message: {
|
|
29
|
+
tool_calls?: {
|
|
30
|
+
id: string | undefined;
|
|
31
|
+
type: string;
|
|
32
|
+
function: {
|
|
33
|
+
name: string | undefined;
|
|
34
|
+
arguments: string;
|
|
35
|
+
};
|
|
36
|
+
}[] | undefined;
|
|
37
|
+
role: string;
|
|
38
|
+
content: string | null;
|
|
39
|
+
};
|
|
40
|
+
}[];
|
|
41
|
+
}>;
|
|
42
|
+
stream(history: readonly ChatCompletionMessageParam[], model: BedrockModel, options: LLMResponseOptions): Promise<AsyncGenerator<import("../../../../models/chat/completions/OpenAICompatibleChatCompletionProtocol.js").OpenAICompatibleChatCompletionChunk, void, any>>;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=BedrockService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BedrockService.d.ts","sourceRoot":"","sources":["../../../../../../../../src/core/infrastructure/ai/llm/providers/bedrock/BedrockService.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAMvF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mDAAmD,CAAC;AAE5F,OAAO,EAAE,aAAa,EAAE,MAAM,4CAA4C,CAAC;AAG3E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AACnF,OAAO,EAAE,cAAc,EAAiB,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAmBvF,qBACa,cAAe,YAAW,mBAAmB;IAKrB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAChC,OAAO,CAAC,QAAQ,CAAC,OAAO;IACf,OAAO,CAAC,QAAQ,CAAC,KAAK;IANzD,QAAQ,CAAC,UAAU,YAAY;IAC/B,OAAO,CAAC,OAAO,CAAC,CAAuB;gBAGa,MAAM,EAAE,aAAa,EAC9B,OAAO,EAAE,cAAc,EACd,KAAK,EAAE,aAAa;IAGlE,YAAY,CAAC,EAAE,EAAE,MAAM;IAMvB,eAAe,CAAC,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,kBAAkB;IAgBtE,OAAO,CAAC,MAAM;IASd,OAAO,CAAC,OAAO;IAsCT,QAAQ,CACZ,OAAO,EAAE,SAAS,0BAA0B,EAAE,EAC9C,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;IAWvB,MAAM,CACV,OAAO,EAAE,SAAS,0BAA0B,EAAE,EAC9C,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,kBAAkB;CAkB9B"}
|