hume 0.5.16 → 0.6.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/Client.d.ts +4 -3
- package/Client.js +6 -6
- package/api/resources/customModels/client/Client.d.ts +1 -0
- package/api/resources/customModels/resources/datasets/client/Client.d.ts +1 -0
- package/api/resources/customModels/resources/datasets/client/Client.js +38 -30
- package/api/resources/customModels/resources/files/client/Client.d.ts +1 -0
- package/api/resources/customModels/resources/files/client/Client.js +26 -20
- package/api/resources/customModels/resources/jobs/client/Client.d.ts +1 -0
- package/api/resources/customModels/resources/jobs/client/Client.js +6 -4
- package/api/resources/customModels/resources/models/client/Client.d.ts +1 -0
- package/api/resources/customModels/resources/models/client/Client.js +18 -12
- package/api/resources/empathicVoice/client/Client.d.ts +1 -0
- package/api/resources/empathicVoice/resources/chat/types/PublishEvent.d.ts +1 -1
- package/api/resources/empathicVoice/resources/chats/client/Client.d.ts +2 -1
- package/api/resources/empathicVoice/resources/chats/client/Client.js +7 -5
- package/api/resources/empathicVoice/resources/configs/client/Client.d.ts +1 -0
- package/api/resources/empathicVoice/resources/configs/client/Client.js +27 -18
- package/api/resources/empathicVoice/resources/configs/client/requests/PostedConfig.d.ts +1 -0
- package/api/resources/empathicVoice/resources/configs/client/requests/PostedConfigVersion.d.ts +1 -0
- package/api/resources/empathicVoice/resources/prompts/client/Client.d.ts +2 -1
- package/api/resources/empathicVoice/resources/prompts/client/Client.js +28 -19
- package/api/resources/empathicVoice/resources/tools/client/Client.d.ts +2 -1
- package/api/resources/empathicVoice/resources/tools/client/Client.js +28 -19
- package/api/resources/empathicVoice/types/AssistantEnd.d.ts +2 -0
- package/api/resources/empathicVoice/types/AssistantInput.d.ts +1 -0
- package/api/resources/empathicVoice/types/AssistantMessage.d.ts +1 -0
- package/api/resources/empathicVoice/types/AudioInput.d.ts +1 -0
- package/api/resources/empathicVoice/types/AudioOutput.d.ts +1 -0
- package/api/resources/empathicVoice/types/BuiltInTool.d.ts +4 -0
- package/api/resources/empathicVoice/types/BuiltinToolConfig.d.ts +8 -0
- package/api/resources/empathicVoice/types/Context.d.ts +10 -0
- package/api/resources/empathicVoice/types/Context.js +5 -0
- package/api/resources/empathicVoice/types/ContextType.d.ts +9 -0
- package/api/resources/empathicVoice/types/ContextType.js +11 -0
- package/api/resources/empathicVoice/types/PauseAssistantMessage.d.ts +11 -0
- package/api/resources/empathicVoice/types/PauseAssistantMessage.js +5 -0
- package/api/resources/empathicVoice/types/PostedLanguageModelModelProvider.d.ts +2 -2
- package/api/resources/empathicVoice/types/PostedLanguageModelModelProvider.js +1 -1
- package/api/resources/empathicVoice/types/PostedVoice.d.ts +4 -3
- package/api/resources/empathicVoice/types/PostedVoiceName.d.ts +11 -0
- package/api/resources/empathicVoice/types/PostedVoiceName.js +10 -0
- package/api/resources/empathicVoice/types/ResumeAssistantMessage.d.ts +11 -0
- package/api/resources/empathicVoice/types/ResumeAssistantMessage.js +5 -0
- package/api/resources/empathicVoice/types/ReturnChat.d.ts +2 -0
- package/api/resources/empathicVoice/types/{ReturnChatWithPagedEvents.d.ts → ReturnChatPagedEvents.d.ts} +1 -1
- package/api/resources/empathicVoice/types/ReturnChatPagedEvents.js +5 -0
- package/api/resources/empathicVoice/types/ReturnConfig.d.ts +1 -0
- package/api/resources/empathicVoice/types/SessionSettings.d.ts +4 -2
- package/api/resources/empathicVoice/types/Tool.d.ts +6 -6
- package/api/resources/empathicVoice/types/ToolCallMessage.d.ts +5 -4
- package/api/resources/empathicVoice/types/ToolErrorMessage.d.ts +7 -6
- package/api/resources/empathicVoice/types/ToolResponseMessage.d.ts +7 -3
- package/api/resources/empathicVoice/types/UserInput.d.ts +1 -0
- package/api/resources/empathicVoice/types/UserInterruption.d.ts +2 -0
- package/api/resources/empathicVoice/types/WebSocketError.d.ts +1 -0
- package/api/resources/empathicVoice/types/index.d.ts +14 -7
- package/api/resources/empathicVoice/types/index.js +14 -7
- package/api/resources/expressionMeasurement/client/Client.d.ts +1 -0
- package/api/resources/expressionMeasurement/resources/batch/client/Client.d.ts +1 -0
- package/api/resources/expressionMeasurement/resources/batch/client/Client.js +17 -12
- package/api/resources/index.d.ts +1 -1
- package/api/resources/index.js +2 -2
- package/core/fetcher/Fetcher.d.ts +1 -0
- package/core/fetcher/Fetcher.js +106 -20
- package/core/form-data-utils/FormDataWrapper.d.ts +24 -0
- package/core/form-data-utils/FormDataWrapper.js +105 -0
- package/core/form-data-utils/index.d.ts +1 -0
- package/core/form-data-utils/index.js +17 -0
- package/core/index.d.ts +1 -0
- package/core/index.js +1 -0
- package/dist/Client.d.ts +4 -3
- package/dist/Client.js +6 -6
- package/dist/api/resources/customModels/client/Client.d.ts +1 -0
- package/dist/api/resources/customModels/resources/datasets/client/Client.d.ts +1 -0
- package/dist/api/resources/customModels/resources/datasets/client/Client.js +38 -30
- package/dist/api/resources/customModels/resources/files/client/Client.d.ts +1 -0
- package/dist/api/resources/customModels/resources/files/client/Client.js +26 -20
- package/dist/api/resources/customModels/resources/jobs/client/Client.d.ts +1 -0
- package/dist/api/resources/customModels/resources/jobs/client/Client.js +6 -4
- package/dist/api/resources/customModels/resources/models/client/Client.d.ts +1 -0
- package/dist/api/resources/customModels/resources/models/client/Client.js +18 -12
- package/dist/api/resources/empathicVoice/client/Client.d.ts +1 -0
- package/dist/api/resources/empathicVoice/resources/chat/types/PublishEvent.d.ts +1 -1
- package/dist/api/resources/empathicVoice/resources/chats/client/Client.d.ts +2 -1
- package/dist/api/resources/empathicVoice/resources/chats/client/Client.js +7 -5
- package/dist/api/resources/empathicVoice/resources/configs/client/Client.d.ts +1 -0
- package/dist/api/resources/empathicVoice/resources/configs/client/Client.js +27 -18
- package/dist/api/resources/empathicVoice/resources/configs/client/requests/PostedConfig.d.ts +1 -0
- package/dist/api/resources/empathicVoice/resources/configs/client/requests/PostedConfigVersion.d.ts +1 -0
- package/dist/api/resources/empathicVoice/resources/prompts/client/Client.d.ts +2 -1
- package/dist/api/resources/empathicVoice/resources/prompts/client/Client.js +28 -19
- package/dist/api/resources/empathicVoice/resources/tools/client/Client.d.ts +2 -1
- package/dist/api/resources/empathicVoice/resources/tools/client/Client.js +28 -19
- package/dist/api/resources/empathicVoice/types/AssistantEnd.d.ts +2 -0
- package/dist/api/resources/empathicVoice/types/AssistantInput.d.ts +1 -0
- package/dist/api/resources/empathicVoice/types/AssistantMessage.d.ts +1 -0
- package/dist/api/resources/empathicVoice/types/AudioInput.d.ts +1 -0
- package/dist/api/resources/empathicVoice/types/AudioOutput.d.ts +1 -0
- package/dist/api/resources/empathicVoice/types/BuiltInTool.d.ts +4 -0
- package/dist/api/resources/empathicVoice/types/BuiltInTool.js +5 -0
- package/dist/api/resources/empathicVoice/types/BuiltinToolConfig.d.ts +8 -0
- package/dist/api/resources/empathicVoice/types/BuiltinToolConfig.js +5 -0
- package/dist/api/resources/empathicVoice/types/Context.d.ts +10 -0
- package/dist/api/resources/empathicVoice/types/Context.js +5 -0
- package/dist/api/resources/empathicVoice/types/ContextType.d.ts +9 -0
- package/dist/api/resources/empathicVoice/types/ContextType.js +11 -0
- package/dist/api/resources/empathicVoice/types/PauseAssistantMessage.d.ts +11 -0
- package/dist/api/resources/empathicVoice/types/PauseAssistantMessage.js +5 -0
- package/dist/api/resources/empathicVoice/types/PostedLanguageModelModelProvider.d.ts +2 -2
- package/dist/api/resources/empathicVoice/types/PostedLanguageModelModelProvider.js +1 -1
- package/dist/api/resources/empathicVoice/types/PostedVoice.d.ts +4 -3
- package/dist/api/resources/empathicVoice/types/PostedVoiceName.d.ts +11 -0
- package/dist/api/resources/empathicVoice/types/PostedVoiceName.js +10 -0
- package/dist/api/resources/empathicVoice/types/ResumeAssistantMessage.d.ts +11 -0
- package/dist/api/resources/empathicVoice/types/ResumeAssistantMessage.js +5 -0
- package/dist/api/resources/empathicVoice/types/ReturnChat.d.ts +2 -0
- package/dist/api/resources/empathicVoice/types/{ReturnChatWithPagedEvents.d.ts → ReturnChatPagedEvents.d.ts} +1 -1
- package/dist/api/resources/empathicVoice/types/ReturnChatPagedEvents.js +5 -0
- package/dist/api/resources/empathicVoice/types/ReturnConfig.d.ts +1 -0
- package/dist/api/resources/empathicVoice/types/SessionSettings.d.ts +4 -2
- package/dist/api/resources/empathicVoice/types/Tool.d.ts +6 -6
- package/dist/api/resources/empathicVoice/types/ToolCallMessage.d.ts +5 -4
- package/dist/api/resources/empathicVoice/types/ToolErrorMessage.d.ts +7 -6
- package/dist/api/resources/empathicVoice/types/ToolResponseMessage.d.ts +7 -3
- package/dist/api/resources/empathicVoice/types/UserInput.d.ts +1 -0
- package/dist/api/resources/empathicVoice/types/UserInterruption.d.ts +2 -0
- package/dist/api/resources/empathicVoice/types/WebSocketError.d.ts +1 -0
- package/dist/api/resources/empathicVoice/types/index.d.ts +14 -7
- package/dist/api/resources/empathicVoice/types/index.js +14 -7
- package/dist/api/resources/expressionMeasurement/client/Client.d.ts +1 -0
- package/dist/api/resources/expressionMeasurement/resources/batch/client/Client.d.ts +1 -0
- package/dist/api/resources/expressionMeasurement/resources/batch/client/Client.js +17 -12
- package/dist/api/resources/index.d.ts +1 -1
- package/dist/api/resources/index.js +2 -2
- package/dist/core/fetcher/Fetcher.d.ts +1 -0
- package/dist/core/fetcher/Fetcher.js +106 -20
- package/dist/core/form-data-utils/FormDataWrapper.d.ts +24 -0
- package/dist/core/form-data-utils/FormDataWrapper.js +105 -0
- package/dist/core/form-data-utils/index.d.ts +1 -0
- package/dist/core/form-data-utils/index.js +17 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.js +1 -0
- package/dist/serialization/resources/empathicVoice/resources/chat/types/PublishEvent.d.ts +3 -1
- package/dist/serialization/resources/empathicVoice/resources/chat/types/PublishEvent.js +4 -0
- package/dist/serialization/resources/empathicVoice/resources/configs/client/requests/PostedConfig.d.ts +2 -0
- package/dist/serialization/resources/empathicVoice/resources/configs/client/requests/PostedConfig.js +2 -0
- package/dist/serialization/resources/empathicVoice/resources/configs/client/requests/PostedConfigVersion.d.ts +2 -0
- package/dist/serialization/resources/empathicVoice/resources/configs/client/requests/PostedConfigVersion.js +2 -0
- package/dist/serialization/resources/empathicVoice/types/AssistantEnd.d.ts +1 -0
- package/dist/serialization/resources/empathicVoice/types/AssistantEnd.js +1 -0
- package/dist/serialization/resources/empathicVoice/types/BuiltInTool.d.ts +10 -0
- package/dist/serialization/resources/empathicVoice/types/BuiltInTool.js +31 -0
- package/dist/serialization/resources/empathicVoice/types/BuiltinToolConfig.d.ts +14 -0
- package/dist/serialization/resources/empathicVoice/types/BuiltinToolConfig.js +35 -0
- package/dist/serialization/resources/empathicVoice/types/Context.d.ts +14 -0
- package/dist/serialization/resources/empathicVoice/types/Context.js +35 -0
- package/dist/serialization/resources/empathicVoice/types/ContextType.d.ts +10 -0
- package/dist/serialization/resources/empathicVoice/types/ContextType.js +31 -0
- package/dist/serialization/resources/empathicVoice/types/PauseAssistantMessage.d.ts +13 -0
- package/dist/serialization/resources/empathicVoice/types/PauseAssistantMessage.js +34 -0
- package/dist/serialization/resources/empathicVoice/types/PostedLanguageModelModelProvider.d.ts +1 -1
- package/dist/serialization/resources/empathicVoice/types/PostedLanguageModelModelProvider.js +1 -1
- package/dist/serialization/resources/empathicVoice/types/PostedVoice.d.ts +3 -2
- package/dist/serialization/resources/empathicVoice/types/PostedVoice.js +3 -2
- package/dist/serialization/resources/empathicVoice/types/PostedVoiceName.d.ts +10 -0
- package/dist/serialization/resources/empathicVoice/types/PostedVoiceName.js +31 -0
- package/dist/serialization/resources/empathicVoice/types/ResumeAssistantMessage.d.ts +13 -0
- package/dist/serialization/resources/empathicVoice/types/ResumeAssistantMessage.js +34 -0
- package/dist/serialization/resources/empathicVoice/types/ReturnChat.d.ts +1 -0
- package/dist/serialization/resources/empathicVoice/types/ReturnChat.js +1 -0
- package/dist/serialization/resources/empathicVoice/types/{ReturnChatWithPagedEvents.d.ts → ReturnChatPagedEvents.d.ts} +2 -2
- package/dist/serialization/resources/empathicVoice/types/{ReturnChatWithPagedEvents.js → ReturnChatPagedEvents.js} +2 -2
- package/dist/serialization/resources/empathicVoice/types/ReturnConfig.d.ts +2 -0
- package/dist/serialization/resources/empathicVoice/types/ReturnConfig.js +2 -0
- package/dist/serialization/resources/empathicVoice/types/SessionSettings.d.ts +4 -2
- package/dist/serialization/resources/empathicVoice/types/SessionSettings.js +4 -2
- package/dist/serialization/resources/empathicVoice/types/Tool.d.ts +3 -3
- package/dist/serialization/resources/empathicVoice/types/Tool.js +3 -3
- package/dist/serialization/resources/empathicVoice/types/ToolCallMessage.d.ts +3 -3
- package/dist/serialization/resources/empathicVoice/types/ToolCallMessage.js +3 -3
- package/dist/serialization/resources/empathicVoice/types/ToolErrorMessage.d.ts +6 -4
- package/dist/serialization/resources/empathicVoice/types/ToolErrorMessage.js +6 -4
- package/dist/serialization/resources/empathicVoice/types/ToolResponseMessage.d.ts +5 -2
- package/dist/serialization/resources/empathicVoice/types/ToolResponseMessage.js +5 -2
- package/dist/serialization/resources/empathicVoice/types/index.d.ts +14 -7
- package/dist/serialization/resources/empathicVoice/types/index.js +14 -7
- package/dist/serialization/resources/index.d.ts +1 -1
- package/dist/serialization/resources/index.js +2 -2
- package/package.json +3 -1
- package/serialization/resources/empathicVoice/resources/chat/types/PublishEvent.d.ts +3 -1
- package/serialization/resources/empathicVoice/resources/chat/types/PublishEvent.js +4 -0
- package/serialization/resources/empathicVoice/resources/configs/client/requests/PostedConfig.d.ts +2 -0
- package/serialization/resources/empathicVoice/resources/configs/client/requests/PostedConfig.js +2 -0
- package/serialization/resources/empathicVoice/resources/configs/client/requests/PostedConfigVersion.d.ts +2 -0
- package/serialization/resources/empathicVoice/resources/configs/client/requests/PostedConfigVersion.js +2 -0
- package/serialization/resources/empathicVoice/types/AssistantEnd.d.ts +1 -0
- package/serialization/resources/empathicVoice/types/AssistantEnd.js +1 -0
- package/serialization/resources/empathicVoice/types/BuiltInTool.d.ts +10 -0
- package/serialization/resources/empathicVoice/types/BuiltInTool.js +31 -0
- package/serialization/resources/empathicVoice/types/BuiltinToolConfig.d.ts +14 -0
- package/serialization/resources/empathicVoice/types/BuiltinToolConfig.js +35 -0
- package/serialization/resources/empathicVoice/types/Context.d.ts +14 -0
- package/serialization/resources/empathicVoice/types/Context.js +35 -0
- package/serialization/resources/empathicVoice/types/ContextType.d.ts +10 -0
- package/serialization/resources/empathicVoice/types/ContextType.js +31 -0
- package/serialization/resources/empathicVoice/types/PauseAssistantMessage.d.ts +13 -0
- package/serialization/resources/empathicVoice/types/PauseAssistantMessage.js +34 -0
- package/serialization/resources/empathicVoice/types/PostedLanguageModelModelProvider.d.ts +1 -1
- package/serialization/resources/empathicVoice/types/PostedLanguageModelModelProvider.js +1 -1
- package/serialization/resources/empathicVoice/types/PostedVoice.d.ts +3 -2
- package/serialization/resources/empathicVoice/types/PostedVoice.js +3 -2
- package/serialization/resources/empathicVoice/types/PostedVoiceName.d.ts +10 -0
- package/serialization/resources/empathicVoice/types/PostedVoiceName.js +31 -0
- package/serialization/resources/empathicVoice/types/ResumeAssistantMessage.d.ts +13 -0
- package/serialization/resources/empathicVoice/types/ResumeAssistantMessage.js +34 -0
- package/serialization/resources/empathicVoice/types/ReturnChat.d.ts +1 -0
- package/serialization/resources/empathicVoice/types/ReturnChat.js +1 -0
- package/serialization/resources/empathicVoice/types/{ReturnChatWithPagedEvents.d.ts → ReturnChatPagedEvents.d.ts} +2 -2
- package/serialization/resources/empathicVoice/types/{ReturnChatWithPagedEvents.js → ReturnChatPagedEvents.js} +2 -2
- package/serialization/resources/empathicVoice/types/ReturnConfig.d.ts +2 -0
- package/serialization/resources/empathicVoice/types/ReturnConfig.js +2 -0
- package/serialization/resources/empathicVoice/types/SessionSettings.d.ts +4 -2
- package/serialization/resources/empathicVoice/types/SessionSettings.js +4 -2
- package/serialization/resources/empathicVoice/types/Tool.d.ts +3 -3
- package/serialization/resources/empathicVoice/types/Tool.js +3 -3
- package/serialization/resources/empathicVoice/types/ToolCallMessage.d.ts +3 -3
- package/serialization/resources/empathicVoice/types/ToolCallMessage.js +3 -3
- package/serialization/resources/empathicVoice/types/ToolErrorMessage.d.ts +6 -4
- package/serialization/resources/empathicVoice/types/ToolErrorMessage.js +6 -4
- package/serialization/resources/empathicVoice/types/ToolResponseMessage.d.ts +5 -2
- package/serialization/resources/empathicVoice/types/ToolResponseMessage.js +5 -2
- package/serialization/resources/empathicVoice/types/index.d.ts +14 -7
- package/serialization/resources/empathicVoice/types/index.js +14 -7
- package/serialization/resources/index.d.ts +1 -1
- package/serialization/resources/index.js +2 -2
- /package/api/resources/empathicVoice/types/{ReturnChatWithPagedEvents.js → BuiltInTool.js} +0 -0
- /package/{dist/api/resources/empathicVoice/types/ReturnChatWithPagedEvents.js → api/resources/empathicVoice/types/BuiltinToolConfig.js} +0 -0
|
@@ -21,6 +21,7 @@ __exportStar(require("./PostedLanguageModelModelProvider"), exports);
|
|
|
21
21
|
__exportStar(require("./PostedLanguageModel"), exports);
|
|
22
22
|
__exportStar(require("./PostedPromptSpec"), exports);
|
|
23
23
|
__exportStar(require("./PostedUserDefinedToolSpec"), exports);
|
|
24
|
+
__exportStar(require("./PostedVoiceName"), exports);
|
|
24
25
|
__exportStar(require("./PostedVoice"), exports);
|
|
25
26
|
__exportStar(require("./ReturnBuiltinTool"), exports);
|
|
26
27
|
__exportStar(require("./ReturnConfig"), exports);
|
|
@@ -33,7 +34,7 @@ __exportStar(require("./ReturnChat"), exports);
|
|
|
33
34
|
__exportStar(require("./ReturnConfigSpec"), exports);
|
|
34
35
|
__exportStar(require("./ReturnPagedChats"), exports);
|
|
35
36
|
__exportStar(require("./ReturnChatEvent"), exports);
|
|
36
|
-
__exportStar(require("./
|
|
37
|
+
__exportStar(require("./ReturnChatPagedEvents"), exports);
|
|
37
38
|
__exportStar(require("./ReturnActiveChatCount"), exports);
|
|
38
39
|
__exportStar(require("./ReturnActiveChatCountPerTag"), exports);
|
|
39
40
|
__exportStar(require("./AssistantEnd"), exports);
|
|
@@ -42,23 +43,29 @@ __exportStar(require("./AssistantMessage"), exports);
|
|
|
42
43
|
__exportStar(require("./AudioConfiguration"), exports);
|
|
43
44
|
__exportStar(require("./AudioInput"), exports);
|
|
44
45
|
__exportStar(require("./AudioOutput"), exports);
|
|
46
|
+
__exportStar(require("./BuiltInTool"), exports);
|
|
47
|
+
__exportStar(require("./BuiltinToolConfig"), exports);
|
|
45
48
|
__exportStar(require("./ChatMessageToolResult"), exports);
|
|
46
49
|
__exportStar(require("./ChatMessage"), exports);
|
|
47
|
-
__exportStar(require("./
|
|
48
|
-
__exportStar(require("./
|
|
49
|
-
__exportStar(require("./ToolErrorMessage"), exports);
|
|
50
|
-
__exportStar(require("./ToolResponseMessage"), exports);
|
|
51
|
-
__exportStar(require("./ToolType"), exports);
|
|
50
|
+
__exportStar(require("./Context"), exports);
|
|
51
|
+
__exportStar(require("./ContextType"), exports);
|
|
52
52
|
__exportStar(require("./EmotionScores"), exports);
|
|
53
53
|
__exportStar(require("./Encoding"), exports);
|
|
54
54
|
__exportStar(require("./WebSocketError"), exports);
|
|
55
|
+
__exportStar(require("./ErrorLevel"), exports);
|
|
55
56
|
__exportStar(require("./Inference"), exports);
|
|
56
57
|
__exportStar(require("./MillisecondInterval"), exports);
|
|
58
|
+
__exportStar(require("./PauseAssistantMessage"), exports);
|
|
57
59
|
__exportStar(require("./ProsodyInference"), exports);
|
|
60
|
+
__exportStar(require("./ResumeAssistantMessage"), exports);
|
|
58
61
|
__exportStar(require("./Role"), exports);
|
|
59
62
|
__exportStar(require("./SessionSettings"), exports);
|
|
60
|
-
__exportStar(require("./
|
|
63
|
+
__exportStar(require("./Tool"), exports);
|
|
61
64
|
__exportStar(require("./ToolCallMessage"), exports);
|
|
65
|
+
__exportStar(require("./ToolErrorMessage"), exports);
|
|
66
|
+
__exportStar(require("./ToolResponseMessage"), exports);
|
|
67
|
+
__exportStar(require("./ToolType"), exports);
|
|
68
|
+
__exportStar(require("./UserInput"), exports);
|
|
62
69
|
__exportStar(require("./UserInterruption"), exports);
|
|
63
70
|
__exportStar(require("./UserMessage"), exports);
|
|
64
71
|
__exportStar(require("./TtsInput"), exports);
|
|
@@ -44,7 +44,6 @@ const core = __importStar(require("../../../../../../core"));
|
|
|
44
44
|
const url_join_1 = __importDefault(require("url-join"));
|
|
45
45
|
const serializers = __importStar(require("../../../../../../serialization/index"));
|
|
46
46
|
const errors = __importStar(require("../../../../../../errors/index"));
|
|
47
|
-
const form_data_1 = __importDefault(require("form-data"));
|
|
48
47
|
class Batch {
|
|
49
48
|
constructor(_options = {}) {
|
|
50
49
|
this._options = _options;
|
|
@@ -97,11 +96,12 @@ class Batch {
|
|
|
97
96
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
98
97
|
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.HumeEnvironment.Production, "v0/batch/jobs"),
|
|
99
98
|
method: "GET",
|
|
100
|
-
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.
|
|
99
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.6.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
|
|
101
100
|
contentType: "application/json",
|
|
102
101
|
queryParameters: _queryParams,
|
|
103
102
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
104
103
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
104
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
105
105
|
});
|
|
106
106
|
if (_response.ok) {
|
|
107
107
|
return yield serializers.expressionMeasurement.batch.listJobs.Response.parseOrThrow(_response.body, {
|
|
@@ -151,13 +151,14 @@ class Batch {
|
|
|
151
151
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
152
152
|
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.HumeEnvironment.Production, "v0/batch/jobs"),
|
|
153
153
|
method: "POST",
|
|
154
|
-
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.
|
|
154
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.6.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
|
|
155
155
|
contentType: "application/json",
|
|
156
156
|
body: yield serializers.expressionMeasurement.InferenceBaseRequest.jsonOrThrow(request, {
|
|
157
157
|
unrecognizedObjectKeys: "strip",
|
|
158
158
|
}),
|
|
159
159
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
160
160
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
161
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
161
162
|
});
|
|
162
163
|
if (_response.ok) {
|
|
163
164
|
return yield serializers.expressionMeasurement.JobId.parseOrThrow(_response.body, {
|
|
@@ -204,10 +205,11 @@ class Batch {
|
|
|
204
205
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
205
206
|
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.HumeEnvironment.Production, `v0/batch/jobs/${encodeURIComponent(id)}`),
|
|
206
207
|
method: "GET",
|
|
207
|
-
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.
|
|
208
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.6.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
|
|
208
209
|
contentType: "application/json",
|
|
209
210
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
210
211
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
212
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
211
213
|
});
|
|
212
214
|
if (_response.ok) {
|
|
213
215
|
return yield serializers.expressionMeasurement.UnionJob.parseOrThrow(_response.body, {
|
|
@@ -254,10 +256,11 @@ class Batch {
|
|
|
254
256
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
255
257
|
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.HumeEnvironment.Production, `v0/batch/jobs/${encodeURIComponent(id)}/predictions`),
|
|
256
258
|
method: "GET",
|
|
257
|
-
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.
|
|
259
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.6.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
|
|
258
260
|
contentType: "application/json",
|
|
259
261
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
260
262
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
263
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
261
264
|
});
|
|
262
265
|
if (_response.ok) {
|
|
263
266
|
return yield serializers.expressionMeasurement.batch.getJobPredictions.Response.parseOrThrow(_response.body, {
|
|
@@ -298,11 +301,12 @@ class Batch {
|
|
|
298
301
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
299
302
|
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.HumeEnvironment.Production, `v0/batch/jobs/${encodeURIComponent(id)}/artifacts`),
|
|
300
303
|
method: "GET",
|
|
301
|
-
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.
|
|
304
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.6.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
|
|
302
305
|
contentType: "application/json",
|
|
303
306
|
responseType: "streaming",
|
|
304
307
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
305
308
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
309
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
306
310
|
});
|
|
307
311
|
if (_response.ok) {
|
|
308
312
|
return _response.body;
|
|
@@ -341,21 +345,22 @@ class Batch {
|
|
|
341
345
|
startInferenceJobFromLocalFile(file, request, requestOptions) {
|
|
342
346
|
var _a, _b;
|
|
343
347
|
return __awaiter(this, void 0, void 0, function* () {
|
|
344
|
-
const _request = new
|
|
348
|
+
const _request = new core.FormDataWrapper();
|
|
345
349
|
if (request.json != null) {
|
|
346
|
-
_request.append("json", JSON.stringify(request.json));
|
|
350
|
+
yield _request.append("json", JSON.stringify(request.json));
|
|
347
351
|
}
|
|
348
352
|
for (const _file of file) {
|
|
349
|
-
_request.append("file", _file);
|
|
353
|
+
yield _request.append("file", _file);
|
|
350
354
|
}
|
|
355
|
+
const _maybeEncodedRequest = _request.getRequest();
|
|
351
356
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
352
357
|
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.HumeEnvironment.Production, "v0/batch/jobs"),
|
|
353
358
|
method: "POST",
|
|
354
|
-
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.
|
|
355
|
-
|
|
356
|
-
body: _request,
|
|
359
|
+
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", "X-Fern-SDK-Version": "0.6.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), (yield _maybeEncodedRequest.getHeaders())),
|
|
360
|
+
body: yield _maybeEncodedRequest.getBody(),
|
|
357
361
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
358
362
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
363
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
359
364
|
});
|
|
360
365
|
if (_response.ok) {
|
|
361
366
|
return yield serializers.expressionMeasurement.JobId.parseOrThrow(_response.body, {
|
package/api/resources/index.d.ts
CHANGED
package/api/resources/index.js
CHANGED
|
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.expressionMeasurement = exports.
|
|
27
|
-
exports.customModels = __importStar(require("./customModels"));
|
|
26
|
+
exports.expressionMeasurement = exports.customModels = exports.empathicVoice = void 0;
|
|
28
27
|
exports.empathicVoice = __importStar(require("./empathicVoice"));
|
|
28
|
+
exports.customModels = __importStar(require("./customModels"));
|
|
29
29
|
exports.expressionMeasurement = __importStar(require("./expressionMeasurement"));
|
|
@@ -11,6 +11,7 @@ export declare namespace Fetcher {
|
|
|
11
11
|
timeoutMs?: number;
|
|
12
12
|
maxRetries?: number;
|
|
13
13
|
withCredentials?: boolean;
|
|
14
|
+
abortSignal?: AbortSignal;
|
|
14
15
|
responseType?: "json" | "blob" | "streaming" | "text";
|
|
15
16
|
}
|
|
16
17
|
type Error = FailedStatusCodeError | NonJsonError | TimeoutError | UnknownError;
|
package/core/fetcher/Fetcher.js
CHANGED
|
@@ -1,4 +1,27 @@
|
|
|
1
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
26
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
27
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -13,7 +36,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
36
|
};
|
|
14
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
38
|
exports.fetcher = void 0;
|
|
16
|
-
const form_data_1 = __importDefault(require("form-data"));
|
|
17
39
|
const qs_1 = __importDefault(require("qs"));
|
|
18
40
|
const runtime_1 = require("../runtime");
|
|
19
41
|
const INITIAL_RETRY_DELAY = 1;
|
|
@@ -37,18 +59,34 @@ function fetcherImpl(args) {
|
|
|
37
59
|
? `${args.url}?${qs_1.default.stringify(args.queryParameters, { arrayFormat: "repeat" })}`
|
|
38
60
|
: args.url;
|
|
39
61
|
let body = undefined;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
62
|
+
const maybeStringifyBody = (body) => {
|
|
63
|
+
if (body instanceof Uint8Array) {
|
|
64
|
+
return body;
|
|
65
|
+
}
|
|
66
|
+
else if (args.contentType === "application/x-www-form-urlencoded" && typeof args.body === "string") {
|
|
67
|
+
return args.body;
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
return JSON.stringify(body);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
if (runtime_1.RUNTIME.type === "node") {
|
|
74
|
+
if (args.body instanceof (yield Promise.resolve().then(() => __importStar(require("formdata-node")))).FormData) {
|
|
75
|
+
// @ts-expect-error
|
|
76
|
+
body = args.body;
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
body = maybeStringifyBody(args.body);
|
|
80
|
+
}
|
|
49
81
|
}
|
|
50
82
|
else {
|
|
51
|
-
body
|
|
83
|
+
if (args.body instanceof (yield Promise.resolve().then(() => __importStar(require("form-data")))).default) {
|
|
84
|
+
// @ts-expect-error
|
|
85
|
+
body = args.body;
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
body = maybeStringifyBody(args.body);
|
|
89
|
+
}
|
|
52
90
|
}
|
|
53
91
|
// In Node.js environments, the SDK always uses`node-fetch`.
|
|
54
92
|
// If not in Node.js the SDK uses global fetch if available,
|
|
@@ -56,25 +94,32 @@ function fetcherImpl(args) {
|
|
|
56
94
|
const fetchFn = runtime_1.RUNTIME.type === "node"
|
|
57
95
|
? // `.default` is required due to this issue:
|
|
58
96
|
// https://github.com/node-fetch/node-fetch/issues/450#issuecomment-387045223
|
|
59
|
-
require("node-fetch").default
|
|
97
|
+
(yield Promise.resolve().then(() => __importStar(require("node-fetch")))).default
|
|
60
98
|
: typeof fetch == "function"
|
|
61
99
|
? fetch
|
|
62
|
-
: require("node-fetch").default;
|
|
100
|
+
: (yield Promise.resolve().then(() => __importStar(require("node-fetch")))).default;
|
|
63
101
|
const makeRequest = () => __awaiter(this, void 0, void 0, function* () {
|
|
64
|
-
const
|
|
65
|
-
|
|
102
|
+
const signals = [];
|
|
103
|
+
// Add timeout signal
|
|
104
|
+
let timeoutAbortId = undefined;
|
|
66
105
|
if (args.timeoutMs != null) {
|
|
67
|
-
abortId =
|
|
106
|
+
const { signal, abortId } = getTimeoutSignal(args.timeoutMs);
|
|
107
|
+
timeoutAbortId = abortId;
|
|
108
|
+
signals.push(signal);
|
|
109
|
+
}
|
|
110
|
+
// Add arbitrary signal
|
|
111
|
+
if (args.abortSignal != null) {
|
|
112
|
+
signals.push(args.abortSignal);
|
|
68
113
|
}
|
|
69
114
|
const response = yield fetchFn(url, {
|
|
70
115
|
method: args.method,
|
|
71
116
|
headers,
|
|
72
117
|
body,
|
|
73
|
-
signal:
|
|
118
|
+
signal: anySignal(signals),
|
|
74
119
|
credentials: args.withCredentials ? "include" : undefined,
|
|
75
120
|
});
|
|
76
|
-
if (
|
|
77
|
-
clearTimeout(
|
|
121
|
+
if (timeoutAbortId != null) {
|
|
122
|
+
clearTimeout(timeoutAbortId);
|
|
78
123
|
}
|
|
79
124
|
return response;
|
|
80
125
|
});
|
|
@@ -140,7 +185,16 @@ function fetcherImpl(args) {
|
|
|
140
185
|
}
|
|
141
186
|
}
|
|
142
187
|
catch (error) {
|
|
143
|
-
if (
|
|
188
|
+
if (args.abortSignal != null && args.abortSignal.aborted) {
|
|
189
|
+
return {
|
|
190
|
+
ok: false,
|
|
191
|
+
error: {
|
|
192
|
+
reason: "unknown",
|
|
193
|
+
errorMessage: "The user aborted a request",
|
|
194
|
+
},
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
else if (error instanceof Error && error.name === "AbortError") {
|
|
144
198
|
return {
|
|
145
199
|
ok: false,
|
|
146
200
|
error: {
|
|
@@ -167,4 +221,36 @@ function fetcherImpl(args) {
|
|
|
167
221
|
}
|
|
168
222
|
});
|
|
169
223
|
}
|
|
224
|
+
const TIMEOUT = "timeout";
|
|
225
|
+
function getTimeoutSignal(timeoutMs) {
|
|
226
|
+
const controller = new AbortController();
|
|
227
|
+
const abortId = setTimeout(() => controller.abort(TIMEOUT), timeoutMs);
|
|
228
|
+
return { signal: controller.signal, abortId };
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Returns an abort signal that is getting aborted when
|
|
232
|
+
* at least one of the specified abort signals is aborted.
|
|
233
|
+
*
|
|
234
|
+
* Requires at least node.js 18.
|
|
235
|
+
*/
|
|
236
|
+
function anySignal(...args) {
|
|
237
|
+
// Allowing signals to be passed either as array
|
|
238
|
+
// of signals or as multiple arguments.
|
|
239
|
+
const signals = (args.length === 1 && Array.isArray(args[0]) ? args[0] : args);
|
|
240
|
+
const controller = new AbortController();
|
|
241
|
+
for (const signal of signals) {
|
|
242
|
+
if (signal.aborted) {
|
|
243
|
+
// Exiting early if one of the signals
|
|
244
|
+
// is already aborted.
|
|
245
|
+
controller.abort(signal === null || signal === void 0 ? void 0 : signal.reason);
|
|
246
|
+
break;
|
|
247
|
+
}
|
|
248
|
+
// Listening for signals and removing the listeners
|
|
249
|
+
// when at least one symbol is aborted.
|
|
250
|
+
signal.addEventListener("abort", () => controller.abort(signal === null || signal === void 0 ? void 0 : signal.reason), {
|
|
251
|
+
signal: controller.signal,
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
return controller.signal;
|
|
255
|
+
}
|
|
170
256
|
exports.fetcher = fetcherImpl;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
declare class FormDataRequestBody {
|
|
2
|
+
private fd;
|
|
3
|
+
private encoder;
|
|
4
|
+
constructor(fd: any);
|
|
5
|
+
setup(): Promise<void>;
|
|
6
|
+
/**
|
|
7
|
+
* @returns the multipart form data request
|
|
8
|
+
*/
|
|
9
|
+
getBody(): Promise<any>;
|
|
10
|
+
/**
|
|
11
|
+
* @returns headers that need to be added to the multipart form data request
|
|
12
|
+
*/
|
|
13
|
+
getHeaders(): Promise<Record<string, string>>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* FormDataWrapper is a utility to make form data
|
|
17
|
+
* requests across both Browser and Node.js runtimes.
|
|
18
|
+
*/
|
|
19
|
+
export declare class FormDataWrapper {
|
|
20
|
+
private fd;
|
|
21
|
+
append(name: string, value: any): Promise<void>;
|
|
22
|
+
getRequest(): FormDataRequestBody;
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,105 @@
|
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
+
exports.FormDataWrapper = void 0;
|
|
36
|
+
const runtime_1 = require("../runtime");
|
|
37
|
+
class FormDataRequestBody {
|
|
38
|
+
constructor(fd) {
|
|
39
|
+
this.fd = fd;
|
|
40
|
+
}
|
|
41
|
+
setup() {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
if (this.encoder == null && runtime_1.RUNTIME.type === "node") {
|
|
44
|
+
this.encoder = new (yield Promise.resolve().then(() => __importStar(require("form-data-encoder")))).FormDataEncoder(this.fd);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* @returns the multipart form data request
|
|
50
|
+
*/
|
|
51
|
+
getBody() {
|
|
52
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
53
|
+
if (runtime_1.RUNTIME.type !== "node") {
|
|
54
|
+
return this.fd;
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
if (this.encoder == null) {
|
|
58
|
+
yield this.setup();
|
|
59
|
+
}
|
|
60
|
+
return (yield Promise.resolve().then(() => __importStar(require("node:stream")))).Readable.from(this.encoder);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* @returns headers that need to be added to the multipart form data request
|
|
66
|
+
*/
|
|
67
|
+
getHeaders() {
|
|
68
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
69
|
+
if (runtime_1.RUNTIME.type !== "node") {
|
|
70
|
+
return {};
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
if (this.encoder == null) {
|
|
74
|
+
yield this.setup();
|
|
75
|
+
}
|
|
76
|
+
return {
|
|
77
|
+
"Content-Length": this.encoder.length,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* FormDataWrapper is a utility to make form data
|
|
85
|
+
* requests across both Browser and Node.js runtimes.
|
|
86
|
+
*/
|
|
87
|
+
class FormDataWrapper {
|
|
88
|
+
append(name, value) {
|
|
89
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
90
|
+
if (this.fd == null) {
|
|
91
|
+
if (runtime_1.RUNTIME.type === "node") {
|
|
92
|
+
this.fd = new (yield Promise.resolve().then(() => __importStar(require("formdata-node")))).FormData();
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
this.fd = new (yield Promise.resolve().then(() => __importStar(require("form-data")))).default();
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
this.fd.append(name, value);
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
getRequest() {
|
|
102
|
+
return new FormDataRequestBody(this.fd);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
exports.FormDataWrapper = FormDataWrapper;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./FormDataWrapper";
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
__exportStar(require("./FormDataWrapper"), exports);
|
package/core/index.d.ts
CHANGED
package/core/index.js
CHANGED
|
@@ -29,5 +29,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
29
29
|
exports.serialization = void 0;
|
|
30
30
|
__exportStar(require("./fetcher"), exports);
|
|
31
31
|
__exportStar(require("./runtime"), exports);
|
|
32
|
+
__exportStar(require("./form-data-utils"), exports);
|
|
32
33
|
__exportStar(require("./websocket"), exports);
|
|
33
34
|
exports.serialization = __importStar(require("./schemas"));
|
package/dist/Client.d.ts
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as environments from "./environments";
|
|
5
5
|
import * as core from "./core";
|
|
6
|
-
import { CustomModels } from "./api/resources/customModels/client/Client";
|
|
7
6
|
import { EmpathicVoice } from "./api/resources/empathicVoice/client/Client";
|
|
7
|
+
import { CustomModels } from "./api/resources/customModels/client/Client";
|
|
8
8
|
import { ExpressionMeasurement } from "./api/resources/expressionMeasurement/client/Client";
|
|
9
9
|
export declare namespace HumeClient {
|
|
10
10
|
interface Options {
|
|
@@ -15,15 +15,16 @@ export declare namespace HumeClient {
|
|
|
15
15
|
interface RequestOptions {
|
|
16
16
|
timeoutInSeconds?: number;
|
|
17
17
|
maxRetries?: number;
|
|
18
|
+
abortSignal?: AbortSignal;
|
|
18
19
|
}
|
|
19
20
|
}
|
|
20
21
|
export declare class HumeClient {
|
|
21
22
|
protected readonly _options: HumeClient.Options;
|
|
22
23
|
constructor(_options?: HumeClient.Options);
|
|
23
|
-
protected _customModels: CustomModels | undefined;
|
|
24
|
-
get customModels(): CustomModels;
|
|
25
24
|
protected _empathicVoice: EmpathicVoice | undefined;
|
|
26
25
|
get empathicVoice(): EmpathicVoice;
|
|
26
|
+
protected _customModels: CustomModels | undefined;
|
|
27
|
+
get customModels(): CustomModels;
|
|
27
28
|
protected _expressionMeasurement: ExpressionMeasurement | undefined;
|
|
28
29
|
get expressionMeasurement(): ExpressionMeasurement;
|
|
29
30
|
}
|
package/dist/Client.js
CHANGED
|
@@ -4,20 +4,20 @@
|
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.HumeClient = void 0;
|
|
7
|
-
const Client_1 = require("./api/resources/
|
|
8
|
-
const Client_2 = require("./api/resources/
|
|
7
|
+
const Client_1 = require("./api/resources/empathicVoice/client/Client");
|
|
8
|
+
const Client_2 = require("./api/resources/customModels/client/Client");
|
|
9
9
|
const Client_3 = require("./api/resources/expressionMeasurement/client/Client");
|
|
10
10
|
class HumeClient {
|
|
11
11
|
constructor(_options = {}) {
|
|
12
12
|
this._options = _options;
|
|
13
13
|
}
|
|
14
|
-
get
|
|
14
|
+
get empathicVoice() {
|
|
15
15
|
var _a;
|
|
16
|
-
return ((_a = this.
|
|
16
|
+
return ((_a = this._empathicVoice) !== null && _a !== void 0 ? _a : (this._empathicVoice = new Client_1.EmpathicVoice(this._options)));
|
|
17
17
|
}
|
|
18
|
-
get
|
|
18
|
+
get customModels() {
|
|
19
19
|
var _a;
|
|
20
|
-
return ((_a = this.
|
|
20
|
+
return ((_a = this._customModels) !== null && _a !== void 0 ? _a : (this._customModels = new Client_2.CustomModels(this._options)));
|
|
21
21
|
}
|
|
22
22
|
get expressionMeasurement() {
|
|
23
23
|
var _a;
|