hume 0.8.1-beta5 → 0.8.1-beta7
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/.mock/definition/empathic-voice/__package__.yml +498 -71
- package/.mock/definition/empathic-voice/configs.yml +40 -0
- package/.mock/definition/expression-measurement/__package__.yml +13 -11
- package/.mock/definition/expression-measurement/stream.yml +4 -0
- package/.mock/fern.config.json +1 -1
- package/api/resources/empathicVoice/resources/chat/client/Client.d.ts +6 -0
- package/api/resources/empathicVoice/resources/chat/client/Client.js +11 -1
- package/api/resources/empathicVoice/resources/chat/client/Socket.d.ts +7 -0
- package/api/resources/empathicVoice/resources/chat/client/Socket.js +31 -0
- 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/types/AssistantEnd.d.ts +5 -1
- package/api/resources/empathicVoice/types/AssistantInput.d.ts +6 -2
- package/api/resources/empathicVoice/types/AssistantMessage.d.ts +7 -3
- package/api/resources/empathicVoice/types/AudioConfiguration.d.ts +3 -3
- package/api/resources/empathicVoice/types/AudioInput.d.ts +12 -2
- package/api/resources/empathicVoice/types/AudioOutput.d.ts +2 -2
- package/api/resources/empathicVoice/types/BuiltInTool.d.ts +3 -0
- package/api/resources/empathicVoice/types/BuiltinToolConfig.d.ts +1 -0
- package/api/resources/empathicVoice/types/ChatMetadata.d.ts +13 -3
- package/api/resources/empathicVoice/types/Context.d.ts +16 -2
- package/api/resources/empathicVoice/types/Inference.d.ts +5 -1
- package/api/resources/empathicVoice/types/JsonMessage.d.ts +5 -0
- package/api/resources/empathicVoice/types/JsonMessage.js +5 -0
- package/api/resources/empathicVoice/types/PauseAssistantMessage.d.ts +5 -1
- package/api/resources/empathicVoice/types/PostedTimeoutSpecs.d.ts +12 -2
- package/api/resources/empathicVoice/types/PostedTimeoutSpecsInactivity.d.ts +18 -0
- package/api/resources/empathicVoice/types/PostedTimeoutSpecsInactivity.js +5 -0
- package/api/resources/empathicVoice/types/PostedTimeoutSpecsMaxDuration.d.ts +18 -0
- package/api/resources/empathicVoice/types/PostedTimeoutSpecsMaxDuration.js +5 -0
- package/api/resources/empathicVoice/types/ProsodyInference.d.ts +5 -0
- package/api/resources/empathicVoice/types/ResumeAssistantMessage.d.ts +5 -1
- package/api/resources/empathicVoice/types/ReturnConfig.d.ts +1 -0
- package/api/resources/empathicVoice/types/SessionSettings.d.ts +52 -8
- package/api/resources/empathicVoice/types/Tool.d.ts +9 -5
- package/api/resources/empathicVoice/types/ToolCallMessage.d.ts +17 -5
- package/api/resources/empathicVoice/types/ToolErrorMessage.d.ts +14 -6
- package/api/resources/empathicVoice/types/ToolResponseMessage.d.ts +17 -3
- package/api/resources/empathicVoice/types/UserInput.d.ts +6 -2
- package/api/resources/empathicVoice/types/UserInterruption.d.ts +5 -1
- package/api/resources/empathicVoice/types/UserMessage.d.ts +6 -2
- package/api/resources/empathicVoice/types/WebSocketError.d.ts +8 -4
- package/api/resources/empathicVoice/types/index.d.ts +3 -0
- package/api/resources/empathicVoice/types/index.js +3 -0
- package/dist/api/resources/empathicVoice/resources/chat/client/Client.d.ts +6 -0
- package/dist/api/resources/empathicVoice/resources/chat/client/Client.js +11 -1
- package/dist/api/resources/empathicVoice/resources/chat/client/Socket.d.ts +7 -0
- package/dist/api/resources/empathicVoice/resources/chat/client/Socket.js +31 -0
- 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/types/AssistantEnd.d.ts +5 -1
- package/dist/api/resources/empathicVoice/types/AssistantInput.d.ts +6 -2
- package/dist/api/resources/empathicVoice/types/AssistantMessage.d.ts +7 -3
- package/dist/api/resources/empathicVoice/types/AudioConfiguration.d.ts +3 -3
- package/dist/api/resources/empathicVoice/types/AudioInput.d.ts +12 -2
- package/dist/api/resources/empathicVoice/types/AudioOutput.d.ts +2 -2
- package/dist/api/resources/empathicVoice/types/BuiltInTool.d.ts +3 -0
- package/dist/api/resources/empathicVoice/types/BuiltinToolConfig.d.ts +1 -0
- package/dist/api/resources/empathicVoice/types/ChatMetadata.d.ts +13 -3
- package/dist/api/resources/empathicVoice/types/Context.d.ts +16 -2
- package/dist/api/resources/empathicVoice/types/Inference.d.ts +5 -1
- package/dist/api/resources/empathicVoice/types/JsonMessage.d.ts +5 -0
- package/dist/api/resources/empathicVoice/types/JsonMessage.js +5 -0
- package/dist/api/resources/empathicVoice/types/PauseAssistantMessage.d.ts +5 -1
- package/dist/api/resources/empathicVoice/types/PostedTimeoutSpecs.d.ts +12 -2
- package/dist/api/resources/empathicVoice/types/PostedTimeoutSpecsInactivity.d.ts +18 -0
- package/dist/api/resources/empathicVoice/types/PostedTimeoutSpecsInactivity.js +5 -0
- package/dist/api/resources/empathicVoice/types/PostedTimeoutSpecsMaxDuration.d.ts +18 -0
- package/dist/api/resources/empathicVoice/types/PostedTimeoutSpecsMaxDuration.js +5 -0
- package/dist/api/resources/empathicVoice/types/ProsodyInference.d.ts +5 -0
- package/dist/api/resources/empathicVoice/types/ResumeAssistantMessage.d.ts +5 -1
- package/dist/api/resources/empathicVoice/types/ReturnConfig.d.ts +1 -0
- package/dist/api/resources/empathicVoice/types/SessionSettings.d.ts +52 -8
- package/dist/api/resources/empathicVoice/types/Tool.d.ts +9 -5
- package/dist/api/resources/empathicVoice/types/ToolCallMessage.d.ts +17 -5
- package/dist/api/resources/empathicVoice/types/ToolErrorMessage.d.ts +14 -6
- package/dist/api/resources/empathicVoice/types/ToolResponseMessage.d.ts +17 -3
- package/dist/api/resources/empathicVoice/types/UserInput.d.ts +6 -2
- package/dist/api/resources/empathicVoice/types/UserInterruption.d.ts +5 -1
- package/dist/api/resources/empathicVoice/types/UserMessage.d.ts +6 -2
- package/dist/api/resources/empathicVoice/types/WebSocketError.d.ts +8 -4
- package/dist/api/resources/empathicVoice/types/index.d.ts +3 -0
- package/dist/api/resources/empathicVoice/types/index.js +3 -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/JsonMessage.d.ts +18 -0
- package/dist/serialization/resources/empathicVoice/types/JsonMessage.js +48 -0
- package/dist/serialization/resources/empathicVoice/types/PostedTimeoutSpecs.d.ts +4 -3
- package/dist/serialization/resources/empathicVoice/types/PostedTimeoutSpecs.js +4 -3
- package/dist/serialization/resources/empathicVoice/types/PostedTimeoutSpecsInactivity.d.ts +13 -0
- package/dist/serialization/resources/empathicVoice/types/PostedTimeoutSpecsInactivity.js +34 -0
- package/dist/serialization/resources/empathicVoice/types/PostedTimeoutSpecsMaxDuration.d.ts +13 -0
- package/dist/serialization/resources/empathicVoice/types/PostedTimeoutSpecsMaxDuration.js +34 -0
- 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/index.d.ts +3 -0
- package/dist/serialization/resources/empathicVoice/types/index.js +3 -0
- package/package.json +1 -1
- 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/JsonMessage.d.ts +18 -0
- package/serialization/resources/empathicVoice/types/JsonMessage.js +48 -0
- package/serialization/resources/empathicVoice/types/PostedTimeoutSpecs.d.ts +4 -3
- package/serialization/resources/empathicVoice/types/PostedTimeoutSpecs.js +4 -3
- package/serialization/resources/empathicVoice/types/PostedTimeoutSpecsInactivity.d.ts +13 -0
- package/serialization/resources/empathicVoice/types/PostedTimeoutSpecsInactivity.js +34 -0
- package/serialization/resources/empathicVoice/types/PostedTimeoutSpecsMaxDuration.d.ts +13 -0
- package/serialization/resources/empathicVoice/types/PostedTimeoutSpecsMaxDuration.js +34 -0
- package/serialization/resources/empathicVoice/types/ReturnConfig.d.ts +2 -0
- package/serialization/resources/empathicVoice/types/ReturnConfig.js +2 -0
- package/serialization/resources/empathicVoice/types/index.d.ts +3 -0
- package/serialization/resources/empathicVoice/types/index.js +3 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Specifies the duration of user inactivity (in seconds) after which the EVI WebSocket connection will be automatically disconnected. Default is 600 seconds (10 minutes).
|
|
6
|
+
*
|
|
7
|
+
* Accepts a minimum value of 1 second and a maximum value of 1,800 seconds.
|
|
8
|
+
*/
|
|
9
|
+
export interface PostedTimeoutSpecsInactivity {
|
|
10
|
+
/**
|
|
11
|
+
* Boolean indicating if this timeout is enabled.
|
|
12
|
+
*
|
|
13
|
+
* If set to `false`, EVI will not timeout due to a specified duration of user inactivity being reached. However, the conversation will eventually disconnect after 1,800 seconds (30 minutes), which is the maximum WebSocket duration limit for EVI.
|
|
14
|
+
*/
|
|
15
|
+
enabled: boolean;
|
|
16
|
+
/** Duration in seconds for the timeout (e.g. 600 seconds represents 10 minutes). */
|
|
17
|
+
durationSecs?: number;
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Specifies the maximum allowed duration (in seconds) for an EVI WebSocket connection before it is automatically disconnected. Default is 1,800 seconds (30 minutes).
|
|
6
|
+
*
|
|
7
|
+
* Accepts a minimum value of 1 second and a maximum value of 1,800 seconds.
|
|
8
|
+
*/
|
|
9
|
+
export interface PostedTimeoutSpecsMaxDuration {
|
|
10
|
+
/**
|
|
11
|
+
* Boolean indicating if this timeout is enabled.
|
|
12
|
+
*
|
|
13
|
+
* If set to `false`, EVI will not timeout due to a specified maximum duration being reached. However, the conversation will eventually disconnect after 1,800 seconds (30 minutes), which is the maximum WebSocket duration limit for EVI.
|
|
14
|
+
*/
|
|
15
|
+
enabled: boolean;
|
|
16
|
+
/** Duration in seconds for the timeout (e.g. 600 seconds represents 10 minutes). */
|
|
17
|
+
durationSecs?: number;
|
|
18
|
+
}
|
|
@@ -3,5 +3,10 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as Hume from "../../../index";
|
|
5
5
|
export interface ProsodyInference {
|
|
6
|
+
/**
|
|
7
|
+
* The confidence levels of 48 expressions in a given audio sample.
|
|
8
|
+
*
|
|
9
|
+
* Scores typically range from 0 to 1, with higher values indicating a stronger confidence level in the measured attribute.
|
|
10
|
+
*/
|
|
6
11
|
scores: Hume.empathicVoice.EmotionScores;
|
|
7
12
|
}
|
|
@@ -5,7 +5,11 @@
|
|
|
5
5
|
* Resume responses from EVI. Chat history sent while paused will now be sent.
|
|
6
6
|
*/
|
|
7
7
|
export interface ResumeAssistantMessage {
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* The type of message sent through the socket; must be `resume_assistant_message` for our server to correctly identify and process it as a Resume Assistant message.
|
|
10
|
+
*
|
|
11
|
+
* Upon resuming, if any audio input was sent during the pause, EVI will retain context from all messages sent but only respond to the last user message. (e.g., If you ask EVI two questions while paused and then send a `resume_assistant_message`, EVI will respond to the second question and have added the first question to its conversation context.)
|
|
12
|
+
*/
|
|
9
13
|
type: "resume_assistant_message";
|
|
10
14
|
/** Used to manage conversational state, correlate frontend and backend data, and persist conversations across EVI sessions. */
|
|
11
15
|
customSessionId?: string;
|
|
@@ -27,4 +27,5 @@ export interface ReturnConfig {
|
|
|
27
27
|
/** List of built-in tools associated with this config */
|
|
28
28
|
builtinTools?: (Hume.empathicVoice.ReturnBuiltinTool | undefined)[];
|
|
29
29
|
eventMessages?: Hume.empathicVoice.ReturnEventMessageSpecs;
|
|
30
|
+
timeouts?: Hume.empathicVoice.ReturnTimeoutSpecs;
|
|
30
31
|
}
|
|
@@ -6,21 +6,65 @@ import * as Hume from "../../../index";
|
|
|
6
6
|
* Settings for this chat session.
|
|
7
7
|
*/
|
|
8
8
|
export interface SessionSettings {
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* The type of message sent through the socket; must be `session_settings` for our server to correctly identify and process it as a Session Settings message.
|
|
11
|
+
*
|
|
12
|
+
* Session settings are temporary and apply only to the current Chat session. These settings can be adjusted dynamically based on the requirements of each session to ensure optimal performance and user experience.
|
|
13
|
+
*
|
|
14
|
+
* For more information, please refer to the [Session Settings section](/docs/empathic-voice-interface-evi/configuration#session-settings) on the EVI Configuration page.
|
|
15
|
+
*/
|
|
10
16
|
type: "session_settings";
|
|
11
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* Unique identifier for the session. Used to manage conversational state, correlate frontend and backend data, and persist conversations across EVI sessions.
|
|
19
|
+
*
|
|
20
|
+
* If included, the response sent from Hume to your backend will include this ID. This allows you to correlate frontend users with their incoming messages.
|
|
21
|
+
*
|
|
22
|
+
* It is recommended to pass a `custom_session_id` if you are using a Custom Language Model. Please see our guide to [using a custom language model](/docs/empathic-voice-interface-evi/custom-language-model) with EVI to learn more.
|
|
23
|
+
*/
|
|
12
24
|
customSessionId?: string;
|
|
13
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* Instructions used to shape EVI’s behavior, responses, and style for the session.
|
|
27
|
+
*
|
|
28
|
+
* When included in a Session Settings message, the provided Prompt overrides the existing one specified in the EVI configuration. If no Prompt was defined in the configuration, this Prompt will be the one used for the session.
|
|
29
|
+
*
|
|
30
|
+
* You can use the Prompt to define a specific goal or role for EVI, specifying how it should act or what it should focus on during the conversation. For example, EVI can be instructed to act as a customer support representative, a fitness coach, or a travel advisor, each with its own set of behaviors and response styles.
|
|
31
|
+
*
|
|
32
|
+
* For help writing a system prompt, see our [Prompting Guide](/docs/empathic-voice-interface-evi/prompting).
|
|
33
|
+
*/
|
|
14
34
|
systemPrompt?: string;
|
|
15
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* Allows developers to inject additional context into the conversation, which is appended to the end of user messages for the session.
|
|
37
|
+
*
|
|
38
|
+
* When included in a Session Settings message, the provided context can be used to remind the LLM of its role in every user message, prevent it from forgetting important details, or add new relevant information to the conversation.
|
|
39
|
+
*
|
|
40
|
+
* Set to `null` to disable context injection.
|
|
41
|
+
*/
|
|
16
42
|
context?: Hume.empathicVoice.Context;
|
|
17
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* Configuration details for the audio input used during the session. Ensures the audio is being correctly set up for processing.
|
|
45
|
+
*
|
|
46
|
+
* This optional field is only required when the audio input is encoded in PCM Linear 16 (16-bit, little-endian, signed PCM WAV data). For detailed instructions on how to configure session settings for PCM Linear 16 audio, please refer to the [Session Settings section](/docs/empathic-voice-interface-evi/configuration#session-settings) on the EVI Configuration page.
|
|
47
|
+
*/
|
|
18
48
|
audio?: Hume.empathicVoice.AudioConfiguration;
|
|
19
|
-
/**
|
|
49
|
+
/**
|
|
50
|
+
* Third party API key for the supplemental language model.
|
|
51
|
+
*
|
|
52
|
+
* When provided, EVI will use this key instead of Hume’s API key for the supplemental LLM. This allows you to bypass rate limits and utilize your own API key as needed.
|
|
53
|
+
*/
|
|
20
54
|
languageModelApiKey?: string;
|
|
21
|
-
/**
|
|
55
|
+
/**
|
|
56
|
+
* List of user-defined tools to enable for the session.
|
|
57
|
+
*
|
|
58
|
+
* Tools are resources used by EVI to perform various tasks, such as searching the web or calling external APIs. Built-in tools, like web search, are natively integrated, while user-defined tools are created and invoked by the user. To learn more, see our [Tool Use Guide](/docs/empathic-voice-interface-evi/tool-use).
|
|
59
|
+
*/
|
|
22
60
|
tools?: Hume.empathicVoice.Tool[];
|
|
23
|
-
/**
|
|
61
|
+
/**
|
|
62
|
+
* List of built-in tools to enable for the session.
|
|
63
|
+
*
|
|
64
|
+
* Tools are resources used by EVI to perform various tasks, such as searching the web or calling external APIs. Built-in tools, like web search, are natively integrated, while user-defined tools are created and invoked by the user. To learn more, see our [Tool Use Guide](/docs/empathic-voice-interface-evi/tool-use).
|
|
65
|
+
*
|
|
66
|
+
* Currently, the only built-in tool Hume provides is **Web Search**. When enabled, Web Search equips EVI with the ability to search the web for up-to-date information.
|
|
67
|
+
*/
|
|
24
68
|
builtinTools?: Hume.empathicVoice.BuiltinToolConfig[];
|
|
25
69
|
metadata?: Record<string, unknown>;
|
|
26
70
|
/** Dynamic values that can be used to populate EVI prompts. */
|
|
@@ -3,14 +3,18 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as Hume from "../../../index";
|
|
5
5
|
export interface Tool {
|
|
6
|
-
/** Type of tool. */
|
|
6
|
+
/** Type of tool. Set to `function` for user-defined tools. */
|
|
7
7
|
type: Hume.empathicVoice.ToolType;
|
|
8
|
-
/** Name of the tool. */
|
|
8
|
+
/** Name of the user-defined tool to be enabled. */
|
|
9
9
|
name: string;
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Parameters of the tool. Is a stringified JSON schema.
|
|
12
|
+
*
|
|
13
|
+
* These parameters define the inputs needed for the tool’s execution, including the expected data type and description for each input field. Structured as a JSON schema, this format ensures the tool receives data in the expected format.
|
|
14
|
+
*/
|
|
11
15
|
parameters: string;
|
|
12
|
-
/**
|
|
16
|
+
/** An optional description of what the tool does, used by the supplemental LLM to choose when and how to call the function. */
|
|
13
17
|
description?: string;
|
|
14
|
-
/**
|
|
18
|
+
/** Optional text passed to the supplemental LLM if the tool call fails. The LLM then uses this text to generate a response back to the user, ensuring continuity in the conversation. */
|
|
15
19
|
fallbackContent?: string;
|
|
16
20
|
}
|
|
@@ -8,16 +8,28 @@ import * as Hume from "../../../index";
|
|
|
8
8
|
export interface ToolCallMessage {
|
|
9
9
|
/** Name of the tool called. */
|
|
10
10
|
name: string;
|
|
11
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Parameters of the tool.
|
|
13
|
+
*
|
|
14
|
+
* These parameters define the inputs needed for the tool’s execution, including the expected data type and description for each input field. Structured as a stringified JSON schema, this format ensures the tool receives data in the expected format.
|
|
15
|
+
*/
|
|
12
16
|
parameters: string;
|
|
13
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* The unique identifier for a specific tool call instance.
|
|
19
|
+
*
|
|
20
|
+
* This ID is used to track the request and response of a particular tool invocation, ensuring that the correct response is linked to the appropriate request.
|
|
21
|
+
*/
|
|
14
22
|
toolCallId: string;
|
|
15
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
* The type of message sent through the socket; for a Tool Call message, this must be `tool_call`.
|
|
25
|
+
*
|
|
26
|
+
* This message indicates that the supplemental LLM has detected a need to invoke the specified tool.
|
|
27
|
+
*/
|
|
16
28
|
type: "tool_call";
|
|
17
29
|
/** Used to manage conversational state, correlate frontend and backend data, and persist conversations across EVI sessions. */
|
|
18
30
|
customSessionId?: string;
|
|
19
|
-
/** Type of tool called
|
|
31
|
+
/** Type of tool called. Either `builtin` for natively implemented tools, like web search, or `function` for user-defined tools. */
|
|
20
32
|
toolType?: Hume.empathicVoice.ToolType;
|
|
21
|
-
/**
|
|
33
|
+
/** Indicates whether a response to the tool call is required from the developer, either in the form of a [Tool Response message](/reference/empathic-voice-interface-evi/chat/chat#send.Tool%20Response%20Message.type) or a [Tool Error message](/reference/empathic-voice-interface-evi/chat/chat#send.Tool%20Error%20Message.type). */
|
|
22
34
|
responseRequired: boolean;
|
|
23
35
|
}
|
|
@@ -6,20 +6,28 @@ import * as Hume from "../../../index";
|
|
|
6
6
|
* When provided, the output is a function call error.
|
|
7
7
|
*/
|
|
8
8
|
export interface ToolErrorMessage {
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* The type of message sent through the socket; for a Tool Error message, this must be `tool_error`.
|
|
11
|
+
*
|
|
12
|
+
* Upon receiving a [Tool Call message](/reference/empathic-voice-interface-evi/chat/chat#receive.Tool%20Call%20Message.type) and failing to invoke the function, this message is sent to notify EVI of the tool's failure.
|
|
13
|
+
*/
|
|
10
14
|
type: "tool_error";
|
|
11
15
|
/** Used to manage conversational state, correlate frontend and backend data, and persist conversations across EVI sessions. */
|
|
12
16
|
customSessionId?: string;
|
|
13
|
-
/** Type of tool called
|
|
17
|
+
/** Type of tool called. Either `builtin` for natively implemented tools, like web search, or `function` for user-defined tools. */
|
|
14
18
|
toolType?: Hume.empathicVoice.ToolType;
|
|
15
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* The unique identifier for a specific tool call instance.
|
|
21
|
+
*
|
|
22
|
+
* This ID is used to track the request and response of a particular tool invocation, ensuring that the Tool Error message is linked to the appropriate tool call request. The specified `tool_call_id` must match the one received in the [Tool Call message](/reference/empathic-voice-interface-evi/chat/chat#receive.Tool%20Call%20Message.type).
|
|
23
|
+
*/
|
|
16
24
|
toolCallId: string;
|
|
17
|
-
/**
|
|
25
|
+
/** Optional text passed to the supplemental LLM in place of the tool call result. The LLM then uses this text to generate a response back to the user, ensuring continuity in the conversation if the tool errors. */
|
|
18
26
|
content?: string;
|
|
19
27
|
/** Error message from the tool call, not exposed to the LLM or user. */
|
|
20
28
|
error: string;
|
|
21
|
-
/** Error code. */
|
|
29
|
+
/** Error code. Identifies the type of error encountered. */
|
|
22
30
|
code?: string;
|
|
23
|
-
/** Error
|
|
31
|
+
/** Indicates the severity of an error; for a Tool Error message, this must be `warn` to signal an unexpected event. */
|
|
24
32
|
level?: Hume.empathicVoice.ErrorLevel;
|
|
25
33
|
}
|
|
@@ -6,14 +6,28 @@ import * as Hume from "../../../index";
|
|
|
6
6
|
* When provided, the output is a function call response.
|
|
7
7
|
*/
|
|
8
8
|
export interface ToolResponseMessage {
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* The type of message sent through the socket; for a Tool Response message, this must be `tool_response`.
|
|
11
|
+
*
|
|
12
|
+
* Upon receiving a [Tool Call message](/reference/empathic-voice-interface-evi/chat/chat#receive.Tool%20Call%20Message.type) and successfully invoking the function, this message is sent to convey the result of the function call back to EVI.
|
|
13
|
+
*/
|
|
10
14
|
type: "tool_response";
|
|
11
15
|
/** Used to manage conversational state, correlate frontend and backend data, and persist conversations across EVI sessions. */
|
|
12
16
|
customSessionId?: string;
|
|
13
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* The unique identifier for a specific tool call instance.
|
|
19
|
+
*
|
|
20
|
+
* This ID is used to track the request and response of a particular tool invocation, ensuring that the correct response is linked to the appropriate request. The specified `tool_call_id` must match the one received in the [Tool Call message](/reference/empathic-voice-interface-evi/chat/chat#receive.Tool%20Call%20Message.tool_call_id).
|
|
21
|
+
*/
|
|
14
22
|
toolCallId: string;
|
|
15
|
-
/** Return value of the tool call. */
|
|
23
|
+
/** Return value of the tool call. Contains the output generated by the tool to pass back to EVI. */
|
|
16
24
|
content: string;
|
|
25
|
+
/**
|
|
26
|
+
* Name of the tool.
|
|
27
|
+
*
|
|
28
|
+
* Include this optional field to help the supplemental LLM identify which tool generated the response. The specified `tool_name` must match the one received in the [Tool Call message](/reference/empathic-voice-interface-evi/chat/chat#receive.Tool%20Call%20Message.type).
|
|
29
|
+
*/
|
|
17
30
|
toolName?: string;
|
|
31
|
+
/** Type of tool called. Either `builtin` for natively implemented tools, like web search, or `function` for user-defined tools. */
|
|
18
32
|
toolType?: Hume.empathicVoice.ToolType;
|
|
19
33
|
}
|
|
@@ -5,10 +5,14 @@
|
|
|
5
5
|
* User text to insert into the conversation.
|
|
6
6
|
*/
|
|
7
7
|
export interface UserInput {
|
|
8
|
-
/** The type of message sent through the socket; for a User Input message
|
|
8
|
+
/** The type of message sent through the socket; must be `user_input` for our server to correctly identify and process it as a User Input message. */
|
|
9
9
|
type: "user_input";
|
|
10
10
|
/** Used to manage conversational state, correlate frontend and backend data, and persist conversations across EVI sessions. */
|
|
11
11
|
customSessionId?: string;
|
|
12
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* User text to insert into the conversation. Text sent through a User Input message is treated as the user’s speech to EVI. EVI processes this input and provides a corresponding response.
|
|
14
|
+
*
|
|
15
|
+
* Expression measurement results are not available for User Input messages, as the prosody model relies on audio input and cannot process text alone.
|
|
16
|
+
*/
|
|
13
17
|
text: string;
|
|
14
18
|
}
|
|
@@ -5,7 +5,11 @@
|
|
|
5
5
|
* When provided, the output is an interruption.
|
|
6
6
|
*/
|
|
7
7
|
export interface UserInterruption {
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* The type of message sent through the socket; for a User Interruption message, this must be `user_interruption`.
|
|
10
|
+
*
|
|
11
|
+
* This message indicates the user has interrupted the assistant’s response. EVI detects the interruption in real-time and sends this message to signal the interruption event. This message allows the system to stop the current audio playback, clear the audio queue, and prepare to handle new user input.
|
|
12
|
+
*/
|
|
9
13
|
type: "user_interruption";
|
|
10
14
|
/** Used to manage conversational state, correlate frontend and backend data, and persist conversations across EVI sessions. */
|
|
11
15
|
customSessionId?: string;
|
|
@@ -6,7 +6,11 @@ import * as Hume from "../../../index";
|
|
|
6
6
|
* When provided, the output is a user message.
|
|
7
7
|
*/
|
|
8
8
|
export interface UserMessage {
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* The type of message sent through the socket; for a User Message, this must be `user_message`.
|
|
11
|
+
*
|
|
12
|
+
* This message contains both a transcript of the user’s input and the expression measurement predictions if the input was sent as an [Audio Input message](/reference/empathic-voice-interface-evi/chat/chat#send.Audio%20Input.type). Expression measurement predictions are not provided for a [User Input message](/reference/empathic-voice-interface-evi/chat/chat#send.User%20Input.type), as the prosody model relies on audio input and cannot process text alone.
|
|
13
|
+
*/
|
|
10
14
|
type: "user_message";
|
|
11
15
|
/** Used to manage conversational state, correlate frontend and backend data, and persist conversations across EVI sessions. */
|
|
12
16
|
customSessionId?: string;
|
|
@@ -16,6 +20,6 @@ export interface UserMessage {
|
|
|
16
20
|
models: Hume.empathicVoice.Inference;
|
|
17
21
|
/** Start and End time of user message. */
|
|
18
22
|
time: Hume.empathicVoice.MillisecondInterval;
|
|
19
|
-
/** Indicates if this message was
|
|
23
|
+
/** Indicates if this message was inserted into the conversation as text from a [User Input](/reference/empathic-voice-interface-evi/chat/chat#send.User%20Input.text) message. */
|
|
20
24
|
fromText: boolean;
|
|
21
25
|
}
|
|
@@ -5,14 +5,18 @@
|
|
|
5
5
|
* When provided, the output is an error message.
|
|
6
6
|
*/
|
|
7
7
|
export interface WebSocketError {
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* The type of message sent through the socket; for a Web Socket Error message, this must be `error`.
|
|
10
|
+
*
|
|
11
|
+
* This message indicates a disruption in the WebSocket connection, such as an unexpected disconnection, protocol error, or data transmission issue.
|
|
12
|
+
*/
|
|
9
13
|
type: "error";
|
|
10
14
|
/** Used to manage conversational state, correlate frontend and backend data, and persist conversations across EVI sessions. */
|
|
11
15
|
customSessionId?: string;
|
|
12
|
-
/** Error code. */
|
|
16
|
+
/** Error code. Identifies the type of error encountered. */
|
|
13
17
|
code: string;
|
|
14
|
-
/**
|
|
18
|
+
/** Short, human-readable identifier and description for the error. See a complete list of error slugs on the [Errors page](/docs/resources/errors). */
|
|
15
19
|
slug: string;
|
|
16
|
-
/**
|
|
20
|
+
/** Detailed description of the error. */
|
|
17
21
|
message: string;
|
|
18
22
|
}
|
|
@@ -10,6 +10,8 @@ export * from "./PostedLanguageModelModelProvider";
|
|
|
10
10
|
export * from "./PostedLanguageModel";
|
|
11
11
|
export * from "./PostedPromptSpec";
|
|
12
12
|
export * from "./PostedTimeoutSpec";
|
|
13
|
+
export * from "./PostedTimeoutSpecsInactivity";
|
|
14
|
+
export * from "./PostedTimeoutSpecsMaxDuration";
|
|
13
15
|
export * from "./PostedTimeoutSpecs";
|
|
14
16
|
export * from "./PostedUserDefinedToolSpec";
|
|
15
17
|
export * from "./PostedVoiceName";
|
|
@@ -73,6 +75,7 @@ export * from "./Role";
|
|
|
73
75
|
export * from "./ToolCallMessage";
|
|
74
76
|
export * from "./UserInterruption";
|
|
75
77
|
export * from "./UserMessage";
|
|
78
|
+
export * from "./JsonMessage";
|
|
76
79
|
export * from "./TtsInput";
|
|
77
80
|
export * from "./TextInput";
|
|
78
81
|
export * from "./FunctionCallResponseInput";
|
|
@@ -26,6 +26,8 @@ __exportStar(require("./PostedLanguageModelModelProvider"), exports);
|
|
|
26
26
|
__exportStar(require("./PostedLanguageModel"), exports);
|
|
27
27
|
__exportStar(require("./PostedPromptSpec"), exports);
|
|
28
28
|
__exportStar(require("./PostedTimeoutSpec"), exports);
|
|
29
|
+
__exportStar(require("./PostedTimeoutSpecsInactivity"), exports);
|
|
30
|
+
__exportStar(require("./PostedTimeoutSpecsMaxDuration"), exports);
|
|
29
31
|
__exportStar(require("./PostedTimeoutSpecs"), exports);
|
|
30
32
|
__exportStar(require("./PostedUserDefinedToolSpec"), exports);
|
|
31
33
|
__exportStar(require("./PostedVoiceName"), exports);
|
|
@@ -89,6 +91,7 @@ __exportStar(require("./Role"), exports);
|
|
|
89
91
|
__exportStar(require("./ToolCallMessage"), exports);
|
|
90
92
|
__exportStar(require("./UserInterruption"), exports);
|
|
91
93
|
__exportStar(require("./UserMessage"), exports);
|
|
94
|
+
__exportStar(require("./JsonMessage"), exports);
|
|
92
95
|
__exportStar(require("./TtsInput"), exports);
|
|
93
96
|
__exportStar(require("./TextInput"), exports);
|
|
94
97
|
__exportStar(require("./FunctionCallResponseInput"), exports);
|
|
@@ -6,12 +6,18 @@ export declare namespace Chat {
|
|
|
6
6
|
accessToken?: core.Supplier<string | undefined>;
|
|
7
7
|
}
|
|
8
8
|
interface ConnectArgs {
|
|
9
|
+
/** Enable debug mode on the websocket. Defaults to false. */
|
|
10
|
+
debug?: boolean;
|
|
11
|
+
/** Number of reconnect attempts. Defaults to 30. */
|
|
12
|
+
reconnectAttempts?: number;
|
|
9
13
|
/** The ID of the configuration. */
|
|
10
14
|
configId?: string;
|
|
11
15
|
/** The version of the configuration. */
|
|
12
16
|
configVersion?: string;
|
|
13
17
|
/** The ID of a chat group, used to resume a previous chat. */
|
|
14
18
|
resumedChatGroupId?: string;
|
|
19
|
+
/** Extra query parameters sent at WebSocket connection */
|
|
20
|
+
queryParams?: Record<string, string | string[] | object | object[]>;
|
|
15
21
|
}
|
|
16
22
|
}
|
|
17
23
|
export declare class Chat {
|
|
@@ -35,6 +35,7 @@ class Chat {
|
|
|
35
35
|
this._options = _options;
|
|
36
36
|
}
|
|
37
37
|
connect(args = {}) {
|
|
38
|
+
var _a;
|
|
38
39
|
const queryParams = {};
|
|
39
40
|
if (this._options.accessToken != null) {
|
|
40
41
|
queryParams["accessToken"] = core.Supplier.get(this._options.accessToken);
|
|
@@ -51,7 +52,16 @@ class Chat {
|
|
|
51
52
|
if (args.resumedChatGroupId != null) {
|
|
52
53
|
queryParams["resumed_chat_group_id"] = args.resumedChatGroupId;
|
|
53
54
|
}
|
|
54
|
-
|
|
55
|
+
if (args.queryParams != null) {
|
|
56
|
+
for (const [name, value] of Object.entries(args.queryParams)) {
|
|
57
|
+
queryParams[name] = value;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
const socket = new core.ReconnectingWebSocket(`wss://api.hume.ai/v0/evi/chat?${qs_1.default.stringify(queryParams)}`, [], {
|
|
61
|
+
startClosed: true,
|
|
62
|
+
debug: (_a = args.debug) !== null && _a !== void 0 ? _a : false,
|
|
63
|
+
maxRetries: args.reconnectAttempts,
|
|
64
|
+
});
|
|
55
65
|
return new Socket_1.ChatSocket({
|
|
56
66
|
socket,
|
|
57
67
|
});
|
|
@@ -64,10 +64,17 @@ export declare class ChatSocket {
|
|
|
64
64
|
* Send text input
|
|
65
65
|
*/
|
|
66
66
|
sendUserInput(text: string): void;
|
|
67
|
+
/**
|
|
68
|
+
* @name connect
|
|
69
|
+
* @description
|
|
70
|
+
* Connect to the websocket.
|
|
71
|
+
*/
|
|
72
|
+
connect(): ChatSocket;
|
|
67
73
|
/**
|
|
68
74
|
* Closes the underlying socket.
|
|
69
75
|
*/
|
|
70
76
|
close(): void;
|
|
77
|
+
private assertSocketIsOpen;
|
|
71
78
|
private sendJson;
|
|
72
79
|
private handleOpen;
|
|
73
80
|
private handleMessage;
|
|
@@ -24,6 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.ChatSocket = void 0;
|
|
27
|
+
const errors = __importStar(require("../../../../../../errors"));
|
|
27
28
|
const serializers = __importStar(require("../../../../../../serialization/index"));
|
|
28
29
|
class ChatSocket {
|
|
29
30
|
constructor({ socket }) {
|
|
@@ -83,63 +84,93 @@ class ChatSocket {
|
|
|
83
84
|
* Send audio input
|
|
84
85
|
*/
|
|
85
86
|
sendAudioInput(message) {
|
|
87
|
+
this.assertSocketIsOpen();
|
|
86
88
|
this.sendJson(Object.assign({ type: "audio_input" }, message));
|
|
87
89
|
}
|
|
88
90
|
/**
|
|
89
91
|
* Send session settings
|
|
90
92
|
*/
|
|
91
93
|
sendSessionSettings(message) {
|
|
94
|
+
this.assertSocketIsOpen();
|
|
92
95
|
this.sendJson(Object.assign({ type: "session_settings" }, message));
|
|
93
96
|
}
|
|
94
97
|
/**
|
|
95
98
|
* Send assistant input
|
|
96
99
|
*/
|
|
97
100
|
sendAssistantInput(message) {
|
|
101
|
+
this.assertSocketIsOpen();
|
|
98
102
|
this.sendJson(Object.assign({ type: "assistant_input" }, message));
|
|
99
103
|
}
|
|
100
104
|
/**
|
|
101
105
|
* Send pause assistant message
|
|
102
106
|
*/
|
|
103
107
|
pauseAssistant(message) {
|
|
108
|
+
this.assertSocketIsOpen();
|
|
104
109
|
this.sendJson(Object.assign({ type: "pause_assistant_message" }, message));
|
|
105
110
|
}
|
|
106
111
|
/**
|
|
107
112
|
* Send resume assistant message
|
|
108
113
|
*/
|
|
109
114
|
resumeAssistant(message) {
|
|
115
|
+
this.assertSocketIsOpen();
|
|
110
116
|
this.sendJson(Object.assign({ type: "resume_assistant_message" }, message));
|
|
111
117
|
}
|
|
112
118
|
/**
|
|
113
119
|
* Send tool response message
|
|
114
120
|
*/
|
|
115
121
|
sendToolResponseMessage(message) {
|
|
122
|
+
this.assertSocketIsOpen();
|
|
116
123
|
this.sendJson(Object.assign({ type: "tool_response" }, message));
|
|
117
124
|
}
|
|
118
125
|
/**
|
|
119
126
|
* Send tool error message
|
|
120
127
|
*/
|
|
121
128
|
sendToolErrorMessage(message) {
|
|
129
|
+
this.assertSocketIsOpen();
|
|
122
130
|
this.sendJson(Object.assign({ type: "tool_error" }, message));
|
|
123
131
|
}
|
|
124
132
|
/**
|
|
125
133
|
* Send text input
|
|
126
134
|
*/
|
|
127
135
|
sendUserInput(text) {
|
|
136
|
+
this.assertSocketIsOpen();
|
|
128
137
|
this.sendJson({
|
|
129
138
|
type: "user_input",
|
|
130
139
|
text,
|
|
131
140
|
});
|
|
132
141
|
}
|
|
142
|
+
/**
|
|
143
|
+
* @name connect
|
|
144
|
+
* @description
|
|
145
|
+
* Connect to the websocket.
|
|
146
|
+
*/
|
|
147
|
+
connect() {
|
|
148
|
+
this.socket.reconnect();
|
|
149
|
+
this.socket.addEventListener('open', this.handleOpen);
|
|
150
|
+
this.socket.addEventListener('message', this.handleMessage);
|
|
151
|
+
this.socket.addEventListener('close', this.handleClose);
|
|
152
|
+
this.socket.addEventListener('error', this.handleError);
|
|
153
|
+
return this;
|
|
154
|
+
}
|
|
133
155
|
/**
|
|
134
156
|
* Closes the underlying socket.
|
|
135
157
|
*/
|
|
136
158
|
close() {
|
|
137
159
|
this.socket.close();
|
|
160
|
+
this.handleClose({ code: 1000 });
|
|
138
161
|
this.socket.removeEventListener('open', this.handleOpen);
|
|
139
162
|
this.socket.removeEventListener('message', this.handleMessage);
|
|
140
163
|
this.socket.removeEventListener('close', this.handleClose);
|
|
141
164
|
this.socket.removeEventListener('error', this.handleError);
|
|
142
165
|
}
|
|
166
|
+
assertSocketIsOpen() {
|
|
167
|
+
if (!this.socket) {
|
|
168
|
+
throw new errors.HumeError({ message: 'Socket is not connected.' });
|
|
169
|
+
}
|
|
170
|
+
if (this.socket.readyState !== WebSocket.OPEN) {
|
|
171
|
+
throw new errors.HumeError({ message: 'Socket is not open.' });
|
|
172
|
+
}
|
|
173
|
+
}
|
|
143
174
|
sendJson(payload) {
|
|
144
175
|
const jsonPayload = serializers.empathicVoice.PublishEvent.jsonOrThrow(payload, {
|
|
145
176
|
unrecognizedObjectKeys: "strip",
|
package/dist/api/resources/empathicVoice/resources/configs/client/requests/PostedConfig.d.ts
CHANGED
|
@@ -22,4 +22,5 @@ export interface PostedConfig {
|
|
|
22
22
|
/** Built-in tool specification for a Config. */
|
|
23
23
|
builtinTools?: (Hume.empathicVoice.PostedBuiltinTool | undefined)[];
|
|
24
24
|
eventMessages?: Hume.empathicVoice.PostedEventMessageSpecs;
|
|
25
|
+
timeouts?: Hume.empathicVoice.PostedTimeoutSpecs;
|
|
25
26
|
}
|
package/dist/api/resources/empathicVoice/resources/configs/client/requests/PostedConfigVersion.d.ts
CHANGED
|
@@ -18,4 +18,5 @@ export interface PostedConfigVersion {
|
|
|
18
18
|
/** Built-in tool specification for a Config. */
|
|
19
19
|
builtinTools?: (Hume.empathicVoice.PostedBuiltinTool | undefined)[];
|
|
20
20
|
eventMessages?: Hume.empathicVoice.PostedEventMessageSpecs;
|
|
21
|
+
timeouts?: Hume.empathicVoice.PostedTimeoutSpecs;
|
|
21
22
|
}
|
|
@@ -5,7 +5,11 @@
|
|
|
5
5
|
* When provided, the output is an assistant end message.
|
|
6
6
|
*/
|
|
7
7
|
export interface AssistantEnd {
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* The type of message sent through the socket; for an Assistant End message, this must be `assistant_end`.
|
|
10
|
+
*
|
|
11
|
+
* This message indicates the conclusion of the assistant’s response, signaling that the assistant has finished speaking for the current conversational turn.
|
|
12
|
+
*/
|
|
9
13
|
type: "assistant_end";
|
|
10
14
|
/** Used to manage conversational state, correlate frontend and backend data, and persist conversations across EVI sessions. */
|
|
11
15
|
customSessionId?: string;
|
|
@@ -5,10 +5,14 @@
|
|
|
5
5
|
* When provided, the input is spoken by EVI.
|
|
6
6
|
*/
|
|
7
7
|
export interface AssistantInput {
|
|
8
|
-
/** The type of message sent through the socket; for an Assistant Input message
|
|
8
|
+
/** The type of message sent through the socket; must be `assistant_input` for our server to correctly identify and process it as an Assistant Input message. */
|
|
9
9
|
type: "assistant_input";
|
|
10
10
|
/** Used to manage conversational state, correlate frontend and backend data, and persist conversations across EVI sessions. */
|
|
11
11
|
customSessionId?: string;
|
|
12
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* Assistant text to synthesize into spoken audio and insert into the conversation.
|
|
14
|
+
*
|
|
15
|
+
* EVI uses this text to generate spoken audio using our proprietary expressive text-to-speech model. Our model adds appropriate emotional inflections and tones to the text based on the user’s expressions and the context of the conversation. The synthesized audio is streamed back to the user as an [Assistant Message](/reference/empathic-voice-interface-evi/chat/chat#receive.Assistant%20Message.type).
|
|
16
|
+
*/
|
|
13
17
|
text: string;
|
|
14
18
|
}
|