From 9ac7b1da3e0b6fe432e123e697cba6db053953fa Mon Sep 17 00:00:00 2001 From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com> Date: Mon, 8 Dec 2025 17:20:08 +0000 Subject: [PATCH 1/2] SDK regeneration --- .mock/fern.config.json | 6 +- package.json | 2 +- reference.md | 1416 ++++++++--------- src/Client.ts | 14 +- .../resources/chat/client/Client.ts.diff | 182 --- .../resources/chat/client/Socket.ts.diff | 139 -- .../resources/chat/client/index.ts.diff | 9 - .../resources/chat/index.ts.diff | 13 - .../controlPlane/client/Client.ts.diff | 30 - .../streamInput/client/Client.ts.diff | 20 - src/core/fetcher/Supplier.ts.diff | 26 - src/core/websocket/ws.ts.diff | 137 -- src/index.ts.diff | 17 - .../resources/chat/index.ts.diff | 12 - src/version.ts | 2 +- 15 files changed, 720 insertions(+), 1305 deletions(-) delete mode 100644 src/api/resources/empathicVoice/resources/chat/client/Client.ts.diff delete mode 100644 src/api/resources/empathicVoice/resources/chat/client/Socket.ts.diff delete mode 100644 src/api/resources/empathicVoice/resources/chat/client/index.ts.diff delete mode 100644 src/api/resources/empathicVoice/resources/chat/index.ts.diff delete mode 100644 src/api/resources/empathicVoice/resources/controlPlane/client/Client.ts.diff delete mode 100644 src/api/resources/tts/resources/streamInput/client/Client.ts.diff delete mode 100644 src/core/fetcher/Supplier.ts.diff delete mode 100644 src/core/websocket/ws.ts.diff delete mode 100644 src/index.ts.diff delete mode 100644 src/serialization/resources/empathicVoice/resources/chat/index.ts.diff diff --git a/.mock/fern.config.json b/.mock/fern.config.json index 2a7ce060..8ee40941 100644 --- a/.mock/fern.config.json +++ b/.mock/fern.config.json @@ -1,4 +1,4 @@ { - "organization": "hume", - "version": "0.114.0" -} + "organization" : "hume", + "version" : "0.114.0" +} \ No newline at end of file diff --git a/package.json b/package.json index 093da573..5fead140 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hume", - "version": "0.15.9", + "version": "0.15.10", "private": false, "repository": "github:humeai/hume-typescript-sdk", "type": "commonjs", diff --git a/reference.md b/reference.md index 270e6ac4..11e7a680 100644 --- a/reference.md +++ b/reference.md @@ -1,6 +1,6 @@ # Reference -## EmpathicVoice ControlPlane -
client.empathicVoice.controlPlane.send(chatId, { ...params }) -> void +## Tts +
client.tts.synthesizeJson({ ...params }) -> Hume.ReturnTts
@@ -12,7 +12,9 @@
-Send a message to a specific chat. +Synthesizes one or more input texts into speech using the specified voice. If no voice is provided, a novel voice will be generated dynamically. Optionally, additional context can be included to influence the speech's style and prosody. + +The response includes the base64-encoded audio and metadata in JSON format.
@@ -27,8 +29,21 @@ Send a message to a specific chat.
```typescript -await client.empathicVoice.controlPlane.send("chat_id", { - type: "session_settings" +await client.tts.synthesizeJson({ + context: { + utterances: [{ + text: "How can people see beauty so differently?", + description: "A curious student with a clear and respectful tone, seeking clarification on Hume's ideas with a straightforward question." + }] + }, + format: { + type: "mp3" + }, + numGenerations: 1, + utterances: [{ + text: "Beauty is no quality in things themselves: It exists merely in the mind which contemplates them.", + description: "Middle-aged masculine voice with a clear, rhythmic Scots lilt, rounded vowels, and a warm, steady tone with an articulate, academic quality." + }] }); ``` @@ -45,15 +60,7 @@ await client.empathicVoice.controlPlane.send("chat_id", {
-**chatId:** `string` - -
-
- -
-
- -**request:** `Hume.ControlPlanePublishEvent` +**request:** `Hume.PostedTts`
@@ -61,7 +68,7 @@ await client.empathicVoice.controlPlane.send("chat_id", {
-**requestOptions:** `ControlPlane.RequestOptions` +**requestOptions:** `Tts.RequestOptions`
@@ -73,8 +80,7 @@ await client.empathicVoice.controlPlane.send("chat_id", {
-## EmpathicVoice ChatGroups -
client.empathicVoice.chatGroups.listChatGroups({ ...params }) -> core.Page +
client.tts.synthesizeFile({ ...params }) -> core.BinaryResponse
@@ -86,7 +92,9 @@ await client.empathicVoice.controlPlane.send("chat_id", {
-Fetches a paginated list of **Chat Groups**. +Synthesizes one or more input texts into speech using the specified voice. If no voice is provided, a novel voice will be generated dynamically. Optionally, additional context can be included to influence the speech's style and prosody. + +The response contains the generated audio file in the requested format.
@@ -101,29 +109,19 @@ Fetches a paginated list of **Chat Groups**.
```typescript -const pageableResponse = await client.empathicVoice.chatGroups.listChatGroups({ - pageNumber: 0, - pageSize: 1, - ascendingOrder: true, - configId: "1b60e1a0-cc59-424a-8d2c-189d354db3f3" -}); -for await (const item of pageableResponse) { - console.log(item); -} - -// Or you can manually iterate page-by-page -let page = await client.empathicVoice.chatGroups.listChatGroups({ - pageNumber: 0, - pageSize: 1, - ascendingOrder: true, - configId: "1b60e1a0-cc59-424a-8d2c-189d354db3f3" +await client.tts.synthesizeFile({ + context: { + generationId: "09ad914d-8e7f-40f8-a279-e34f07f7dab2" + }, + format: { + type: "mp3" + }, + numGenerations: 1, + utterances: [{ + text: "Beauty is no quality in things themselves: It exists merely in the mind which contemplates them.", + description: "Middle-aged masculine voice with a clear, rhythmic Scots lilt, rounded vowels, and a warm, steady tone with an articulate, academic quality." + }] }); -while (page.hasNextPage()) { - page = page.getNextPage(); -} - -// You can also access the underlying response -const response = page.response; ```
@@ -139,7 +137,7 @@ const response = page.response;
-**request:** `Hume.empathicVoice.ChatGroupsListChatGroupsRequest` +**request:** `Hume.PostedTts`
@@ -147,7 +145,7 @@ const response = page.response;
-**requestOptions:** `ChatGroups.RequestOptions` +**requestOptions:** `Tts.RequestOptions`
@@ -159,7 +157,7 @@ const response = page.response;
-
client.empathicVoice.chatGroups.getChatGroup(id, { ...params }) -> Hume.ReturnChatGroupPagedChats +
client.tts.synthesizeFileStreaming({ ...params }) -> core.BinaryResponse
@@ -171,7 +169,7 @@ const response = page.response;
-Fetches a **ChatGroup** by ID, including a paginated list of **Chats** associated with the **ChatGroup**. +Streams synthesized speech using the specified voice. If no voice is provided, a novel voice will be generated dynamically. Optionally, additional context can be included to influence the speech's style and prosody.
@@ -186,10 +184,14 @@ Fetches a **ChatGroup** by ID, including a paginated list of **Chats** associate
```typescript -await client.empathicVoice.chatGroups.getChatGroup("697056f0-6c7e-487d-9bd8-9c19df79f05f", { - pageNumber: 0, - pageSize: 1, - ascendingOrder: true +await client.tts.synthesizeFileStreaming({ + utterances: [{ + text: "Beauty is no quality in things themselves: It exists merely in the mind which contemplates them.", + voice: { + name: "Male English Actor", + provider: "HUME_AI" + } + }] }); ``` @@ -206,15 +208,7 @@ await client.empathicVoice.chatGroups.getChatGroup("697056f0-6c7e-487d-9bd8-9c19
-**id:** `string` — Identifier for a Chat Group. Formatted as a UUID. - -
-
- -
-
- -**request:** `Hume.empathicVoice.ChatGroupsGetChatGroupRequest` +**request:** `Hume.PostedTts`
@@ -222,7 +216,7 @@ await client.empathicVoice.chatGroups.getChatGroup("697056f0-6c7e-487d-9bd8-9c19
-**requestOptions:** `ChatGroups.RequestOptions` +**requestOptions:** `Tts.RequestOptions`
@@ -234,7 +228,7 @@ await client.empathicVoice.chatGroups.getChatGroup("697056f0-6c7e-487d-9bd8-9c19
-
client.empathicVoice.chatGroups.getAudio(id, { ...params }) -> Hume.ReturnChatGroupPagedAudioReconstructions +
client.tts.synthesizeJsonStreaming({ ...params }) -> core.Stream
@@ -246,7 +240,9 @@ await client.empathicVoice.chatGroups.getChatGroup("697056f0-6c7e-487d-9bd8-9c19
-Fetches a paginated list of audio for each **Chat** within the specified **Chat Group**. For more details, see our guide on audio reconstruction [here](/docs/speech-to-speech-evi/faq#can-i-access-the-audio-of-previous-conversations-with-evi). +Streams synthesized speech using the specified voice. If no voice is provided, a novel voice will be generated dynamically. Optionally, additional context can be included to influence the speech's style and prosody. + +The response is a stream of JSON objects including audio encoded in base64.
@@ -261,11 +257,18 @@ Fetches a paginated list of audio for each **Chat** within the specified **Chat
```typescript -await client.empathicVoice.chatGroups.getAudio("369846cf-6ad5-404d-905e-a8acb5cdfc78", { - pageNumber: 0, - pageSize: 10, - ascendingOrder: true +const response = await client.tts.synthesizeJsonStreaming({ + utterances: [{ + text: "Beauty is no quality in things themselves: It exists merely in the mind which contemplates them.", + voice: { + name: "Male English Actor", + provider: "HUME_AI" + } + }] }); +for await (const item of response) { + console.log(item); +} ```
@@ -281,15 +284,7 @@ await client.empathicVoice.chatGroups.getAudio("369846cf-6ad5-404d-905e-a8acb5cd
-**id:** `string` — Identifier for a Chat Group. Formatted as a UUID. - -
-
- -
-
- -**request:** `Hume.empathicVoice.ChatGroupsGetAudioRequest` +**request:** `Hume.PostedTts`
@@ -297,7 +292,7 @@ await client.empathicVoice.chatGroups.getAudio("369846cf-6ad5-404d-905e-a8acb5cd
-**requestOptions:** `ChatGroups.RequestOptions` +**requestOptions:** `Tts.RequestOptions`
@@ -309,24 +304,10 @@ await client.empathicVoice.chatGroups.getAudio("369846cf-6ad5-404d-905e-a8acb5cd
-
client.empathicVoice.chatGroups.listChatGroupEvents(id, { ...params }) -> core.Page -
-
- -#### 📝 Description - -
-
- +
client.tts.convertVoiceJson({ ...params }) -> core.Stream
-Fetches a paginated list of **Chat** events associated with a **Chat Group**. -
-
-
-
- #### 🔌 Usage
@@ -336,28 +317,11 @@ Fetches a paginated list of **Chat** events associated with a **Chat Group**.
```typescript -const pageableResponse = await client.empathicVoice.chatGroups.listChatGroupEvents("697056f0-6c7e-487d-9bd8-9c19df79f05f", { - pageNumber: 0, - pageSize: 3, - ascendingOrder: true -}); -for await (const item of pageableResponse) { +const response = await client.tts.convertVoiceJson({}); +for await (const item of response) { console.log(item); } -// Or you can manually iterate page-by-page -let page = await client.empathicVoice.chatGroups.listChatGroupEvents("697056f0-6c7e-487d-9bd8-9c19df79f05f", { - pageNumber: 0, - pageSize: 3, - ascendingOrder: true -}); -while (page.hasNextPage()) { - page = page.getNextPage(); -} - -// You can also access the underlying response -const response = page.response; - ```
@@ -372,15 +336,7 @@ const response = page.response;
-**id:** `string` — Identifier for a Chat Group. Formatted as a UUID. - -
-
- -
-
- -**request:** `Hume.empathicVoice.ChatGroupsListChatGroupEventsRequest` +**request:** `Hume.tts.ConvertVoiceJsonRequest`
@@ -388,7 +344,7 @@ const response = page.response;
-**requestOptions:** `ChatGroups.RequestOptions` +**requestOptions:** `Tts.RequestOptions`
@@ -400,8 +356,8 @@ const response = page.response;
-## EmpathicVoice Chats -
client.empathicVoice.chats.listChats({ ...params }) -> core.Page +## Tts Voices +
client.tts.voices.list({ ...params }) -> core.Page
@@ -413,7 +369,7 @@ const response = page.response;
-Fetches a paginated list of **Chats**. +Lists voices you have saved in your account, or voices from the [Voice Library](https://platform.hume.ai/tts/voice-library).
@@ -428,20 +384,16 @@ Fetches a paginated list of **Chats**.
```typescript -const pageableResponse = await client.empathicVoice.chats.listChats({ - pageNumber: 0, - pageSize: 1, - ascendingOrder: true +const pageableResponse = await client.tts.voices.list({ + provider: "CUSTOM_VOICE" }); for await (const item of pageableResponse) { console.log(item); } // Or you can manually iterate page-by-page -let page = await client.empathicVoice.chats.listChats({ - pageNumber: 0, - pageSize: 1, - ascendingOrder: true +let page = await client.tts.voices.list({ + provider: "CUSTOM_VOICE" }); while (page.hasNextPage()) { page = page.getNextPage(); @@ -464,7 +416,7 @@ const response = page.response;
-**request:** `Hume.empathicVoice.ChatsListChatsRequest` +**request:** `Hume.tts.VoicesListRequest`
@@ -472,7 +424,7 @@ const response = page.response;
-**requestOptions:** `Chats.RequestOptions` +**requestOptions:** `Voices.RequestOptions`
@@ -484,7 +436,7 @@ const response = page.response;
-
client.empathicVoice.chats.listChatEvents(id, { ...params }) -> core.Page +
client.tts.voices.create({ ...params }) -> Hume.ReturnVoice
@@ -496,7 +448,9 @@ const response = page.response;
-Fetches a paginated list of **Chat** events. +Saves a new custom voice to your account using the specified TTS generation ID. + +Once saved, this voice can be reused in subsequent TTS requests, ensuring consistent speech style and prosody. For more details on voice creation, see the [Voices Guide](/docs/text-to-speech-tts/voices).
@@ -511,27 +465,10 @@ Fetches a paginated list of **Chat** events.
```typescript -const pageableResponse = await client.empathicVoice.chats.listChatEvents("470a49f6-1dec-4afe-8b61-035d3b2d63b0", { - pageNumber: 0, - pageSize: 3, - ascendingOrder: true -}); -for await (const item of pageableResponse) { - console.log(item); -} - -// Or you can manually iterate page-by-page -let page = await client.empathicVoice.chats.listChatEvents("470a49f6-1dec-4afe-8b61-035d3b2d63b0", { - pageNumber: 0, - pageSize: 3, - ascendingOrder: true +await client.tts.voices.create({ + generationId: "795c949a-1510-4a80-9646-7d0863b023ab", + name: "David Hume" }); -while (page.hasNextPage()) { - page = page.getNextPage(); -} - -// You can also access the underlying response -const response = page.response; ```
@@ -547,15 +484,7 @@ const response = page.response;
-**id:** `string` — Identifier for a Chat. Formatted as a UUID. - -
-
- -
-
- -**request:** `Hume.empathicVoice.ChatsListChatEventsRequest` +**request:** `Hume.tts.PostedVoice`
@@ -563,7 +492,7 @@ const response = page.response;
-**requestOptions:** `Chats.RequestOptions` +**requestOptions:** `Voices.RequestOptions`
@@ -575,7 +504,7 @@ const response = page.response;
-
client.empathicVoice.chats.getAudio(id) -> Hume.ReturnChatAudioReconstruction +
client.tts.voices.delete({ ...params }) -> void
@@ -587,7 +516,7 @@ const response = page.response;
-Fetches the audio of a previous **Chat**. For more details, see our guide on audio reconstruction [here](/docs/speech-to-speech-evi/faq#can-i-access-the-audio-of-previous-conversations-with-evi). +Deletes a previously generated custom voice.
@@ -602,7 +531,9 @@ Fetches the audio of a previous **Chat**. For more details, see our guide on aud
```typescript -await client.empathicVoice.chats.getAudio("470a49f6-1dec-4afe-8b61-035d3b2d63b0"); +await client.tts.voices.delete({ + name: "David Hume" +}); ```
@@ -618,7 +549,7 @@ await client.empathicVoice.chats.getAudio("470a49f6-1dec-4afe-8b61-035d3b2d63b0"
-**id:** `string` — Identifier for a chat. Formatted as a UUID. +**request:** `Hume.tts.VoicesDeleteRequest`
@@ -626,7 +557,7 @@ await client.empathicVoice.chats.getAudio("470a49f6-1dec-4afe-8b61-035d3b2d63b0"
-**requestOptions:** `Chats.RequestOptions` +**requestOptions:** `Voices.RequestOptions`
@@ -638,8 +569,8 @@ await client.empathicVoice.chats.getAudio("470a49f6-1dec-4afe-8b61-035d3b2d63b0"
-## EmpathicVoice Configs -
client.empathicVoice.configs.listConfigs({ ...params }) -> core.Page +## EmpathicVoice ControlPlane +
client.empathicVoice.controlPlane.send(chatId, { ...params }) -> void
@@ -651,9 +582,7 @@ await client.empathicVoice.chats.getAudio("470a49f6-1dec-4afe-8b61-035d3b2d63b0"
-Fetches a paginated list of **Configs**. - -For more details on configuration options and how to configure EVI, see our [configuration guide](/docs/speech-to-speech-evi/configuration). +Send a message to a specific chat.
@@ -668,25 +597,9 @@ For more details on configuration options and how to configure EVI, see our [con
```typescript -const pageableResponse = await client.empathicVoice.configs.listConfigs({ - pageNumber: 0, - pageSize: 1 -}); -for await (const item of pageableResponse) { - console.log(item); -} - -// Or you can manually iterate page-by-page -let page = await client.empathicVoice.configs.listConfigs({ - pageNumber: 0, - pageSize: 1 +await client.empathicVoice.controlPlane.send("chat_id", { + type: "session_settings" }); -while (page.hasNextPage()) { - page = page.getNextPage(); -} - -// You can also access the underlying response -const response = page.response; ```
@@ -702,102 +615,15 @@ const response = page.response;
-**request:** `Hume.empathicVoice.ConfigsListConfigsRequest` - -
-
- -
-
- -**requestOptions:** `Configs.RequestOptions` +**chatId:** `string` -
-
- -
- - - - -
- -
client.empathicVoice.configs.createConfig({ ...params }) -> Hume.ReturnConfig -
-
- -#### 📝 Description - -
-
- -
-
- -Creates a **Config** which can be applied to EVI. - -For more details on configuration options and how to configure EVI, see our [configuration guide](/docs/speech-to-speech-evi/configuration). -
-
-
-
- -#### 🔌 Usage - -
-
- -
-
- -```typescript -await client.empathicVoice.configs.createConfig({ - name: "Weather Assistant Config", - prompt: { - id: "af699d45-2985-42cc-91b9-af9e5da3bac5", - version: 0 - }, - eviVersion: "3", - voice: { - provider: "HUME_AI", - name: "Ava Song" - }, - languageModel: { - modelProvider: "ANTHROPIC", - modelResource: "claude-3-7-sonnet-latest", - temperature: 1 - }, - eventMessages: { - onNewChat: { - enabled: false, - text: "" - }, - onInactivityTimeout: { - enabled: false, - text: "" - }, - onMaxDurationTimeout: { - enabled: false, - text: "" - } - } -}); - -``` -
-
-#### ⚙️ Parameters - -
-
-
-**request:** `Hume.empathicVoice.PostedConfig` +**request:** `Hume.ControlPlanePublishEvent`
@@ -805,7 +631,7 @@ await client.empathicVoice.configs.createConfig({
-**requestOptions:** `Configs.RequestOptions` +**requestOptions:** `ControlPlane.RequestOptions`
@@ -817,7 +643,8 @@ await client.empathicVoice.configs.createConfig({
-
client.empathicVoice.configs.listConfigVersions(id, { ...params }) -> core.Page +## EmpathicVoice ChatGroups +
client.empathicVoice.chatGroups.listChatGroups({ ...params }) -> core.Page
@@ -829,9 +656,7 @@ await client.empathicVoice.configs.createConfig({
-Fetches a list of a **Config's** versions. - -For more details on configuration options and how to configure EVI, see our [configuration guide](/docs/speech-to-speech-evi/configuration). +Fetches a paginated list of **Chat Groups**.
@@ -846,13 +671,23 @@ For more details on configuration options and how to configure EVI, see our [con
```typescript -const pageableResponse = await client.empathicVoice.configs.listConfigVersions("1b60e1a0-cc59-424a-8d2c-189d354db3f3"); +const pageableResponse = await client.empathicVoice.chatGroups.listChatGroups({ + pageNumber: 0, + pageSize: 1, + ascendingOrder: true, + configId: "1b60e1a0-cc59-424a-8d2c-189d354db3f3" +}); for await (const item of pageableResponse) { console.log(item); } // Or you can manually iterate page-by-page -let page = await client.empathicVoice.configs.listConfigVersions("1b60e1a0-cc59-424a-8d2c-189d354db3f3"); +let page = await client.empathicVoice.chatGroups.listChatGroups({ + pageNumber: 0, + pageSize: 1, + ascendingOrder: true, + configId: "1b60e1a0-cc59-424a-8d2c-189d354db3f3" +}); while (page.hasNextPage()) { page = page.getNextPage(); } @@ -874,15 +709,7 @@ const response = page.response;
-**id:** `string` — Identifier for a Config. Formatted as a UUID. - -
-
- -
-
- -**request:** `Hume.empathicVoice.ConfigsListConfigVersionsRequest` +**request:** `Hume.empathicVoice.ChatGroupsListChatGroupsRequest`
@@ -890,7 +717,7 @@ const response = page.response;
-**requestOptions:** `Configs.RequestOptions` +**requestOptions:** `ChatGroups.RequestOptions`
@@ -902,7 +729,7 @@ const response = page.response;
-
client.empathicVoice.configs.createConfigVersion(id, { ...params }) -> Hume.ReturnConfig +
client.empathicVoice.chatGroups.getChatGroup(id, { ...params }) -> Hume.ReturnChatGroupPagedChats
@@ -914,9 +741,7 @@ const response = page.response;
-Updates a **Config** by creating a new version of the **Config**. - -For more details on configuration options and how to configure EVI, see our [configuration guide](/docs/speech-to-speech-evi/configuration). +Fetches a **ChatGroup** by ID, including a paginated list of **Chats** associated with the **ChatGroup**.
@@ -931,39 +756,10 @@ For more details on configuration options and how to configure EVI, see our [con
```typescript -await client.empathicVoice.configs.createConfigVersion("1b60e1a0-cc59-424a-8d2c-189d354db3f3", { - versionDescription: "This is an updated version of the Weather Assistant Config.", - eviVersion: "3", - prompt: { - id: "af699d45-2985-42cc-91b9-af9e5da3bac5", - version: 0 - }, - voice: { - provider: "HUME_AI", - name: "Ava Song" - }, - languageModel: { - modelProvider: "ANTHROPIC", - modelResource: "claude-3-7-sonnet-latest", - temperature: 1 - }, - ellmModel: { - allowShortResponses: true - }, - eventMessages: { - onNewChat: { - enabled: false, - text: "" - }, - onInactivityTimeout: { - enabled: false, - text: "" - }, - onMaxDurationTimeout: { - enabled: false, - text: "" - } - } +await client.empathicVoice.chatGroups.getChatGroup("697056f0-6c7e-487d-9bd8-9c19df79f05f", { + pageNumber: 0, + pageSize: 1, + ascendingOrder: true }); ``` @@ -980,7 +776,7 @@ await client.empathicVoice.configs.createConfigVersion("1b60e1a0-cc59-424a-8d2c-
-**id:** `string` — Identifier for a Config. Formatted as a UUID. +**id:** `string` — Identifier for a Chat Group. Formatted as a UUID.
@@ -988,7 +784,7 @@ await client.empathicVoice.configs.createConfigVersion("1b60e1a0-cc59-424a-8d2c-
-**request:** `Hume.empathicVoice.PostedConfigVersion` +**request:** `Hume.empathicVoice.ChatGroupsGetChatGroupRequest`
@@ -996,7 +792,7 @@ await client.empathicVoice.configs.createConfigVersion("1b60e1a0-cc59-424a-8d2c-
-**requestOptions:** `Configs.RequestOptions` +**requestOptions:** `ChatGroups.RequestOptions`
@@ -1008,7 +804,7 @@ await client.empathicVoice.configs.createConfigVersion("1b60e1a0-cc59-424a-8d2c-
-
client.empathicVoice.configs.deleteConfig(id) -> void +
client.empathicVoice.chatGroups.getAudio(id, { ...params }) -> Hume.ReturnChatGroupPagedAudioReconstructions
@@ -1020,9 +816,7 @@ await client.empathicVoice.configs.createConfigVersion("1b60e1a0-cc59-424a-8d2c-
-Deletes a **Config** and its versions. - -For more details on configuration options and how to configure EVI, see our [configuration guide](/docs/speech-to-speech-evi/configuration). +Fetches a paginated list of audio for each **Chat** within the specified **Chat Group**. For more details, see our guide on audio reconstruction [here](/docs/speech-to-speech-evi/faq#can-i-access-the-audio-of-previous-conversations-with-evi).
@@ -1037,7 +831,11 @@ For more details on configuration options and how to configure EVI, see our [con
```typescript -await client.empathicVoice.configs.deleteConfig("1b60e1a0-cc59-424a-8d2c-189d354db3f3"); +await client.empathicVoice.chatGroups.getAudio("369846cf-6ad5-404d-905e-a8acb5cdfc78", { + pageNumber: 0, + pageSize: 10, + ascendingOrder: true +}); ```
@@ -1053,7 +851,7 @@ await client.empathicVoice.configs.deleteConfig("1b60e1a0-cc59-424a-8d2c-189d354
-**id:** `string` — Identifier for a Config. Formatted as a UUID. +**id:** `string` — Identifier for a Chat Group. Formatted as a UUID.
@@ -1061,7 +859,15 @@ await client.empathicVoice.configs.deleteConfig("1b60e1a0-cc59-424a-8d2c-189d354
-**requestOptions:** `Configs.RequestOptions` +**request:** `Hume.empathicVoice.ChatGroupsGetAudioRequest` + +
+
+ +
+
+ +**requestOptions:** `ChatGroups.RequestOptions`
@@ -1073,7 +879,7 @@ await client.empathicVoice.configs.deleteConfig("1b60e1a0-cc59-424a-8d2c-189d354
-
client.empathicVoice.configs.updateConfigName(id, { ...params }) -> string +
client.empathicVoice.chatGroups.listChatGroupEvents(id, { ...params }) -> core.Page
@@ -1085,9 +891,7 @@ await client.empathicVoice.configs.deleteConfig("1b60e1a0-cc59-424a-8d2c-189d354
-Updates the name of a **Config**. - -For more details on configuration options and how to configure EVI, see our [configuration guide](/docs/speech-to-speech-evi/configuration). +Fetches a paginated list of **Chat** events associated with a **Chat Group**.
@@ -1102,9 +906,27 @@ For more details on configuration options and how to configure EVI, see our [con
```typescript -await client.empathicVoice.configs.updateConfigName("1b60e1a0-cc59-424a-8d2c-189d354db3f3", { - name: "Updated Weather Assistant Config Name" +const pageableResponse = await client.empathicVoice.chatGroups.listChatGroupEvents("697056f0-6c7e-487d-9bd8-9c19df79f05f", { + pageNumber: 0, + pageSize: 3, + ascendingOrder: true }); +for await (const item of pageableResponse) { + console.log(item); +} + +// Or you can manually iterate page-by-page +let page = await client.empathicVoice.chatGroups.listChatGroupEvents("697056f0-6c7e-487d-9bd8-9c19df79f05f", { + pageNumber: 0, + pageSize: 3, + ascendingOrder: true +}); +while (page.hasNextPage()) { + page = page.getNextPage(); +} + +// You can also access the underlying response +const response = page.response; ```
@@ -1120,7 +942,7 @@ await client.empathicVoice.configs.updateConfigName("1b60e1a0-cc59-424a-8d2c-189
-**id:** `string` — Identifier for a Config. Formatted as a UUID. +**id:** `string` — Identifier for a Chat Group. Formatted as a UUID.
@@ -1128,7 +950,7 @@ await client.empathicVoice.configs.updateConfigName("1b60e1a0-cc59-424a-8d2c-189
-**request:** `Hume.empathicVoice.PostedConfigName` +**request:** `Hume.empathicVoice.ChatGroupsListChatGroupEventsRequest`
@@ -1136,7 +958,7 @@ await client.empathicVoice.configs.updateConfigName("1b60e1a0-cc59-424a-8d2c-189
-**requestOptions:** `Configs.RequestOptions` +**requestOptions:** `ChatGroups.RequestOptions`
@@ -1148,7 +970,8 @@ await client.empathicVoice.configs.updateConfigName("1b60e1a0-cc59-424a-8d2c-189
-
client.empathicVoice.configs.getConfigVersion(id, version) -> Hume.ReturnConfig +## EmpathicVoice Chats +
client.empathicVoice.chats.listChats({ ...params }) -> core.Page
@@ -1160,9 +983,7 @@ await client.empathicVoice.configs.updateConfigName("1b60e1a0-cc59-424a-8d2c-189
-Fetches a specified version of a **Config**. - -For more details on configuration options and how to configure EVI, see our [configuration guide](/docs/speech-to-speech-evi/configuration). +Fetches a paginated list of **Chats**.
@@ -1177,7 +998,27 @@ For more details on configuration options and how to configure EVI, see our [con
```typescript -await client.empathicVoice.configs.getConfigVersion("1b60e1a0-cc59-424a-8d2c-189d354db3f3", 1); +const pageableResponse = await client.empathicVoice.chats.listChats({ + pageNumber: 0, + pageSize: 1, + ascendingOrder: true +}); +for await (const item of pageableResponse) { + console.log(item); +} + +// Or you can manually iterate page-by-page +let page = await client.empathicVoice.chats.listChats({ + pageNumber: 0, + pageSize: 1, + ascendingOrder: true +}); +while (page.hasNextPage()) { + page = page.getNextPage(); +} + +// You can also access the underlying response +const response = page.response; ```
@@ -1193,21 +1034,7 @@ await client.empathicVoice.configs.getConfigVersion("1b60e1a0-cc59-424a-8d2c-189
-**id:** `string` — Identifier for a Config. Formatted as a UUID. - -
-
- -
-
- -**version:** `number` - -Version number for a Config. - -Configs, Prompts, Custom Voices, and Tools are versioned. This versioning system supports iterative development, allowing you to progressively refine configurations and revert to previous versions if needed. - -Version numbers are integer values representing different iterations of the Config. Each update to the Config increments its version number. +**request:** `Hume.empathicVoice.ChatsListChatsRequest`
@@ -1215,7 +1042,7 @@ Version numbers are integer values representing different iterations of the Conf
-**requestOptions:** `Configs.RequestOptions` +**requestOptions:** `Chats.RequestOptions`
@@ -1227,7 +1054,7 @@ Version numbers are integer values representing different iterations of the Conf
-
client.empathicVoice.configs.deleteConfigVersion(id, version) -> void +
client.empathicVoice.chats.listChatEvents(id, { ...params }) -> core.Page
@@ -1239,9 +1066,7 @@ Version numbers are integer values representing different iterations of the Conf
-Deletes a specified version of a **Config**. - -For more details on configuration options and how to configure EVI, see our [configuration guide](/docs/speech-to-speech-evi/configuration). +Fetches a paginated list of **Chat** events.
@@ -1256,7 +1081,27 @@ For more details on configuration options and how to configure EVI, see our [con
```typescript -await client.empathicVoice.configs.deleteConfigVersion("1b60e1a0-cc59-424a-8d2c-189d354db3f3", 1); +const pageableResponse = await client.empathicVoice.chats.listChatEvents("470a49f6-1dec-4afe-8b61-035d3b2d63b0", { + pageNumber: 0, + pageSize: 3, + ascendingOrder: true +}); +for await (const item of pageableResponse) { + console.log(item); +} + +// Or you can manually iterate page-by-page +let page = await client.empathicVoice.chats.listChatEvents("470a49f6-1dec-4afe-8b61-035d3b2d63b0", { + pageNumber: 0, + pageSize: 3, + ascendingOrder: true +}); +while (page.hasNextPage()) { + page = page.getNextPage(); +} + +// You can also access the underlying response +const response = page.response; ```
@@ -1272,7 +1117,7 @@ await client.empathicVoice.configs.deleteConfigVersion("1b60e1a0-cc59-424a-8d2c-
-**id:** `string` — Identifier for a Config. Formatted as a UUID. +**id:** `string` — Identifier for a Chat. Formatted as a UUID.
@@ -1280,13 +1125,7 @@ await client.empathicVoice.configs.deleteConfigVersion("1b60e1a0-cc59-424a-8d2c-
-**version:** `number` - -Version number for a Config. - -Configs, Prompts, Custom Voices, and Tools are versioned. This versioning system supports iterative development, allowing you to progressively refine configurations and revert to previous versions if needed. - -Version numbers are integer values representing different iterations of the Config. Each update to the Config increments its version number. +**request:** `Hume.empathicVoice.ChatsListChatEventsRequest`
@@ -1294,7 +1133,7 @@ Version numbers are integer values representing different iterations of the Conf
-**requestOptions:** `Configs.RequestOptions` +**requestOptions:** `Chats.RequestOptions`
@@ -1306,7 +1145,7 @@ Version numbers are integer values representing different iterations of the Conf
-
client.empathicVoice.configs.updateConfigDescription(id, version, { ...params }) -> Hume.ReturnConfig +
client.empathicVoice.chats.getAudio(id) -> Hume.ReturnChatAudioReconstruction
@@ -1318,9 +1157,7 @@ Version numbers are integer values representing different iterations of the Conf
-Updates the description of a **Config**. - -For more details on configuration options and how to configure EVI, see our [configuration guide](/docs/speech-to-speech-evi/configuration). +Fetches the audio of a previous **Chat**. For more details, see our guide on audio reconstruction [here](/docs/speech-to-speech-evi/faq#can-i-access-the-audio-of-previous-conversations-with-evi).
@@ -1334,48 +1171,24 @@ For more details on configuration options and how to configure EVI, see our [con
-```typescript -await client.empathicVoice.configs.updateConfigDescription("1b60e1a0-cc59-424a-8d2c-189d354db3f3", 1, { - versionDescription: "This is an updated version_description." -}); - -``` -
-
- -
- -#### ⚙️ Parameters - -
-
- -
-
- -**id:** `string` — Identifier for a Config. Formatted as a UUID. - -
-
- -
-
- -**version:** `number` - -Version number for a Config. - -Configs, Prompts, Custom Voices, and Tools are versioned. This versioning system supports iterative development, allowing you to progressively refine configurations and revert to previous versions if needed. +```typescript +await client.empathicVoice.chats.getAudio("470a49f6-1dec-4afe-8b61-035d3b2d63b0"); -Version numbers are integer values representing different iterations of the Config. Each update to the Config increments its version number. - +``` +
+
+#### ⚙️ Parameters +
-**request:** `Hume.empathicVoice.PostedConfigVersionDescription` +
+
+ +**id:** `string` — Identifier for a chat. Formatted as a UUID.
@@ -1383,7 +1196,7 @@ Version numbers are integer values representing different iterations of the Conf
-**requestOptions:** `Configs.RequestOptions` +**requestOptions:** `Chats.RequestOptions`
@@ -1395,8 +1208,8 @@ Version numbers are integer values representing different iterations of the Conf
-## EmpathicVoice Prompts -
client.empathicVoice.prompts.listPrompts({ ...params }) -> core.Page<(Hume.ReturnPrompt | undefined), Hume.ReturnPagedPrompts> +## EmpathicVoice Configs +
client.empathicVoice.configs.listConfigs({ ...params }) -> core.Page
@@ -1408,9 +1221,9 @@ Version numbers are integer values representing different iterations of the Conf
-Fetches a paginated list of **Prompts**. +Fetches a paginated list of **Configs**. -See our [prompting guide](/docs/speech-to-speech-evi/guides/phone-calling) for tips on crafting your system prompt. +For more details on configuration options and how to configure EVI, see our [configuration guide](/docs/speech-to-speech-evi/configuration).
@@ -1425,18 +1238,18 @@ See our [prompting guide](/docs/speech-to-speech-evi/guides/phone-calling) for t
```typescript -const pageableResponse = await client.empathicVoice.prompts.listPrompts({ +const pageableResponse = await client.empathicVoice.configs.listConfigs({ pageNumber: 0, - pageSize: 2 + pageSize: 1 }); for await (const item of pageableResponse) { console.log(item); } // Or you can manually iterate page-by-page -let page = await client.empathicVoice.prompts.listPrompts({ +let page = await client.empathicVoice.configs.listConfigs({ pageNumber: 0, - pageSize: 2 + pageSize: 1 }); while (page.hasNextPage()) { page = page.getNextPage(); @@ -1459,7 +1272,7 @@ const response = page.response;
-**request:** `Hume.empathicVoice.PromptsListPromptsRequest` +**request:** `Hume.empathicVoice.ConfigsListConfigsRequest`
@@ -1467,7 +1280,7 @@ const response = page.response;
-**requestOptions:** `Prompts.RequestOptions` +**requestOptions:** `Configs.RequestOptions`
@@ -1479,7 +1292,7 @@ const response = page.response;
-
client.empathicVoice.prompts.createPrompt({ ...params }) -> Hume.ReturnPrompt | undefined +
client.empathicVoice.configs.createConfig({ ...params }) -> Hume.ReturnConfig
@@ -1491,9 +1304,9 @@ const response = page.response;
-Creates a **Prompt** that can be added to an [EVI configuration](/reference/speech-to-speech-evi/configs/create-config). +Creates a **Config** which can be applied to EVI. -See our [prompting guide](/docs/speech-to-speech-evi/guides/phone-calling) for tips on crafting your system prompt. +For more details on configuration options and how to configure EVI, see our [configuration guide](/docs/speech-to-speech-evi/configuration).
@@ -1508,9 +1321,36 @@ See our [prompting guide](/docs/speech-to-speech-evi/guides/phone-calling) for t
```typescript -await client.empathicVoice.prompts.createPrompt({ - name: "Weather Assistant Prompt", - text: "You are an AI weather assistant providing users with accurate and up-to-date weather information. Respond to user queries concisely and clearly. Use simple language and avoid technical jargon. Provide temperature, precipitation, wind conditions, and any weather alerts. Include helpful tips if severe weather is expected." +await client.empathicVoice.configs.createConfig({ + name: "Weather Assistant Config", + prompt: { + id: "af699d45-2985-42cc-91b9-af9e5da3bac5", + version: 0 + }, + eviVersion: "3", + voice: { + provider: "HUME_AI", + name: "Ava Song" + }, + languageModel: { + modelProvider: "ANTHROPIC", + modelResource: "claude-3-7-sonnet-latest", + temperature: 1 + }, + eventMessages: { + onNewChat: { + enabled: false, + text: "" + }, + onInactivityTimeout: { + enabled: false, + text: "" + }, + onMaxDurationTimeout: { + enabled: false, + text: "" + } + } }); ``` @@ -1527,7 +1367,7 @@ await client.empathicVoice.prompts.createPrompt({
-**request:** `Hume.empathicVoice.PostedPrompt` +**request:** `Hume.empathicVoice.PostedConfig`
@@ -1535,7 +1375,7 @@ await client.empathicVoice.prompts.createPrompt({
-**requestOptions:** `Prompts.RequestOptions` +**requestOptions:** `Configs.RequestOptions`
@@ -1547,7 +1387,7 @@ await client.empathicVoice.prompts.createPrompt({
-
client.empathicVoice.prompts.listPromptVersions(id, { ...params }) -> Hume.ReturnPagedPrompts +
client.empathicVoice.configs.listConfigVersions(id, { ...params }) -> core.Page
@@ -1559,9 +1399,9 @@ await client.empathicVoice.prompts.createPrompt({
-Fetches a list of a **Prompt's** versions. +Fetches a list of a **Config's** versions. -See our [prompting guide](/docs/speech-to-speech-evi/guides/phone-calling) for tips on crafting your system prompt. +For more details on configuration options and how to configure EVI, see our [configuration guide](/docs/speech-to-speech-evi/configuration).
@@ -1576,7 +1416,19 @@ See our [prompting guide](/docs/speech-to-speech-evi/guides/phone-calling) for t
```typescript -await client.empathicVoice.prompts.listPromptVersions("af699d45-2985-42cc-91b9-af9e5da3bac5"); +const pageableResponse = await client.empathicVoice.configs.listConfigVersions("1b60e1a0-cc59-424a-8d2c-189d354db3f3"); +for await (const item of pageableResponse) { + console.log(item); +} + +// Or you can manually iterate page-by-page +let page = await client.empathicVoice.configs.listConfigVersions("1b60e1a0-cc59-424a-8d2c-189d354db3f3"); +while (page.hasNextPage()) { + page = page.getNextPage(); +} + +// You can also access the underlying response +const response = page.response; ```
@@ -1592,7 +1444,7 @@ await client.empathicVoice.prompts.listPromptVersions("af699d45-2985-42cc-91b9-a
-**id:** `string` — Identifier for a Prompt. Formatted as a UUID. +**id:** `string` — Identifier for a Config. Formatted as a UUID.
@@ -1600,7 +1452,7 @@ await client.empathicVoice.prompts.listPromptVersions("af699d45-2985-42cc-91b9-a
-**request:** `Hume.empathicVoice.PromptsListPromptVersionsRequest` +**request:** `Hume.empathicVoice.ConfigsListConfigVersionsRequest`
@@ -1608,7 +1460,7 @@ await client.empathicVoice.prompts.listPromptVersions("af699d45-2985-42cc-91b9-a
-**requestOptions:** `Prompts.RequestOptions` +**requestOptions:** `Configs.RequestOptions`
@@ -1620,7 +1472,7 @@ await client.empathicVoice.prompts.listPromptVersions("af699d45-2985-42cc-91b9-a
-
client.empathicVoice.prompts.createPromptVersion(id, { ...params }) -> Hume.ReturnPrompt | undefined +
client.empathicVoice.configs.createConfigVersion(id, { ...params }) -> Hume.ReturnConfig
@@ -1632,9 +1484,9 @@ await client.empathicVoice.prompts.listPromptVersions("af699d45-2985-42cc-91b9-a
-Updates a **Prompt** by creating a new version of the **Prompt**. +Updates a **Config** by creating a new version of the **Config**. -See our [prompting guide](/docs/speech-to-speech-evi/guides/phone-calling) for tips on crafting your system prompt. +For more details on configuration options and how to configure EVI, see our [configuration guide](/docs/speech-to-speech-evi/configuration).
@@ -1649,9 +1501,39 @@ See our [prompting guide](/docs/speech-to-speech-evi/guides/phone-calling) for t
```typescript -await client.empathicVoice.prompts.createPromptVersion("af699d45-2985-42cc-91b9-af9e5da3bac5", { - text: "You are an updated version of an AI weather assistant providing users with accurate and up-to-date weather information. Respond to user queries concisely and clearly. Use simple language and avoid technical jargon. Provide temperature, precipitation, wind conditions, and any weather alerts. Include helpful tips if severe weather is expected.", - versionDescription: "This is an updated version of the Weather Assistant Prompt." +await client.empathicVoice.configs.createConfigVersion("1b60e1a0-cc59-424a-8d2c-189d354db3f3", { + versionDescription: "This is an updated version of the Weather Assistant Config.", + eviVersion: "3", + prompt: { + id: "af699d45-2985-42cc-91b9-af9e5da3bac5", + version: 0 + }, + voice: { + provider: "HUME_AI", + name: "Ava Song" + }, + languageModel: { + modelProvider: "ANTHROPIC", + modelResource: "claude-3-7-sonnet-latest", + temperature: 1 + }, + ellmModel: { + allowShortResponses: true + }, + eventMessages: { + onNewChat: { + enabled: false, + text: "" + }, + onInactivityTimeout: { + enabled: false, + text: "" + }, + onMaxDurationTimeout: { + enabled: false, + text: "" + } + } }); ``` @@ -1668,7 +1550,7 @@ await client.empathicVoice.prompts.createPromptVersion("af699d45-2985-42cc-91b9-
-**id:** `string` — Identifier for a Prompt. Formatted as a UUID. +**id:** `string` — Identifier for a Config. Formatted as a UUID.
@@ -1676,7 +1558,7 @@ await client.empathicVoice.prompts.createPromptVersion("af699d45-2985-42cc-91b9-
-**request:** `Hume.empathicVoice.PostedPromptVersion` +**request:** `Hume.empathicVoice.PostedConfigVersion`
@@ -1684,7 +1566,7 @@ await client.empathicVoice.prompts.createPromptVersion("af699d45-2985-42cc-91b9-
-**requestOptions:** `Prompts.RequestOptions` +**requestOptions:** `Configs.RequestOptions`
@@ -1696,7 +1578,7 @@ await client.empathicVoice.prompts.createPromptVersion("af699d45-2985-42cc-91b9-
-
client.empathicVoice.prompts.deletePrompt(id) -> void +
client.empathicVoice.configs.deleteConfig(id) -> void
@@ -1708,9 +1590,9 @@ await client.empathicVoice.prompts.createPromptVersion("af699d45-2985-42cc-91b9-
-Deletes a **Prompt** and its versions. +Deletes a **Config** and its versions. -See our [prompting guide](/docs/speech-to-speech-evi/guides/phone-calling) for tips on crafting your system prompt. +For more details on configuration options and how to configure EVI, see our [configuration guide](/docs/speech-to-speech-evi/configuration).
@@ -1725,7 +1607,7 @@ See our [prompting guide](/docs/speech-to-speech-evi/guides/phone-calling) for t
```typescript -await client.empathicVoice.prompts.deletePrompt("af699d45-2985-42cc-91b9-af9e5da3bac5"); +await client.empathicVoice.configs.deleteConfig("1b60e1a0-cc59-424a-8d2c-189d354db3f3"); ```
@@ -1741,7 +1623,7 @@ await client.empathicVoice.prompts.deletePrompt("af699d45-2985-42cc-91b9-af9e5da
-**id:** `string` — Identifier for a Prompt. Formatted as a UUID. +**id:** `string` — Identifier for a Config. Formatted as a UUID.
@@ -1749,7 +1631,7 @@ await client.empathicVoice.prompts.deletePrompt("af699d45-2985-42cc-91b9-af9e5da
-**requestOptions:** `Prompts.RequestOptions` +**requestOptions:** `Configs.RequestOptions`
@@ -1761,7 +1643,7 @@ await client.empathicVoice.prompts.deletePrompt("af699d45-2985-42cc-91b9-af9e5da
-
client.empathicVoice.prompts.updatePromptName(id, { ...params }) -> string +
client.empathicVoice.configs.updateConfigName(id, { ...params }) -> string
@@ -1773,9 +1655,9 @@ await client.empathicVoice.prompts.deletePrompt("af699d45-2985-42cc-91b9-af9e5da
-Updates the name of a **Prompt**. +Updates the name of a **Config**. -See our [prompting guide](/docs/speech-to-speech-evi/guides/phone-calling) for tips on crafting your system prompt. +For more details on configuration options and how to configure EVI, see our [configuration guide](/docs/speech-to-speech-evi/configuration).
@@ -1790,8 +1672,8 @@ See our [prompting guide](/docs/speech-to-speech-evi/guides/phone-calling) for t
```typescript -await client.empathicVoice.prompts.updatePromptName("af699d45-2985-42cc-91b9-af9e5da3bac5", { - name: "Updated Weather Assistant Prompt Name" +await client.empathicVoice.configs.updateConfigName("1b60e1a0-cc59-424a-8d2c-189d354db3f3", { + name: "Updated Weather Assistant Config Name" }); ``` @@ -1808,7 +1690,7 @@ await client.empathicVoice.prompts.updatePromptName("af699d45-2985-42cc-91b9-af9
-**id:** `string` — Identifier for a Prompt. Formatted as a UUID. +**id:** `string` — Identifier for a Config. Formatted as a UUID.
@@ -1816,7 +1698,7 @@ await client.empathicVoice.prompts.updatePromptName("af699d45-2985-42cc-91b9-af9
-**request:** `Hume.empathicVoice.PostedPromptName` +**request:** `Hume.empathicVoice.PostedConfigName`
@@ -1824,7 +1706,7 @@ await client.empathicVoice.prompts.updatePromptName("af699d45-2985-42cc-91b9-af9
-**requestOptions:** `Prompts.RequestOptions` +**requestOptions:** `Configs.RequestOptions`
@@ -1836,7 +1718,7 @@ await client.empathicVoice.prompts.updatePromptName("af699d45-2985-42cc-91b9-af9
-
client.empathicVoice.prompts.getPromptVersion(id, version) -> Hume.ReturnPrompt | undefined +
client.empathicVoice.configs.getConfigVersion(id, version) -> Hume.ReturnConfig
@@ -1848,9 +1730,9 @@ await client.empathicVoice.prompts.updatePromptName("af699d45-2985-42cc-91b9-af9
-Fetches a specified version of a **Prompt**. +Fetches a specified version of a **Config**. -See our [prompting guide](/docs/speech-to-speech-evi/guides/phone-calling) for tips on crafting your system prompt. +For more details on configuration options and how to configure EVI, see our [configuration guide](/docs/speech-to-speech-evi/configuration).
@@ -1865,7 +1747,7 @@ See our [prompting guide](/docs/speech-to-speech-evi/guides/phone-calling) for t
```typescript -await client.empathicVoice.prompts.getPromptVersion("af699d45-2985-42cc-91b9-af9e5da3bac5", 0); +await client.empathicVoice.configs.getConfigVersion("1b60e1a0-cc59-424a-8d2c-189d354db3f3", 1); ```
@@ -1881,7 +1763,7 @@ await client.empathicVoice.prompts.getPromptVersion("af699d45-2985-42cc-91b9-af9
-**id:** `string` — Identifier for a Prompt. Formatted as a UUID. +**id:** `string` — Identifier for a Config. Formatted as a UUID.
@@ -1891,11 +1773,11 @@ await client.empathicVoice.prompts.getPromptVersion("af699d45-2985-42cc-91b9-af9 **version:** `number` -Version number for a Prompt. +Version number for a Config. -Prompts, Configs, Custom Voices, and Tools are versioned. This versioning system supports iterative development, allowing you to progressively refine prompts and revert to previous versions if needed. +Configs, Prompts, Custom Voices, and Tools are versioned. This versioning system supports iterative development, allowing you to progressively refine configurations and revert to previous versions if needed. -Version numbers are integer values representing different iterations of the Prompt. Each update to the Prompt increments its version number. +Version numbers are integer values representing different iterations of the Config. Each update to the Config increments its version number.
@@ -1903,7 +1785,7 @@ Version numbers are integer values representing different iterations of the Prom
-**requestOptions:** `Prompts.RequestOptions` +**requestOptions:** `Configs.RequestOptions`
@@ -1915,7 +1797,7 @@ Version numbers are integer values representing different iterations of the Prom
-
client.empathicVoice.prompts.deletePromptVersion(id, version) -> void +
client.empathicVoice.configs.deleteConfigVersion(id, version) -> void
@@ -1927,9 +1809,9 @@ Version numbers are integer values representing different iterations of the Prom
-Deletes a specified version of a **Prompt**. +Deletes a specified version of a **Config**. -See our [prompting guide](/docs/speech-to-speech-evi/guides/phone-calling) for tips on crafting your system prompt. +For more details on configuration options and how to configure EVI, see our [configuration guide](/docs/speech-to-speech-evi/configuration).
@@ -1944,7 +1826,7 @@ See our [prompting guide](/docs/speech-to-speech-evi/guides/phone-calling) for t
```typescript -await client.empathicVoice.prompts.deletePromptVersion("af699d45-2985-42cc-91b9-af9e5da3bac5", 1); +await client.empathicVoice.configs.deleteConfigVersion("1b60e1a0-cc59-424a-8d2c-189d354db3f3", 1); ```
@@ -1960,7 +1842,7 @@ await client.empathicVoice.prompts.deletePromptVersion("af699d45-2985-42cc-91b9-
-**id:** `string` — Identifier for a Prompt. Formatted as a UUID. +**id:** `string` — Identifier for a Config. Formatted as a UUID.
@@ -1970,11 +1852,11 @@ await client.empathicVoice.prompts.deletePromptVersion("af699d45-2985-42cc-91b9- **version:** `number` -Version number for a Prompt. +Version number for a Config. -Prompts, Configs, Custom Voices, and Tools are versioned. This versioning system supports iterative development, allowing you to progressively refine prompts and revert to previous versions if needed. +Configs, Prompts, Custom Voices, and Tools are versioned. This versioning system supports iterative development, allowing you to progressively refine configurations and revert to previous versions if needed. -Version numbers are integer values representing different iterations of the Prompt. Each update to the Prompt increments its version number. +Version numbers are integer values representing different iterations of the Config. Each update to the Config increments its version number.
@@ -1982,7 +1864,7 @@ Version numbers are integer values representing different iterations of the Prom
-**requestOptions:** `Prompts.RequestOptions` +**requestOptions:** `Configs.RequestOptions`
@@ -1994,7 +1876,7 @@ Version numbers are integer values representing different iterations of the Prom
-
client.empathicVoice.prompts.updatePromptDescription(id, version, { ...params }) -> Hume.ReturnPrompt | undefined +
client.empathicVoice.configs.updateConfigDescription(id, version, { ...params }) -> Hume.ReturnConfig
@@ -2006,9 +1888,9 @@ Version numbers are integer values representing different iterations of the Prom
-Updates the description of a **Prompt**. +Updates the description of a **Config**. -See our [prompting guide](/docs/speech-to-speech-evi/guides/phone-calling) for tips on crafting your system prompt. +For more details on configuration options and how to configure EVI, see our [configuration guide](/docs/speech-to-speech-evi/configuration).
@@ -2023,7 +1905,7 @@ See our [prompting guide](/docs/speech-to-speech-evi/guides/phone-calling) for t
```typescript -await client.empathicVoice.prompts.updatePromptDescription("af699d45-2985-42cc-91b9-af9e5da3bac5", 1, { +await client.empathicVoice.configs.updateConfigDescription("1b60e1a0-cc59-424a-8d2c-189d354db3f3", 1, { versionDescription: "This is an updated version_description." }); @@ -2041,7 +1923,7 @@ await client.empathicVoice.prompts.updatePromptDescription("af699d45-2985-42cc-9
-**id:** `string` — Identifier for a Prompt. Formatted as a UUID. +**id:** `string` — Identifier for a Config. Formatted as a UUID.
@@ -2051,11 +1933,11 @@ await client.empathicVoice.prompts.updatePromptDescription("af699d45-2985-42cc-9 **version:** `number` -Version number for a Prompt. +Version number for a Config. -Prompts, Configs, Custom Voices, and Tools are versioned. This versioning system supports iterative development, allowing you to progressively refine prompts and revert to previous versions if needed. +Configs, Prompts, Custom Voices, and Tools are versioned. This versioning system supports iterative development, allowing you to progressively refine configurations and revert to previous versions if needed. -Version numbers are integer values representing different iterations of the Prompt. Each update to the Prompt increments its version number. +Version numbers are integer values representing different iterations of the Config. Each update to the Config increments its version number.
@@ -2063,7 +1945,7 @@ Version numbers are integer values representing different iterations of the Prom
-**request:** `Hume.empathicVoice.PostedPromptVersionDescription` +**request:** `Hume.empathicVoice.PostedConfigVersionDescription`
@@ -2071,7 +1953,7 @@ Version numbers are integer values representing different iterations of the Prom
-**requestOptions:** `Prompts.RequestOptions` +**requestOptions:** `Configs.RequestOptions`
@@ -2083,8 +1965,8 @@ Version numbers are integer values representing different iterations of the Prom
-## EmpathicVoice Tools -
client.empathicVoice.tools.listTools({ ...params }) -> core.Page<(Hume.ReturnUserDefinedTool | undefined), Hume.ReturnPagedUserDefinedTools> +## EmpathicVoice Prompts +
client.empathicVoice.prompts.listPrompts({ ...params }) -> core.Page<(Hume.ReturnPrompt | undefined), Hume.ReturnPagedPrompts>
@@ -2096,9 +1978,9 @@ Version numbers are integer values representing different iterations of the Prom
-Fetches a paginated list of **Tools**. +Fetches a paginated list of **Prompts**. -Refer to our [tool use](/docs/speech-to-speech-evi/features/tool-use#function-calling) guide for comprehensive instructions on defining and integrating tools into EVI. +See our [prompting guide](/docs/speech-to-speech-evi/guides/phone-calling) for tips on crafting your system prompt.
@@ -2113,7 +1995,7 @@ Refer to our [tool use](/docs/speech-to-speech-evi/features/tool-use#function-ca
```typescript -const pageableResponse = await client.empathicVoice.tools.listTools({ +const pageableResponse = await client.empathicVoice.prompts.listPrompts({ pageNumber: 0, pageSize: 2 }); @@ -2122,7 +2004,7 @@ for await (const item of pageableResponse) { } // Or you can manually iterate page-by-page -let page = await client.empathicVoice.tools.listTools({ +let page = await client.empathicVoice.prompts.listPrompts({ pageNumber: 0, pageSize: 2 }); @@ -2147,7 +2029,7 @@ const response = page.response;
-**request:** `Hume.empathicVoice.ToolsListToolsRequest` +**request:** `Hume.empathicVoice.PromptsListPromptsRequest`
@@ -2155,7 +2037,7 @@ const response = page.response;
-**requestOptions:** `Tools.RequestOptions` +**requestOptions:** `Prompts.RequestOptions`
@@ -2167,7 +2049,7 @@ const response = page.response;
-
client.empathicVoice.tools.createTool({ ...params }) -> Hume.ReturnUserDefinedTool | undefined +
client.empathicVoice.prompts.createPrompt({ ...params }) -> Hume.ReturnPrompt | undefined
@@ -2179,9 +2061,9 @@ const response = page.response;
-Creates a **Tool** that can be added to an [EVI configuration](/reference/speech-to-speech-evi/configs/create-config). +Creates a **Prompt** that can be added to an [EVI configuration](/reference/speech-to-speech-evi/configs/create-config). -Refer to our [tool use](/docs/speech-to-speech-evi/features/tool-use#function-calling) guide for comprehensive instructions on defining and integrating tools into EVI. +See our [prompting guide](/docs/speech-to-speech-evi/guides/phone-calling) for tips on crafting your system prompt.
@@ -2196,12 +2078,9 @@ Refer to our [tool use](/docs/speech-to-speech-evi/features/tool-use#function-ca
```typescript -await client.empathicVoice.tools.createTool({ - name: "get_current_weather", - parameters: "{ \"type\": \"object\", \"properties\": { \"location\": { \"type\": \"string\", \"description\": \"The city and state, e.g. San Francisco, CA\" }, \"format\": { \"type\": \"string\", \"enum\": [\"celsius\", \"fahrenheit\"], \"description\": \"The temperature unit to use. Infer this from the users location.\" } }, \"required\": [\"location\", \"format\"] }", - versionDescription: "Fetches current weather and uses celsius or fahrenheit based on location of user.", - description: "This tool is for getting the current weather.", - fallbackContent: "Unable to fetch current weather." +await client.empathicVoice.prompts.createPrompt({ + name: "Weather Assistant Prompt", + text: "You are an AI weather assistant providing users with accurate and up-to-date weather information. Respond to user queries concisely and clearly. Use simple language and avoid technical jargon. Provide temperature, precipitation, wind conditions, and any weather alerts. Include helpful tips if severe weather is expected." }); ``` @@ -2218,7 +2097,7 @@ await client.empathicVoice.tools.createTool({
-**request:** `Hume.empathicVoice.PostedUserDefinedTool` +**request:** `Hume.empathicVoice.PostedPrompt`
@@ -2226,7 +2105,7 @@ await client.empathicVoice.tools.createTool({
-**requestOptions:** `Tools.RequestOptions` +**requestOptions:** `Prompts.RequestOptions`
@@ -2238,7 +2117,7 @@ await client.empathicVoice.tools.createTool({
-
client.empathicVoice.tools.listToolVersions(id, { ...params }) -> core.Page<(Hume.ReturnUserDefinedTool | undefined), Hume.ReturnPagedUserDefinedTools> +
client.empathicVoice.prompts.listPromptVersions(id, { ...params }) -> Hume.ReturnPagedPrompts
@@ -2250,9 +2129,9 @@ await client.empathicVoice.tools.createTool({
-Fetches a list of a **Tool's** versions. +Fetches a list of a **Prompt's** versions. -Refer to our [tool use](/docs/speech-to-speech-evi/features/tool-use#function-calling) guide for comprehensive instructions on defining and integrating tools into EVI. +See our [prompting guide](/docs/speech-to-speech-evi/guides/phone-calling) for tips on crafting your system prompt.
@@ -2267,19 +2146,7 @@ Refer to our [tool use](/docs/speech-to-speech-evi/features/tool-use#function-ca
```typescript -const pageableResponse = await client.empathicVoice.tools.listToolVersions("00183a3f-79ba-413d-9f3b-609864268bea"); -for await (const item of pageableResponse) { - console.log(item); -} - -// Or you can manually iterate page-by-page -let page = await client.empathicVoice.tools.listToolVersions("00183a3f-79ba-413d-9f3b-609864268bea"); -while (page.hasNextPage()) { - page = page.getNextPage(); -} - -// You can also access the underlying response -const response = page.response; +await client.empathicVoice.prompts.listPromptVersions("af699d45-2985-42cc-91b9-af9e5da3bac5"); ```
@@ -2295,7 +2162,7 @@ const response = page.response;
-**id:** `string` — Identifier for a Tool. Formatted as a UUID. +**id:** `string` — Identifier for a Prompt. Formatted as a UUID.
@@ -2303,7 +2170,7 @@ const response = page.response;
-**request:** `Hume.empathicVoice.ToolsListToolVersionsRequest` +**request:** `Hume.empathicVoice.PromptsListPromptVersionsRequest`
@@ -2311,7 +2178,7 @@ const response = page.response;
-**requestOptions:** `Tools.RequestOptions` +**requestOptions:** `Prompts.RequestOptions`
@@ -2323,7 +2190,7 @@ const response = page.response;
-
client.empathicVoice.tools.createToolVersion(id, { ...params }) -> Hume.ReturnUserDefinedTool | undefined +
client.empathicVoice.prompts.createPromptVersion(id, { ...params }) -> Hume.ReturnPrompt | undefined
@@ -2335,9 +2202,9 @@ const response = page.response;
-Updates a **Tool** by creating a new version of the **Tool**. +Updates a **Prompt** by creating a new version of the **Prompt**. -Refer to our [tool use](/docs/speech-to-speech-evi/features/tool-use#function-calling) guide for comprehensive instructions on defining and integrating tools into EVI. +See our [prompting guide](/docs/speech-to-speech-evi/guides/phone-calling) for tips on crafting your system prompt.
@@ -2352,11 +2219,9 @@ Refer to our [tool use](/docs/speech-to-speech-evi/features/tool-use#function-ca
```typescript -await client.empathicVoice.tools.createToolVersion("00183a3f-79ba-413d-9f3b-609864268bea", { - parameters: "{ \"type\": \"object\", \"properties\": { \"location\": { \"type\": \"string\", \"description\": \"The city and state, e.g. San Francisco, CA\" }, \"format\": { \"type\": \"string\", \"enum\": [\"celsius\", \"fahrenheit\", \"kelvin\"], \"description\": \"The temperature unit to use. Infer this from the users location.\" } }, \"required\": [\"location\", \"format\"] }", - versionDescription: "Fetches current weather and uses celsius, fahrenheit, or kelvin based on location of user.", - fallbackContent: "Unable to fetch current weather.", - description: "This tool is for getting the current weather." +await client.empathicVoice.prompts.createPromptVersion("af699d45-2985-42cc-91b9-af9e5da3bac5", { + text: "You are an updated version of an AI weather assistant providing users with accurate and up-to-date weather information. Respond to user queries concisely and clearly. Use simple language and avoid technical jargon. Provide temperature, precipitation, wind conditions, and any weather alerts. Include helpful tips if severe weather is expected.", + versionDescription: "This is an updated version of the Weather Assistant Prompt." }); ``` @@ -2373,7 +2238,7 @@ await client.empathicVoice.tools.createToolVersion("00183a3f-79ba-413d-9f3b-6098
-**id:** `string` — Identifier for a Tool. Formatted as a UUID. +**id:** `string` — Identifier for a Prompt. Formatted as a UUID.
@@ -2381,7 +2246,7 @@ await client.empathicVoice.tools.createToolVersion("00183a3f-79ba-413d-9f3b-6098
-**request:** `Hume.empathicVoice.PostedUserDefinedToolVersion` +**request:** `Hume.empathicVoice.PostedPromptVersion`
@@ -2389,7 +2254,7 @@ await client.empathicVoice.tools.createToolVersion("00183a3f-79ba-413d-9f3b-6098
-**requestOptions:** `Tools.RequestOptions` +**requestOptions:** `Prompts.RequestOptions`
@@ -2401,7 +2266,7 @@ await client.empathicVoice.tools.createToolVersion("00183a3f-79ba-413d-9f3b-6098
-
client.empathicVoice.tools.deleteTool(id) -> void +
client.empathicVoice.prompts.deletePrompt(id) -> void
@@ -2413,9 +2278,9 @@ await client.empathicVoice.tools.createToolVersion("00183a3f-79ba-413d-9f3b-6098
-Deletes a **Tool** and its versions. +Deletes a **Prompt** and its versions. -Refer to our [tool use](/docs/speech-to-speech-evi/features/tool-use#function-calling) guide for comprehensive instructions on defining and integrating tools into EVI. +See our [prompting guide](/docs/speech-to-speech-evi/guides/phone-calling) for tips on crafting your system prompt.
@@ -2430,7 +2295,7 @@ Refer to our [tool use](/docs/speech-to-speech-evi/features/tool-use#function-ca
```typescript -await client.empathicVoice.tools.deleteTool("00183a3f-79ba-413d-9f3b-609864268bea"); +await client.empathicVoice.prompts.deletePrompt("af699d45-2985-42cc-91b9-af9e5da3bac5"); ```
@@ -2446,7 +2311,7 @@ await client.empathicVoice.tools.deleteTool("00183a3f-79ba-413d-9f3b-609864268be
-**id:** `string` — Identifier for a Tool. Formatted as a UUID. +**id:** `string` — Identifier for a Prompt. Formatted as a UUID.
@@ -2454,7 +2319,7 @@ await client.empathicVoice.tools.deleteTool("00183a3f-79ba-413d-9f3b-609864268be
-**requestOptions:** `Tools.RequestOptions` +**requestOptions:** `Prompts.RequestOptions`
@@ -2466,7 +2331,7 @@ await client.empathicVoice.tools.deleteTool("00183a3f-79ba-413d-9f3b-609864268be
-
client.empathicVoice.tools.updateToolName(id, { ...params }) -> string +
client.empathicVoice.prompts.updatePromptName(id, { ...params }) -> string
@@ -2478,9 +2343,9 @@ await client.empathicVoice.tools.deleteTool("00183a3f-79ba-413d-9f3b-609864268be
-Updates the name of a **Tool**. +Updates the name of a **Prompt**. -Refer to our [tool use](/docs/speech-to-speech-evi/features/tool-use#function-calling) guide for comprehensive instructions on defining and integrating tools into EVI. +See our [prompting guide](/docs/speech-to-speech-evi/guides/phone-calling) for tips on crafting your system prompt.
@@ -2495,8 +2360,8 @@ Refer to our [tool use](/docs/speech-to-speech-evi/features/tool-use#function-ca
```typescript -await client.empathicVoice.tools.updateToolName("00183a3f-79ba-413d-9f3b-609864268bea", { - name: "get_current_temperature" +await client.empathicVoice.prompts.updatePromptName("af699d45-2985-42cc-91b9-af9e5da3bac5", { + name: "Updated Weather Assistant Prompt Name" }); ``` @@ -2513,7 +2378,7 @@ await client.empathicVoice.tools.updateToolName("00183a3f-79ba-413d-9f3b-6098642
-**id:** `string` — Identifier for a Tool. Formatted as a UUID. +**id:** `string` — Identifier for a Prompt. Formatted as a UUID.
@@ -2521,7 +2386,7 @@ await client.empathicVoice.tools.updateToolName("00183a3f-79ba-413d-9f3b-6098642
-**request:** `Hume.empathicVoice.PostedUserDefinedToolName` +**request:** `Hume.empathicVoice.PostedPromptName`
@@ -2529,7 +2394,7 @@ await client.empathicVoice.tools.updateToolName("00183a3f-79ba-413d-9f3b-6098642
-**requestOptions:** `Tools.RequestOptions` +**requestOptions:** `Prompts.RequestOptions`
@@ -2541,7 +2406,7 @@ await client.empathicVoice.tools.updateToolName("00183a3f-79ba-413d-9f3b-6098642
-
client.empathicVoice.tools.getToolVersion(id, version) -> Hume.ReturnUserDefinedTool | undefined +
client.empathicVoice.prompts.getPromptVersion(id, version) -> Hume.ReturnPrompt | undefined
@@ -2553,9 +2418,9 @@ await client.empathicVoice.tools.updateToolName("00183a3f-79ba-413d-9f3b-6098642
-Fetches a specified version of a **Tool**. +Fetches a specified version of a **Prompt**. -Refer to our [tool use](/docs/speech-to-speech-evi/features/tool-use#function-calling) guide for comprehensive instructions on defining and integrating tools into EVI. +See our [prompting guide](/docs/speech-to-speech-evi/guides/phone-calling) for tips on crafting your system prompt.
@@ -2570,7 +2435,7 @@ Refer to our [tool use](/docs/speech-to-speech-evi/features/tool-use#function-ca
```typescript -await client.empathicVoice.tools.getToolVersion("00183a3f-79ba-413d-9f3b-609864268bea", 1); +await client.empathicVoice.prompts.getPromptVersion("af699d45-2985-42cc-91b9-af9e5da3bac5", 0); ```
@@ -2586,7 +2451,7 @@ await client.empathicVoice.tools.getToolVersion("00183a3f-79ba-413d-9f3b-6098642
-**id:** `string` — Identifier for a Tool. Formatted as a UUID. +**id:** `string` — Identifier for a Prompt. Formatted as a UUID.
@@ -2596,11 +2461,11 @@ await client.empathicVoice.tools.getToolVersion("00183a3f-79ba-413d-9f3b-6098642 **version:** `number` -Version number for a Tool. +Version number for a Prompt. -Tools, Configs, Custom Voices, and Prompts are versioned. This versioning system supports iterative development, allowing you to progressively refine tools and revert to previous versions if needed. +Prompts, Configs, Custom Voices, and Tools are versioned. This versioning system supports iterative development, allowing you to progressively refine prompts and revert to previous versions if needed. -Version numbers are integer values representing different iterations of the Tool. Each update to the Tool increments its version number. +Version numbers are integer values representing different iterations of the Prompt. Each update to the Prompt increments its version number.
@@ -2608,7 +2473,7 @@ Version numbers are integer values representing different iterations of the Tool
-**requestOptions:** `Tools.RequestOptions` +**requestOptions:** `Prompts.RequestOptions`
@@ -2620,7 +2485,7 @@ Version numbers are integer values representing different iterations of the Tool
-
client.empathicVoice.tools.deleteToolVersion(id, version) -> void +
client.empathicVoice.prompts.deletePromptVersion(id, version) -> void
@@ -2632,9 +2497,9 @@ Version numbers are integer values representing different iterations of the Tool
-Deletes a specified version of a **Tool**. +Deletes a specified version of a **Prompt**. -Refer to our [tool use](/docs/speech-to-speech-evi/features/tool-use#function-calling) guide for comprehensive instructions on defining and integrating tools into EVI. +See our [prompting guide](/docs/speech-to-speech-evi/guides/phone-calling) for tips on crafting your system prompt.
@@ -2649,7 +2514,7 @@ Refer to our [tool use](/docs/speech-to-speech-evi/features/tool-use#function-ca
```typescript -await client.empathicVoice.tools.deleteToolVersion("00183a3f-79ba-413d-9f3b-609864268bea", 1); +await client.empathicVoice.prompts.deletePromptVersion("af699d45-2985-42cc-91b9-af9e5da3bac5", 1); ```
@@ -2665,7 +2530,7 @@ await client.empathicVoice.tools.deleteToolVersion("00183a3f-79ba-413d-9f3b-6098
-**id:** `string` — Identifier for a Tool. Formatted as a UUID. +**id:** `string` — Identifier for a Prompt. Formatted as a UUID.
@@ -2675,11 +2540,11 @@ await client.empathicVoice.tools.deleteToolVersion("00183a3f-79ba-413d-9f3b-6098 **version:** `number` -Version number for a Tool. +Version number for a Prompt. -Tools, Configs, Custom Voices, and Prompts are versioned. This versioning system supports iterative development, allowing you to progressively refine tools and revert to previous versions if needed. +Prompts, Configs, Custom Voices, and Tools are versioned. This versioning system supports iterative development, allowing you to progressively refine prompts and revert to previous versions if needed. -Version numbers are integer values representing different iterations of the Tool. Each update to the Tool increments its version number. +Version numbers are integer values representing different iterations of the Prompt. Each update to the Prompt increments its version number.
@@ -2687,7 +2552,7 @@ Version numbers are integer values representing different iterations of the Tool
-**requestOptions:** `Tools.RequestOptions` +**requestOptions:** `Prompts.RequestOptions`
@@ -2699,7 +2564,7 @@ Version numbers are integer values representing different iterations of the Tool
-
client.empathicVoice.tools.updateToolDescription(id, version, { ...params }) -> Hume.ReturnUserDefinedTool | undefined +
client.empathicVoice.prompts.updatePromptDescription(id, version, { ...params }) -> Hume.ReturnPrompt | undefined
@@ -2711,9 +2576,9 @@ Version numbers are integer values representing different iterations of the Tool
-Updates the description of a specified **Tool** version. +Updates the description of a **Prompt**. -Refer to our [tool use](/docs/speech-to-speech-evi/features/tool-use#function-calling) guide for comprehensive instructions on defining and integrating tools into EVI. +See our [prompting guide](/docs/speech-to-speech-evi/guides/phone-calling) for tips on crafting your system prompt.
@@ -2728,8 +2593,8 @@ Refer to our [tool use](/docs/speech-to-speech-evi/features/tool-use#function-ca
```typescript -await client.empathicVoice.tools.updateToolDescription("00183a3f-79ba-413d-9f3b-609864268bea", 1, { - versionDescription: "Fetches current temperature, precipitation, wind speed, AQI, and other weather conditions. Uses Celsius, Fahrenheit, or kelvin depending on user's region." +await client.empathicVoice.prompts.updatePromptDescription("af699d45-2985-42cc-91b9-af9e5da3bac5", 1, { + versionDescription: "This is an updated version_description." }); ``` @@ -2746,7 +2611,7 @@ await client.empathicVoice.tools.updateToolDescription("00183a3f-79ba-413d-9f3b-
-**id:** `string` — Identifier for a Tool. Formatted as a UUID. +**id:** `string` — Identifier for a Prompt. Formatted as a UUID.
@@ -2756,11 +2621,11 @@ await client.empathicVoice.tools.updateToolDescription("00183a3f-79ba-413d-9f3b- **version:** `number` -Version number for a Tool. +Version number for a Prompt. -Tools, Configs, Custom Voices, and Prompts are versioned. This versioning system supports iterative development, allowing you to progressively refine tools and revert to previous versions if needed. +Prompts, Configs, Custom Voices, and Tools are versioned. This versioning system supports iterative development, allowing you to progressively refine prompts and revert to previous versions if needed. -Version numbers are integer values representing different iterations of the Tool. Each update to the Tool increments its version number. +Version numbers are integer values representing different iterations of the Prompt. Each update to the Prompt increments its version number.
@@ -2768,7 +2633,7 @@ Version numbers are integer values representing different iterations of the Tool
-**request:** `Hume.empathicVoice.PostedUserDefinedToolVersionDescription` +**request:** `Hume.empathicVoice.PostedPromptVersionDescription`
@@ -2776,7 +2641,7 @@ Version numbers are integer values representing different iterations of the Tool
-**requestOptions:** `Tools.RequestOptions` +**requestOptions:** `Prompts.RequestOptions`
@@ -2788,8 +2653,8 @@ Version numbers are integer values representing different iterations of the Tool
-## Tts -
client.tts.synthesizeJson({ ...params }) -> Hume.ReturnTts +## EmpathicVoice Tools +
client.empathicVoice.tools.listTools({ ...params }) -> core.Page<(Hume.ReturnUserDefinedTool | undefined), Hume.ReturnPagedUserDefinedTools>
@@ -2801,9 +2666,9 @@ Version numbers are integer values representing different iterations of the Tool
-Synthesizes one or more input texts into speech using the specified voice. If no voice is provided, a novel voice will be generated dynamically. Optionally, additional context can be included to influence the speech's style and prosody. +Fetches a paginated list of **Tools**. -The response includes the base64-encoded audio and metadata in JSON format. +Refer to our [tool use](/docs/speech-to-speech-evi/features/tool-use#function-calling) guide for comprehensive instructions on defining and integrating tools into EVI.
@@ -2818,21 +2683,95 @@ The response includes the base64-encoded audio and metadata in JSON format.
```typescript -await client.tts.synthesizeJson({ - context: { - utterances: [{ - text: "How can people see beauty so differently?", - description: "A curious student with a clear and respectful tone, seeking clarification on Hume's ideas with a straightforward question." - }] - }, - format: { - type: "mp3" - }, - numGenerations: 1, - utterances: [{ - text: "Beauty is no quality in things themselves: It exists merely in the mind which contemplates them.", - description: "Middle-aged masculine voice with a clear, rhythmic Scots lilt, rounded vowels, and a warm, steady tone with an articulate, academic quality." - }] +const pageableResponse = await client.empathicVoice.tools.listTools({ + pageNumber: 0, + pageSize: 2 +}); +for await (const item of pageableResponse) { + console.log(item); +} + +// Or you can manually iterate page-by-page +let page = await client.empathicVoice.tools.listTools({ + pageNumber: 0, + pageSize: 2 +}); +while (page.hasNextPage()) { + page = page.getNextPage(); +} + +// You can also access the underlying response +const response = page.response; + +``` +
+
+ + + +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Hume.empathicVoice.ToolsListToolsRequest` + +
+
+ +
+
+ +**requestOptions:** `Tools.RequestOptions` + +
+
+
+
+ + + + +
+ +
client.empathicVoice.tools.createTool({ ...params }) -> Hume.ReturnUserDefinedTool | undefined +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates a **Tool** that can be added to an [EVI configuration](/reference/speech-to-speech-evi/configs/create-config). + +Refer to our [tool use](/docs/speech-to-speech-evi/features/tool-use#function-calling) guide for comprehensive instructions on defining and integrating tools into EVI. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.empathicVoice.tools.createTool({ + name: "get_current_weather", + parameters: "{ \"type\": \"object\", \"properties\": { \"location\": { \"type\": \"string\", \"description\": \"The city and state, e.g. San Francisco, CA\" }, \"format\": { \"type\": \"string\", \"enum\": [\"celsius\", \"fahrenheit\"], \"description\": \"The temperature unit to use. Infer this from the users location.\" } }, \"required\": [\"location\", \"format\"] }", + versionDescription: "Fetches current weather and uses celsius or fahrenheit based on location of user.", + description: "This tool is for getting the current weather.", + fallbackContent: "Unable to fetch current weather." }); ``` @@ -2849,7 +2788,7 @@ await client.tts.synthesizeJson({
-**request:** `Hume.PostedTts` +**request:** `Hume.empathicVoice.PostedUserDefinedTool`
@@ -2857,7 +2796,7 @@ await client.tts.synthesizeJson({
-**requestOptions:** `Tts.RequestOptions` +**requestOptions:** `Tools.RequestOptions`
@@ -2869,7 +2808,7 @@ await client.tts.synthesizeJson({
-
client.tts.synthesizeFile({ ...params }) -> core.BinaryResponse +
client.empathicVoice.tools.listToolVersions(id, { ...params }) -> core.Page<(Hume.ReturnUserDefinedTool | undefined), Hume.ReturnPagedUserDefinedTools>
@@ -2881,9 +2820,9 @@ await client.tts.synthesizeJson({
-Synthesizes one or more input texts into speech using the specified voice. If no voice is provided, a novel voice will be generated dynamically. Optionally, additional context can be included to influence the speech's style and prosody. +Fetches a list of a **Tool's** versions. -The response contains the generated audio file in the requested format. +Refer to our [tool use](/docs/speech-to-speech-evi/features/tool-use#function-calling) guide for comprehensive instructions on defining and integrating tools into EVI.
@@ -2898,19 +2837,19 @@ The response contains the generated audio file in the requested format.
```typescript -await client.tts.synthesizeFile({ - context: { - generationId: "09ad914d-8e7f-40f8-a279-e34f07f7dab2" - }, - format: { - type: "mp3" - }, - numGenerations: 1, - utterances: [{ - text: "Beauty is no quality in things themselves: It exists merely in the mind which contemplates them.", - description: "Middle-aged masculine voice with a clear, rhythmic Scots lilt, rounded vowels, and a warm, steady tone with an articulate, academic quality." - }] -}); +const pageableResponse = await client.empathicVoice.tools.listToolVersions("00183a3f-79ba-413d-9f3b-609864268bea"); +for await (const item of pageableResponse) { + console.log(item); +} + +// Or you can manually iterate page-by-page +let page = await client.empathicVoice.tools.listToolVersions("00183a3f-79ba-413d-9f3b-609864268bea"); +while (page.hasNextPage()) { + page = page.getNextPage(); +} + +// You can also access the underlying response +const response = page.response; ```
@@ -2926,7 +2865,7 @@ await client.tts.synthesizeFile({
-**request:** `Hume.PostedTts` +**id:** `string` — Identifier for a Tool. Formatted as a UUID.
@@ -2934,7 +2873,15 @@ await client.tts.synthesizeFile({
-**requestOptions:** `Tts.RequestOptions` +**request:** `Hume.empathicVoice.ToolsListToolVersionsRequest` + +
+
+ +
+
+ +**requestOptions:** `Tools.RequestOptions`
@@ -2946,7 +2893,7 @@ await client.tts.synthesizeFile({
-
client.tts.synthesizeFileStreaming({ ...params }) -> core.BinaryResponse +
client.empathicVoice.tools.createToolVersion(id, { ...params }) -> Hume.ReturnUserDefinedTool | undefined
@@ -2958,7 +2905,9 @@ await client.tts.synthesizeFile({
-Streams synthesized speech using the specified voice. If no voice is provided, a novel voice will be generated dynamically. Optionally, additional context can be included to influence the speech's style and prosody. +Updates a **Tool** by creating a new version of the **Tool**. + +Refer to our [tool use](/docs/speech-to-speech-evi/features/tool-use#function-calling) guide for comprehensive instructions on defining and integrating tools into EVI.
@@ -2973,14 +2922,11 @@ Streams synthesized speech using the specified voice. If no voice is provided, a
```typescript -await client.tts.synthesizeFileStreaming({ - utterances: [{ - text: "Beauty is no quality in things themselves: It exists merely in the mind which contemplates them.", - voice: { - name: "Male English Actor", - provider: "HUME_AI" - } - }] +await client.empathicVoice.tools.createToolVersion("00183a3f-79ba-413d-9f3b-609864268bea", { + parameters: "{ \"type\": \"object\", \"properties\": { \"location\": { \"type\": \"string\", \"description\": \"The city and state, e.g. San Francisco, CA\" }, \"format\": { \"type\": \"string\", \"enum\": [\"celsius\", \"fahrenheit\", \"kelvin\"], \"description\": \"The temperature unit to use. Infer this from the users location.\" } }, \"required\": [\"location\", \"format\"] }", + versionDescription: "Fetches current weather and uses celsius, fahrenheit, or kelvin based on location of user.", + fallbackContent: "Unable to fetch current weather.", + description: "This tool is for getting the current weather." }); ``` @@ -2997,7 +2943,7 @@ await client.tts.synthesizeFileStreaming({
-**request:** `Hume.PostedTts` +**id:** `string` — Identifier for a Tool. Formatted as a UUID.
@@ -3005,7 +2951,15 @@ await client.tts.synthesizeFileStreaming({
-**requestOptions:** `Tts.RequestOptions` +**request:** `Hume.empathicVoice.PostedUserDefinedToolVersion` + +
+
+ +
+
+ +**requestOptions:** `Tools.RequestOptions`
@@ -3017,7 +2971,7 @@ await client.tts.synthesizeFileStreaming({
-
client.tts.synthesizeJsonStreaming({ ...params }) -> core.Stream +
client.empathicVoice.tools.deleteTool(id) -> void
@@ -3029,9 +2983,9 @@ await client.tts.synthesizeFileStreaming({
-Streams synthesized speech using the specified voice. If no voice is provided, a novel voice will be generated dynamically. Optionally, additional context can be included to influence the speech's style and prosody. +Deletes a **Tool** and its versions. -The response is a stream of JSON objects including audio encoded in base64. +Refer to our [tool use](/docs/speech-to-speech-evi/features/tool-use#function-calling) guide for comprehensive instructions on defining and integrating tools into EVI.
@@ -3046,18 +3000,7 @@ The response is a stream of JSON objects including audio encoded in base64.
```typescript -const response = await client.tts.synthesizeJsonStreaming({ - utterances: [{ - text: "Beauty is no quality in things themselves: It exists merely in the mind which contemplates them.", - voice: { - name: "Male English Actor", - provider: "HUME_AI" - } - }] -}); -for await (const item of response) { - console.log(item); -} +await client.empathicVoice.tools.deleteTool("00183a3f-79ba-413d-9f3b-609864268bea"); ```
@@ -3073,7 +3016,7 @@ for await (const item of response) {
-**request:** `Hume.PostedTts` +**id:** `string` — Identifier for a Tool. Formatted as a UUID.
@@ -3081,7 +3024,7 @@ for await (const item of response) {
-**requestOptions:** `Tts.RequestOptions` +**requestOptions:** `Tools.RequestOptions`
@@ -3093,10 +3036,26 @@ for await (const item of response) {
-
client.tts.convertVoiceJson({ ...params }) -> core.Stream +
client.empathicVoice.tools.updateToolName(id, { ...params }) -> string +
+
+ +#### 📝 Description + +
+
+
+Updates the name of a **Tool**. + +Refer to our [tool use](/docs/speech-to-speech-evi/features/tool-use#function-calling) guide for comprehensive instructions on defining and integrating tools into EVI. +
+
+
+
+ #### 🔌 Usage
@@ -3106,10 +3065,9 @@ for await (const item of response) {
```typescript -const response = await client.tts.convertVoiceJson({}); -for await (const item of response) { - console.log(item); -} +await client.empathicVoice.tools.updateToolName("00183a3f-79ba-413d-9f3b-609864268bea", { + name: "get_current_temperature" +}); ```
@@ -3125,7 +3083,7 @@ for await (const item of response) {
-**request:** `Hume.tts.ConvertVoiceJsonRequest` +**id:** `string` — Identifier for a Tool. Formatted as a UUID.
@@ -3133,7 +3091,15 @@ for await (const item of response) {
-**requestOptions:** `Tts.RequestOptions` +**request:** `Hume.empathicVoice.PostedUserDefinedToolName` + +
+
+ +
+
+ +**requestOptions:** `Tools.RequestOptions`
@@ -3145,8 +3111,7 @@ for await (const item of response) {
-## Tts Voices -
client.tts.voices.list({ ...params }) -> core.Page +
client.empathicVoice.tools.getToolVersion(id, version) -> Hume.ReturnUserDefinedTool | undefined
@@ -3158,7 +3123,9 @@ for await (const item of response) {
-Lists voices you have saved in your account, or voices from the [Voice Library](https://platform.hume.ai/tts/voice-library). +Fetches a specified version of a **Tool**. + +Refer to our [tool use](/docs/speech-to-speech-evi/features/tool-use#function-calling) guide for comprehensive instructions on defining and integrating tools into EVI.
@@ -3173,23 +3140,7 @@ Lists voices you have saved in your account, or voices from the [Voice Library](
```typescript -const pageableResponse = await client.tts.voices.list({ - provider: "CUSTOM_VOICE" -}); -for await (const item of pageableResponse) { - console.log(item); -} - -// Or you can manually iterate page-by-page -let page = await client.tts.voices.list({ - provider: "CUSTOM_VOICE" -}); -while (page.hasNextPage()) { - page = page.getNextPage(); -} - -// You can also access the underlying response -const response = page.response; +await client.empathicVoice.tools.getToolVersion("00183a3f-79ba-413d-9f3b-609864268bea", 1); ```
@@ -3205,7 +3156,7 @@ const response = page.response;
-**request:** `Hume.tts.VoicesListRequest` +**id:** `string` — Identifier for a Tool. Formatted as a UUID.
@@ -3213,7 +3164,21 @@ const response = page.response;
-**requestOptions:** `Voices.RequestOptions` +**version:** `number` + +Version number for a Tool. + +Tools, Configs, Custom Voices, and Prompts are versioned. This versioning system supports iterative development, allowing you to progressively refine tools and revert to previous versions if needed. + +Version numbers are integer values representing different iterations of the Tool. Each update to the Tool increments its version number. + +
+
+ +
+
+ +**requestOptions:** `Tools.RequestOptions`
@@ -3225,7 +3190,7 @@ const response = page.response;
-
client.tts.voices.create({ ...params }) -> Hume.ReturnVoice +
client.empathicVoice.tools.deleteToolVersion(id, version) -> void
@@ -3237,9 +3202,9 @@ const response = page.response;
-Saves a new custom voice to your account using the specified TTS generation ID. +Deletes a specified version of a **Tool**. -Once saved, this voice can be reused in subsequent TTS requests, ensuring consistent speech style and prosody. For more details on voice creation, see the [Voices Guide](/docs/text-to-speech-tts/voices). +Refer to our [tool use](/docs/speech-to-speech-evi/features/tool-use#function-calling) guide for comprehensive instructions on defining and integrating tools into EVI.
@@ -3254,10 +3219,7 @@ Once saved, this voice can be reused in subsequent TTS requests, ensuring consis
```typescript -await client.tts.voices.create({ - generationId: "795c949a-1510-4a80-9646-7d0863b023ab", - name: "David Hume" -}); +await client.empathicVoice.tools.deleteToolVersion("00183a3f-79ba-413d-9f3b-609864268bea", 1); ```
@@ -3273,7 +3235,7 @@ await client.tts.voices.create({
-**request:** `Hume.tts.PostedVoice` +**id:** `string` — Identifier for a Tool. Formatted as a UUID.
@@ -3281,7 +3243,21 @@ await client.tts.voices.create({
-**requestOptions:** `Voices.RequestOptions` +**version:** `number` + +Version number for a Tool. + +Tools, Configs, Custom Voices, and Prompts are versioned. This versioning system supports iterative development, allowing you to progressively refine tools and revert to previous versions if needed. + +Version numbers are integer values representing different iterations of the Tool. Each update to the Tool increments its version number. + +
+
+ +
+
+ +**requestOptions:** `Tools.RequestOptions`
@@ -3293,7 +3269,7 @@ await client.tts.voices.create({
-
client.tts.voices.delete({ ...params }) -> void +
client.empathicVoice.tools.updateToolDescription(id, version, { ...params }) -> Hume.ReturnUserDefinedTool | undefined
@@ -3305,7 +3281,9 @@ await client.tts.voices.create({
-Deletes a previously generated custom voice. +Updates the description of a specified **Tool** version. + +Refer to our [tool use](/docs/speech-to-speech-evi/features/tool-use#function-calling) guide for comprehensive instructions on defining and integrating tools into EVI.
@@ -3320,8 +3298,8 @@ Deletes a previously generated custom voice.
```typescript -await client.tts.voices.delete({ - name: "David Hume" +await client.empathicVoice.tools.updateToolDescription("00183a3f-79ba-413d-9f3b-609864268bea", 1, { + versionDescription: "Fetches current temperature, precipitation, wind speed, AQI, and other weather conditions. Uses Celsius, Fahrenheit, or kelvin depending on user's region." }); ``` @@ -3338,7 +3316,7 @@ await client.tts.voices.delete({
-**request:** `Hume.tts.VoicesDeleteRequest` +**id:** `string` — Identifier for a Tool. Formatted as a UUID.
@@ -3346,7 +3324,29 @@ await client.tts.voices.delete({
-**requestOptions:** `Voices.RequestOptions` +**version:** `number` + +Version number for a Tool. + +Tools, Configs, Custom Voices, and Prompts are versioned. This versioning system supports iterative development, allowing you to progressively refine tools and revert to previous versions if needed. + +Version numbers are integer values representing different iterations of the Tool. Each update to the Tool increments its version number. + +
+
+ +
+
+ +**request:** `Hume.empathicVoice.PostedUserDefinedToolVersionDescription` + +
+
+ +
+
+ +**requestOptions:** `Tools.RequestOptions`
diff --git a/src/Client.ts b/src/Client.ts index 4aa3714a..a9d265ce 100644 --- a/src/Client.ts +++ b/src/Client.ts @@ -15,8 +15,8 @@ export declare namespace HumeClient { export class HumeClient { protected readonly _options: HumeClient.Options; - protected _empathicVoice: EmpathicVoice | undefined; protected _tts: Tts | undefined; + protected _empathicVoice: EmpathicVoice | undefined; protected _expressionMeasurement: ExpressionMeasurement | undefined; constructor(_options: HumeClient.Options = {}) { @@ -27,8 +27,8 @@ export class HumeClient { { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "hume", - "X-Fern-SDK-Version": "0.15.9", - "User-Agent": "hume/0.15.9", + "X-Fern-SDK-Version": "0.15.10", + "User-Agent": "hume/0.15.10", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, }, @@ -37,14 +37,14 @@ export class HumeClient { }; } - public get empathicVoice(): EmpathicVoice { - return (this._empathicVoice ??= new EmpathicVoice(this._options)); - } - public get tts(): Tts { return (this._tts ??= new Tts(this._options)); } + public get empathicVoice(): EmpathicVoice { + return (this._empathicVoice ??= new EmpathicVoice(this._options)); + } + public get expressionMeasurement(): ExpressionMeasurement { return (this._expressionMeasurement ??= new ExpressionMeasurement(this._options)); } diff --git a/src/api/resources/empathicVoice/resources/chat/client/Client.ts.diff b/src/api/resources/empathicVoice/resources/chat/client/Client.ts.diff deleted file mode 100644 index 8c42162a..00000000 --- a/src/api/resources/empathicVoice/resources/chat/client/Client.ts.diff +++ /dev/null @@ -1,182 +0,0 @@ -diff --git a/src/api/resources/empathicVoice/resources/chat/client/Client.ts b/src/api/resources/empathicVoice/resources/chat/client/Client.ts -index 210954d..37d17b0 100644 ---- a/src/api/resources/empathicVoice/resources/chat/client/Client.ts -+++ b/src/api/resources/empathicVoice/resources/chat/client/Client.ts -@@ -1,36 +1,26 @@ --/** THIS FILE IS MANUALLY MAINTAINED: see .fernignore */ -+// This file was auto-generated by Fern from our API Definition. - --import * as environments from "../../../../../../environments.js"; -+import type { BaseClientOptions } from "../../../../../../BaseClient.js"; -+import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; - import * as core from "../../../../../../core/index.js"; --import * as Hume from "../../../../../index.js"; --import { mergeOnlyDefinedHeaders, mergeHeaders } from "../../../../../../core/headers.js"; -+import * as environments from "../../../../../../environments.js"; - import * as serializers from "../../../../../../serialization/index.js"; -+import type * as Hume from "../../../../../index.js"; - import { ChatSocket } from "./Socket.js"; - - export declare namespace Chat { -- export interface Options { -- environment?: core.Supplier; -- /** Specify a custom URL to connect the client to. */ -- baseUrl?: core.Supplier; -- apiKey?: core.Supplier; -- /** Additional headers to include in requests. */ -- headers?: Record | null | undefined>; -- } -+ export interface Options extends BaseClientOptions {} - - export interface ConnectArgs { - accessToken?: string | undefined; -+ allowConnection?: boolean | undefined; - configId?: string | undefined; -- configVersion?: string | number | undefined; -+ configVersion?: number | undefined; - eventLimit?: number | undefined; - resumedChatGroupId?: string | undefined; - verboseTranscription?: boolean | undefined; -- allowConnection?: boolean | undefined; -- /** @deprecated Use sessionSettings.voiceId instead */ -- voiceId?: string | undefined; - apiKey?: string | undefined; -- sessionSettings?: Hume.empathicVoice.ConnectSessionSettings; -- /** Extra query parameters sent at WebSocket connection */ -- queryParams?: Record; -+ sessionSettings: Hume.empathicVoice.ConnectSessionSettings; - /** Arbitrary headers to send with the websocket connect request. */ - headers?: Record; - /** Enable debug mode on the websocket. Defaults to false. */ -@@ -47,91 +37,69 @@ export class Chat { - this._options = _options; - } - -- public connect(args: Chat.ConnectArgs = {}): ChatSocket { -+ public async connect(args: Chat.ConnectArgs): Promise { - const { - accessToken, -+ allowConnection, - configId, - configVersion, - eventLimit, - resumedChatGroupId, - verboseTranscription, -- voiceId, - apiKey, - sessionSettings, -- queryParams, - headers, - debug, - reconnectAttempts, -- allowConnection, - } = args; - const _queryParams: Record = {}; -- - if (accessToken != null) { -- _queryParams["access_token"] = accessToken; -+ _queryParams.access_token = accessToken; -+ } -+ -+ if (allowConnection != null) { -+ _queryParams.allow_connection = allowConnection.toString(); - } - - if (configId != null) { -- _queryParams["config_id"] = configId; -+ _queryParams.config_id = configId; - } - - if (configVersion != null) { -- _queryParams["config_version"] = -- typeof configVersion === "number" ? configVersion.toString() : configVersion; -+ _queryParams.config_version = configVersion.toString(); - } - - if (eventLimit != null) { -- _queryParams["event_limit"] = eventLimit.toString(); -+ _queryParams.event_limit = eventLimit.toString(); - } - - if (resumedChatGroupId != null) { -- _queryParams["resumed_chat_group_id"] = resumedChatGroupId; -+ _queryParams.resumed_chat_group_id = resumedChatGroupId; - } - - if (verboseTranscription != null) { -- _queryParams["verbose_transcription"] = verboseTranscription.toString(); -- } -- -- if (voiceId != null) { -- _queryParams["voice_id"] = voiceId; -+ _queryParams.verbose_transcription = verboseTranscription.toString(); - } - - if (apiKey != null) { -- _queryParams["api_key"] = apiKey; -- } -- -- if (allowConnection != null) { -- _queryParams["allow_connection"] = allowConnection === true ? "true" : "false"; -+ _queryParams.api_key = apiKey; - } - -- if (sessionSettings != null) { -- _queryParams["session_settings"] = serializers.empathicVoice.ConnectSessionSettings.jsonOrThrow( -- sessionSettings, -- { -- unrecognizedObjectKeys: "passthrough", -- allowUnrecognizedUnionMembers: true, -- allowUnrecognizedEnumValues: true, -- omitUndefined: true, -- breadcrumbsPrefix: ["request", "sessionSettings"], -- }, -- ); -- } -- -- // Merge in any additional query parameters -- if (queryParams != null) { -- for (const [name, value] of Object.entries(queryParams)) { -- _queryParams[name] = value; -- } -- } -- -- let _headers: Record = mergeHeaders( -- mergeOnlyDefinedHeaders({ ...this._getCustomAuthorizationHeaders() }), -+ _queryParams.session_settings = serializers.empathicVoice.ConnectSessionSettings.jsonOrThrow(sessionSettings, { -+ unrecognizedObjectKeys: "passthrough", -+ allowUnrecognizedUnionMembers: true, -+ allowUnrecognizedEnumValues: true, -+ omitUndefined: true, -+ breadcrumbsPrefix: ["request", "sessionSettings"], -+ }); -+ const _headers: Record = mergeHeaders( -+ mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), - headers, - ); -- - const socket = new core.ReconnectingWebSocket({ - url: core.url.join( -- core.Supplier.get(this._options["baseUrl"]) ?? -- (core.Supplier.get(this._options["environment"]) ?? environments.HumeEnvironment.Prod).evi, -+ (await core.Supplier.get(this._options.baseUrl)) ?? -+ ((await core.Supplier.get(this._options.environment)) ?? environments.HumeEnvironment.Prod).evi, - "/chat", - ), - protocols: [], -@@ -142,12 +110,8 @@ export class Chat { - return new ChatSocket({ socket }); - } - -- protected _getCustomAuthorizationHeaders(): Record { -- const apiKeyValue = core.Supplier.get(this._options.apiKey); -- // This `authHeaderValue` is manually added as if you don't provide it it will -- // be omitted from the headers which means it won't reach the logic in ws.ts that -- // extracts values from the headers and adds them to query parameters. -- const authHeaderValue = core.Supplier.get(this._options.headers?.authorization); -- return { "X-Hume-Api-Key": apiKeyValue, Authorization: authHeaderValue }; -+ protected async _getCustomAuthorizationHeaders(): Promise> { -+ const apiKeyValue = await core.Supplier.get(this._options.apiKey); -+ return { "X-Hume-Api-Key": apiKeyValue }; - } - } diff --git a/src/api/resources/empathicVoice/resources/chat/client/Socket.ts.diff b/src/api/resources/empathicVoice/resources/chat/client/Socket.ts.diff deleted file mode 100644 index 7c0bd3a4..00000000 --- a/src/api/resources/empathicVoice/resources/chat/client/Socket.ts.diff +++ /dev/null @@ -1,139 +0,0 @@ -diff --git a/src/api/resources/empathicVoice/resources/chat/client/Socket.ts b/src/api/resources/empathicVoice/resources/chat/client/Socket.ts -index a55c7b5..0f2f2a5 100644 ---- a/src/api/resources/empathicVoice/resources/chat/client/Socket.ts -+++ b/src/api/resources/empathicVoice/resources/chat/client/Socket.ts -@@ -1,17 +1,17 @@ --/** THIS FILE IS MANUALLY MAINTAINED: see .fernignore */ -+// This file was auto-generated by Fern from our API Definition. - - import * as core from "../../../../../../core/index.js"; --import * as Hume from "../../../../../index.js"; --import { PublishEvent } from "../../../../../../serialization/resources/empathicVoice/resources/chat/types/PublishEvent.js"; - import { fromJson } from "../../../../../../core/json.js"; - import * as serializers from "../../../../../../serialization/index.js"; -+import { PublishEvent } from "../../../../../../serialization/resources/empathicVoice/resources/chat/types/PublishEvent.js"; -+import type * as Hume from "../../../../../index.js"; - - export declare namespace ChatSocket { - export interface Args { - socket: core.ReconnectingWebSocket; - } - -- export type Response = Hume.empathicVoice.SubscribeEvent & { receivedAt: Date }; -+ export type Response = Hume.empathicVoice.SubscribeEvent; - type EventHandlers = { - open?: () => void; - message?: (message: Response) => void; -@@ -37,10 +37,7 @@ export class ChatSocket { - omitUndefined: true, - }); - if (parsedResponse.ok) { -- this.eventHandlers.message?.({ -- ...parsedResponse.value, -- receivedAt: new Date(), -- }); -+ this.eventHandlers.message?.(parsedResponse.value); - } else { - this.eventHandlers.error?.(new Error("Received unknown message type")); - } -@@ -92,86 +89,6 @@ export class ChatSocket { - this.socket.send(JSON.stringify(jsonPayload)); - } - -- /** -- * Send audio input -- */ -- public sendAudioInput(message: Omit): void { -- this.sendPublish({ -- type: "audio_input", -- ...message, -- }); -- } -- -- /** -- * Send session settings -- */ -- public sendSessionSettings(message: Omit = {}): void { -- this.sendPublish({ -- type: "session_settings", -- ...message, -- }); -- } -- -- /** -- * Send assistant input -- */ -- public sendAssistantInput(message: Omit): void { -- this.sendPublish({ -- type: "assistant_input", -- ...message, -- }); -- } -- -- /** -- * Send pause assistant message -- */ -- public pauseAssistant(message: Omit = {}): void { -- this.sendPublish({ -- type: "pause_assistant_message", -- ...message, -- }); -- } -- -- /** -- * Send resume assistant message -- */ -- public resumeAssistant(message: Omit = {}): void { -- this.sendPublish({ -- type: "resume_assistant_message", -- ...message, -- }); -- } -- -- /** -- * Send tool response message -- */ -- public sendToolResponseMessage(message: Omit): void { -- this.sendPublish({ -- type: "tool_response", -- ...message, -- }); -- } -- -- /** -- * Send tool error message -- */ -- public sendToolErrorMessage(message: Omit): void { -- this.sendPublish({ -- type: "tool_error", -- ...message, -- }); -- } -- -- /** -- * Send text input -- */ -- public sendUserInput(text: string): void { -- this.sendPublish({ -- type: "user_input", -- text, -- }); -- } -- - /** Connect to the websocket and register event handlers. */ - public connect(): ChatSocket { - this.socket.reconnect(); -@@ -213,13 +130,6 @@ export class ChatSocket { - }); - } - -- /** -- * @deprecated Use waitForOpen() instead -- */ -- public async tillSocketOpen(): Promise { -- return this.waitForOpen(); -- } -- - /** Asserts that the websocket is open. */ - private assertSocketIsOpen(): void { - if (!this.socket) { diff --git a/src/api/resources/empathicVoice/resources/chat/client/index.ts.diff b/src/api/resources/empathicVoice/resources/chat/client/index.ts.diff deleted file mode 100644 index 4976271e..00000000 --- a/src/api/resources/empathicVoice/resources/chat/client/index.ts.diff +++ /dev/null @@ -1,9 +0,0 @@ -diff --git a/src/api/resources/empathicVoice/resources/chat/client/index.ts b/src/api/resources/empathicVoice/resources/chat/client/index.ts -index 38d5d5f..cb0ff5c 100644 ---- a/src/api/resources/empathicVoice/resources/chat/client/index.ts -+++ b/src/api/resources/empathicVoice/resources/chat/client/index.ts -@@ -1,3 +1 @@ --/** THIS FILE IS MANUALLY MAINTAINED: see .fernignore */ --export { ChatSocket } from "./Socket.js"; --export { Chat } from "./Client.js"; -+export {}; diff --git a/src/api/resources/empathicVoice/resources/chat/index.ts.diff b/src/api/resources/empathicVoice/resources/chat/index.ts.diff deleted file mode 100644 index e1f02d67..00000000 --- a/src/api/resources/empathicVoice/resources/chat/index.ts.diff +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/src/api/resources/empathicVoice/resources/chat/index.ts b/src/api/resources/empathicVoice/resources/chat/index.ts -index a2f33dc..d9adb1a 100644 ---- a/src/api/resources/empathicVoice/resources/chat/index.ts -+++ b/src/api/resources/empathicVoice/resources/chat/index.ts -@@ -1,7 +1,2 @@ --export * from "./types/index.js"; - export * from "./client/index.js"; --/** -- * @deprecated Use `Hume.empathicVoice.SubscribeEvent` instead. -- * This type alias will be removed in a future version. -- */ --export type { SubscribeEvent } from "./types/SubscribeEvent.js"; -+export * from "./types/index.js"; diff --git a/src/api/resources/empathicVoice/resources/controlPlane/client/Client.ts.diff b/src/api/resources/empathicVoice/resources/controlPlane/client/Client.ts.diff deleted file mode 100644 index 61a11b81..00000000 --- a/src/api/resources/empathicVoice/resources/controlPlane/client/Client.ts.diff +++ /dev/null @@ -1,30 +0,0 @@ -diff --git a/src/api/resources/empathicVoice/resources/controlPlane/client/Client.ts b/src/api/resources/empathicVoice/resources/controlPlane/client/Client.ts -index e092f57..14ce2a9 100644 ---- a/src/api/resources/empathicVoice/resources/controlPlane/client/Client.ts -+++ b/src/api/resources/empathicVoice/resources/controlPlane/client/Client.ts -@@ -144,7 +144,7 @@ export class ControlPlane { - url: core.url.join( - (await core.Supplier.get(this._options.baseUrl)) ?? - ((await core.Supplier.get(this._options.environment)) ?? environments.HumeEnvironment.Prod).evi, -- `/chat/${core.url.encodePathParam(chat_id)}/connect`, -+ `/chat/${core.url.encodePathParam(chatId)}/connect`, - ), - protocols: [], - queryParameters: _queryParams, -@@ -153,12 +153,9 @@ export class ControlPlane { - }); - return new ControlPlaneSocket({ socket }); - } -- protected async _getCustomAuthorizationHeaders(): Promise> { -- const apiKeyValue = core.Supplier.get(this._options.apiKey); -- // This `authHeaderValue` is manually added as if you don't provide it it will -- // be omitted from the headers which means it won't reach the logic in ws.ts that -- // extracts values from the headers and adds them to query parameters. -- const authHeaderValue = core.Supplier.get(this._options.headers?.authorization); -- return { "X-Hume-Api-Key": apiKeyValue, Authorization: authHeaderValue }; -+ -+ protected async _getCustomAuthorizationHeaders(): Promise> { -+ const apiKeyValue = await core.Supplier.get(this._options.apiKey); -+ return { "X-Hume-Api-Key": apiKeyValue }; - } - } diff --git a/src/api/resources/tts/resources/streamInput/client/Client.ts.diff b/src/api/resources/tts/resources/streamInput/client/Client.ts.diff deleted file mode 100644 index c6ba326c..00000000 --- a/src/api/resources/tts/resources/streamInput/client/Client.ts.diff +++ /dev/null @@ -1,20 +0,0 @@ -diff --git a/src/api/resources/tts/resources/streamInput/client/Client.ts b/src/api/resources/tts/resources/streamInput/client/Client.ts -index 55e3be8..3870133 100644 ---- a/src/api/resources/tts/resources/streamInput/client/Client.ts -+++ b/src/api/resources/tts/resources/streamInput/client/Client.ts -@@ -125,12 +125,8 @@ export class StreamInput { - return new StreamInputSocket({ socket }); - } - -- protected async _getCustomAuthorizationHeaders(): Promise> { -- const apiKeyValue = core.Supplier.get(this._options.apiKey); -- // This `authHeaderValue` is manually added as if you don't provide it it will -- // be omitted from the headers which means it won't reach the logic in ws.ts that -- // extracts values from the headers and adds them to query parameters. -- const authHeaderValue = core.Supplier.get(this._options.headers?.authorization); -- return { "X-Hume-Api-Key": apiKeyValue, Authorization: authHeaderValue }; -+ protected async _getCustomAuthorizationHeaders(): Promise> { -+ const apiKeyValue = await core.Supplier.get(this._options.apiKey); -+ return { "X-Hume-Api-Key": apiKeyValue }; - } - } diff --git a/src/core/fetcher/Supplier.ts.diff b/src/core/fetcher/Supplier.ts.diff deleted file mode 100644 index 2700e2d3..00000000 --- a/src/core/fetcher/Supplier.ts.diff +++ /dev/null @@ -1,26 +0,0 @@ -diff --git a/src/core/fetcher/Supplier.ts b/src/core/fetcher/Supplier.ts -index aa95dd8..867c931 100644 ---- a/src/core/fetcher/Supplier.ts -+++ b/src/core/fetcher/Supplier.ts -@@ -1,19 +1,11 @@ --/** THIS FILE IS MANUALLY MAINAINED: see .fernignore */ --export type Supplier = T | (() => T); -+export type Supplier = T | Promise | (() => T | Promise); - - export const Supplier = { -- get: (supplier: Supplier): T => { -+ get: async (supplier: Supplier): Promise => { - if (typeof supplier === "function") { - return (supplier as () => T)(); - } else { - return supplier; - } - }, -- map: (supplier: Supplier, f: (value: T) => R): Supplier => { -- if (typeof supplier === "function") { -- return () => f(Supplier.get(supplier)); -- } else { -- return f(supplier); -- } -- }, - }; diff --git a/src/core/websocket/ws.ts.diff b/src/core/websocket/ws.ts.diff deleted file mode 100644 index a46a8098..00000000 --- a/src/core/websocket/ws.ts.diff +++ /dev/null @@ -1,137 +0,0 @@ -diff --git a/src/core/websocket/ws.ts b/src/core/websocket/ws.ts -index 9a16477..cba4f69 100644 ---- a/src/core/websocket/ws.ts -+++ b/src/core/websocket/ws.ts -@@ -3,7 +3,6 @@ import { WebSocket as NodeWebSocket } from "ws"; - import { RUNTIME } from "../runtime/index.js"; - import { toQueryString } from "../url/qs.js"; - import * as Events from "./events.js"; --import { SDK_VERSION } from "../../version.js"; - - const getGlobalWebSocket = (): WebSocket | undefined => { - if (typeof WebSocket !== "undefined") { -@@ -70,49 +69,6 @@ const DEFAULT_OPTIONS = { - debug: false, - }; - --function addApiKeyFromHeader({ -- headers, -- queryParameters, --}: { -- headers: Record | undefined; -- queryParameters: Record | undefined; --}) { -- const apiKeyValue = Object.entries(headers ?? {}).find(([k]) => k.toLowerCase() === "x-hume-api-key")?.[1]; -- if (apiKeyValue && !queryParameters?.["api_key"]) { -- return { ...queryParameters, api_key: apiKeyValue }; -- } -- return queryParameters; --} -- --function addAccessTokenFromHeader({ -- headers, -- queryParameters, --}: { -- headers: Record | undefined; -- queryParameters: Record | undefined; --}) { -- const authHeaderValue = headers?.["Authorization"] || headers?.["authorization"]; -- if (!authHeaderValue) { -- return queryParameters; -- } -- if (!authHeaderValue.startsWith("Bearer ")) { -- return queryParameters; -- } -- if (queryParameters?.["access_token"]) { -- return queryParameters; -- } -- const token = authHeaderValue.substring("Bearer ".length); -- return { ...queryParameters, access_token: token }; --} -- --function addSdkTracking(queryParameters: Record | undefined) { -- return { -- ...queryParameters, -- fernSdkLanguage: "JavaScript", -- fernSdkVersion: SDK_VERSION, -- }; --} -- - export class ReconnectingWebSocket { - private _ws?: WebSocket; - private _listeners: ReconnectingWebSocket.ListenersMap = { -@@ -141,47 +97,22 @@ export class ReconnectingWebSocket { - this._protocols = protocols; - this._options = options ?? DEFAULT_OPTIONS; - this._headers = headers; -- this._queryParameters = addSdkTracking( -- addAccessTokenFromHeader({ -- headers, -- queryParameters: addApiKeyFromHeader({ -- headers, -- queryParameters, -- }), -- }), -- ); -- -+ this._queryParameters = queryParameters; - if (this._options.startClosed) { - this._shouldReconnect = false; - } - this._connect(); - } - -- static get CONNECTING() { -- return 0; -- } -- static get OPEN() { -- return 1; -- } -- static get CLOSING() { -- return 2; -- } -- static get CLOSED() { -- return 3; -- } -+ public static readonly CONNECTING = 0; -+ public static readonly OPEN = 1; -+ public static readonly CLOSING = 2; -+ public static readonly CLOSED = 3; - -- get CONNECTING(): number { -- return ReconnectingWebSocket.CONNECTING; -- } -- get OPEN(): number { -- return ReconnectingWebSocket.OPEN; -- } -- get CLOSING(): number { -- return ReconnectingWebSocket.CLOSING; -- } -- get CLOSED(): number { -- return ReconnectingWebSocket.CLOSED; -- } -+ public readonly CONNECTING: typeof ReconnectingWebSocket.CONNECTING = ReconnectingWebSocket.CONNECTING; -+ public readonly OPEN: typeof ReconnectingWebSocket.OPEN = ReconnectingWebSocket.OPEN; -+ public readonly CLOSING: typeof ReconnectingWebSocket.CLOSING = ReconnectingWebSocket.CLOSING; -+ public readonly CLOSED: typeof ReconnectingWebSocket.CLOSED = ReconnectingWebSocket.CLOSED; - - get binaryType() { - return this._ws ? this._ws.binaryType : this._binaryType; -@@ -383,7 +314,7 @@ export class ReconnectingWebSocket { - } = this._options; - let delay = 0; - if (this._retryCount > 0) { -- delay = minReconnectionDelay * Math.pow(reconnectionDelayGrowFactor, this._retryCount - 1); -+ delay = minReconnectionDelay * reconnectionDelayGrowFactor ** (this._retryCount - 1); - if (delay > maxReconnectionDelay) { - delay = maxReconnectionDelay; - } -@@ -478,7 +409,7 @@ export class ReconnectingWebSocket { - try { - this._ws.close(code, reason); - this._handleClose(new Events.CloseEvent(code, reason, this)); -- } catch (error) { -+ } catch (_error) { - // ignore - } - } diff --git a/src/index.ts.diff b/src/index.ts.diff deleted file mode 100644 index 66b05aa1..00000000 --- a/src/index.ts.diff +++ /dev/null @@ -1,17 +0,0 @@ -diff --git a/src/index.ts b/src/index.ts -index 4d19902..c814670 100644 ---- a/src/index.ts -+++ b/src/index.ts -@@ -1,8 +1,7 @@ - export * as Hume from "./api/index.js"; --export * as serialization from "./serialization/index.js"; -+export type { BaseClientOptions, BaseRequestOptions } from "./BaseClient.js"; -+export { HumeClient } from "./Client.js"; -+export { HumeEnvironment, type HumeEnvironmentUrls } from "./environments.js"; - export { HumeError, HumeTimeoutError } from "./errors/index.js"; --export { HumeEnvironment } from "./environments.js"; --export type { HumeEnvironmentUrls } from "./environments.js"; - export * from "./exports.js"; -- --export * from "./wrapper/index.js"; -+export * as serialization from "./serialization/index.js"; diff --git a/src/serialization/resources/empathicVoice/resources/chat/index.ts.diff b/src/serialization/resources/empathicVoice/resources/chat/index.ts.diff deleted file mode 100644 index 4ddb2df8..00000000 --- a/src/serialization/resources/empathicVoice/resources/chat/index.ts.diff +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/src/serialization/resources/empathicVoice/resources/chat/index.ts b/src/serialization/resources/empathicVoice/resources/chat/index.ts -index f5ca113..d9adb1a 100644 ---- a/src/serialization/resources/empathicVoice/resources/chat/index.ts -+++ b/src/serialization/resources/empathicVoice/resources/chat/index.ts -@@ -1,7 +1,2 @@ - export * from "./client/index.js"; - export * from "./types/index.js"; --/** -- * @deprecated Use `serialization.empathicVoice.SubscribeEvent` instead. -- * This serializer alias will be removed in a future version. -- */ --export { SubscribeEvent } from "./types/SubscribeEvent.js"; diff --git a/src/version.ts b/src/version.ts index 8e95dbf0..480f0f51 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const SDK_VERSION = "0.15.9"; +export const SDK_VERSION = "0.15.10"; From 8cd686db0a8066a353217d0eb4a4656c2213ef2c Mon Sep 17 00:00:00 2001 From: twitchard Date: Mon, 8 Dec 2025 11:21:39 -0600 Subject: [PATCH 2/2] Add .diff files for fern-ignored files --- .../resources/chat/client/Client.ts.diff | 182 ++++++++++++++++++ .../resources/chat/client/Socket.ts.diff | 139 +++++++++++++ .../resources/chat/client/index.ts.diff | 9 + .../resources/chat/index.ts.diff | 13 ++ .../controlPlane/client/Client.ts.diff | 30 +++ .../streamInput/client/Client.ts.diff | 20 ++ src/core/fetcher/Supplier.ts.diff | 26 +++ src/core/websocket/ws.ts.diff | 137 +++++++++++++ src/index.ts.diff | 17 ++ .../resources/chat/index.ts.diff | 12 ++ 10 files changed, 585 insertions(+) create mode 100644 src/api/resources/empathicVoice/resources/chat/client/Client.ts.diff create mode 100644 src/api/resources/empathicVoice/resources/chat/client/Socket.ts.diff create mode 100644 src/api/resources/empathicVoice/resources/chat/client/index.ts.diff create mode 100644 src/api/resources/empathicVoice/resources/chat/index.ts.diff create mode 100644 src/api/resources/empathicVoice/resources/controlPlane/client/Client.ts.diff create mode 100644 src/api/resources/tts/resources/streamInput/client/Client.ts.diff create mode 100644 src/core/fetcher/Supplier.ts.diff create mode 100644 src/core/websocket/ws.ts.diff create mode 100644 src/index.ts.diff create mode 100644 src/serialization/resources/empathicVoice/resources/chat/index.ts.diff diff --git a/src/api/resources/empathicVoice/resources/chat/client/Client.ts.diff b/src/api/resources/empathicVoice/resources/chat/client/Client.ts.diff new file mode 100644 index 00000000..6b5cd5a0 --- /dev/null +++ b/src/api/resources/empathicVoice/resources/chat/client/Client.ts.diff @@ -0,0 +1,182 @@ +diff --git a/src/api/resources/empathicVoice/resources/chat/client/Client.ts b/src/api/resources/empathicVoice/resources/chat/client/Client.ts +index 210954d9..37d17b01 100644 +--- a/src/api/resources/empathicVoice/resources/chat/client/Client.ts ++++ b/src/api/resources/empathicVoice/resources/chat/client/Client.ts +@@ -1,36 +1,26 @@ +-/** THIS FILE IS MANUALLY MAINTAINED: see .fernignore */ ++// This file was auto-generated by Fern from our API Definition. + +-import * as environments from "../../../../../../environments.js"; ++import type { BaseClientOptions } from "../../../../../../BaseClient.js"; ++import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; + import * as core from "../../../../../../core/index.js"; +-import * as Hume from "../../../../../index.js"; +-import { mergeOnlyDefinedHeaders, mergeHeaders } from "../../../../../../core/headers.js"; ++import * as environments from "../../../../../../environments.js"; + import * as serializers from "../../../../../../serialization/index.js"; ++import type * as Hume from "../../../../../index.js"; + import { ChatSocket } from "./Socket.js"; + + export declare namespace Chat { +- export interface Options { +- environment?: core.Supplier; +- /** Specify a custom URL to connect the client to. */ +- baseUrl?: core.Supplier; +- apiKey?: core.Supplier; +- /** Additional headers to include in requests. */ +- headers?: Record | null | undefined>; +- } ++ export interface Options extends BaseClientOptions {} + + export interface ConnectArgs { + accessToken?: string | undefined; ++ allowConnection?: boolean | undefined; + configId?: string | undefined; +- configVersion?: string | number | undefined; ++ configVersion?: number | undefined; + eventLimit?: number | undefined; + resumedChatGroupId?: string | undefined; + verboseTranscription?: boolean | undefined; +- allowConnection?: boolean | undefined; +- /** @deprecated Use sessionSettings.voiceId instead */ +- voiceId?: string | undefined; + apiKey?: string | undefined; +- sessionSettings?: Hume.empathicVoice.ConnectSessionSettings; +- /** Extra query parameters sent at WebSocket connection */ +- queryParams?: Record; ++ sessionSettings: Hume.empathicVoice.ConnectSessionSettings; + /** Arbitrary headers to send with the websocket connect request. */ + headers?: Record; + /** Enable debug mode on the websocket. Defaults to false. */ +@@ -47,91 +37,69 @@ export class Chat { + this._options = _options; + } + +- public connect(args: Chat.ConnectArgs = {}): ChatSocket { ++ public async connect(args: Chat.ConnectArgs): Promise { + const { + accessToken, ++ allowConnection, + configId, + configVersion, + eventLimit, + resumedChatGroupId, + verboseTranscription, +- voiceId, + apiKey, + sessionSettings, +- queryParams, + headers, + debug, + reconnectAttempts, +- allowConnection, + } = args; + const _queryParams: Record = {}; +- + if (accessToken != null) { +- _queryParams["access_token"] = accessToken; ++ _queryParams.access_token = accessToken; ++ } ++ ++ if (allowConnection != null) { ++ _queryParams.allow_connection = allowConnection.toString(); + } + + if (configId != null) { +- _queryParams["config_id"] = configId; ++ _queryParams.config_id = configId; + } + + if (configVersion != null) { +- _queryParams["config_version"] = +- typeof configVersion === "number" ? configVersion.toString() : configVersion; ++ _queryParams.config_version = configVersion.toString(); + } + + if (eventLimit != null) { +- _queryParams["event_limit"] = eventLimit.toString(); ++ _queryParams.event_limit = eventLimit.toString(); + } + + if (resumedChatGroupId != null) { +- _queryParams["resumed_chat_group_id"] = resumedChatGroupId; ++ _queryParams.resumed_chat_group_id = resumedChatGroupId; + } + + if (verboseTranscription != null) { +- _queryParams["verbose_transcription"] = verboseTranscription.toString(); +- } +- +- if (voiceId != null) { +- _queryParams["voice_id"] = voiceId; ++ _queryParams.verbose_transcription = verboseTranscription.toString(); + } + + if (apiKey != null) { +- _queryParams["api_key"] = apiKey; +- } +- +- if (allowConnection != null) { +- _queryParams["allow_connection"] = allowConnection === true ? "true" : "false"; ++ _queryParams.api_key = apiKey; + } + +- if (sessionSettings != null) { +- _queryParams["session_settings"] = serializers.empathicVoice.ConnectSessionSettings.jsonOrThrow( +- sessionSettings, +- { +- unrecognizedObjectKeys: "passthrough", +- allowUnrecognizedUnionMembers: true, +- allowUnrecognizedEnumValues: true, +- omitUndefined: true, +- breadcrumbsPrefix: ["request", "sessionSettings"], +- }, +- ); +- } +- +- // Merge in any additional query parameters +- if (queryParams != null) { +- for (const [name, value] of Object.entries(queryParams)) { +- _queryParams[name] = value; +- } +- } +- +- let _headers: Record = mergeHeaders( +- mergeOnlyDefinedHeaders({ ...this._getCustomAuthorizationHeaders() }), ++ _queryParams.session_settings = serializers.empathicVoice.ConnectSessionSettings.jsonOrThrow(sessionSettings, { ++ unrecognizedObjectKeys: "passthrough", ++ allowUnrecognizedUnionMembers: true, ++ allowUnrecognizedEnumValues: true, ++ omitUndefined: true, ++ breadcrumbsPrefix: ["request", "sessionSettings"], ++ }); ++ const _headers: Record = mergeHeaders( ++ mergeOnlyDefinedHeaders({ ...(await this._getCustomAuthorizationHeaders()) }), + headers, + ); +- + const socket = new core.ReconnectingWebSocket({ + url: core.url.join( +- core.Supplier.get(this._options["baseUrl"]) ?? +- (core.Supplier.get(this._options["environment"]) ?? environments.HumeEnvironment.Prod).evi, ++ (await core.Supplier.get(this._options.baseUrl)) ?? ++ ((await core.Supplier.get(this._options.environment)) ?? environments.HumeEnvironment.Prod).evi, + "/chat", + ), + protocols: [], +@@ -142,12 +110,8 @@ export class Chat { + return new ChatSocket({ socket }); + } + +- protected _getCustomAuthorizationHeaders(): Record { +- const apiKeyValue = core.Supplier.get(this._options.apiKey); +- // This `authHeaderValue` is manually added as if you don't provide it it will +- // be omitted from the headers which means it won't reach the logic in ws.ts that +- // extracts values from the headers and adds them to query parameters. +- const authHeaderValue = core.Supplier.get(this._options.headers?.authorization); +- return { "X-Hume-Api-Key": apiKeyValue, Authorization: authHeaderValue }; ++ protected async _getCustomAuthorizationHeaders(): Promise> { ++ const apiKeyValue = await core.Supplier.get(this._options.apiKey); ++ return { "X-Hume-Api-Key": apiKeyValue }; + } + } diff --git a/src/api/resources/empathicVoice/resources/chat/client/Socket.ts.diff b/src/api/resources/empathicVoice/resources/chat/client/Socket.ts.diff new file mode 100644 index 00000000..819adf6a --- /dev/null +++ b/src/api/resources/empathicVoice/resources/chat/client/Socket.ts.diff @@ -0,0 +1,139 @@ +diff --git a/src/api/resources/empathicVoice/resources/chat/client/Socket.ts b/src/api/resources/empathicVoice/resources/chat/client/Socket.ts +index a55c7b58..0f2f2a55 100644 +--- a/src/api/resources/empathicVoice/resources/chat/client/Socket.ts ++++ b/src/api/resources/empathicVoice/resources/chat/client/Socket.ts +@@ -1,17 +1,17 @@ +-/** THIS FILE IS MANUALLY MAINTAINED: see .fernignore */ ++// This file was auto-generated by Fern from our API Definition. + + import * as core from "../../../../../../core/index.js"; +-import * as Hume from "../../../../../index.js"; +-import { PublishEvent } from "../../../../../../serialization/resources/empathicVoice/resources/chat/types/PublishEvent.js"; + import { fromJson } from "../../../../../../core/json.js"; + import * as serializers from "../../../../../../serialization/index.js"; ++import { PublishEvent } from "../../../../../../serialization/resources/empathicVoice/resources/chat/types/PublishEvent.js"; ++import type * as Hume from "../../../../../index.js"; + + export declare namespace ChatSocket { + export interface Args { + socket: core.ReconnectingWebSocket; + } + +- export type Response = Hume.empathicVoice.SubscribeEvent & { receivedAt: Date }; ++ export type Response = Hume.empathicVoice.SubscribeEvent; + type EventHandlers = { + open?: () => void; + message?: (message: Response) => void; +@@ -37,10 +37,7 @@ export class ChatSocket { + omitUndefined: true, + }); + if (parsedResponse.ok) { +- this.eventHandlers.message?.({ +- ...parsedResponse.value, +- receivedAt: new Date(), +- }); ++ this.eventHandlers.message?.(parsedResponse.value); + } else { + this.eventHandlers.error?.(new Error("Received unknown message type")); + } +@@ -92,86 +89,6 @@ export class ChatSocket { + this.socket.send(JSON.stringify(jsonPayload)); + } + +- /** +- * Send audio input +- */ +- public sendAudioInput(message: Omit): void { +- this.sendPublish({ +- type: "audio_input", +- ...message, +- }); +- } +- +- /** +- * Send session settings +- */ +- public sendSessionSettings(message: Omit = {}): void { +- this.sendPublish({ +- type: "session_settings", +- ...message, +- }); +- } +- +- /** +- * Send assistant input +- */ +- public sendAssistantInput(message: Omit): void { +- this.sendPublish({ +- type: "assistant_input", +- ...message, +- }); +- } +- +- /** +- * Send pause assistant message +- */ +- public pauseAssistant(message: Omit = {}): void { +- this.sendPublish({ +- type: "pause_assistant_message", +- ...message, +- }); +- } +- +- /** +- * Send resume assistant message +- */ +- public resumeAssistant(message: Omit = {}): void { +- this.sendPublish({ +- type: "resume_assistant_message", +- ...message, +- }); +- } +- +- /** +- * Send tool response message +- */ +- public sendToolResponseMessage(message: Omit): void { +- this.sendPublish({ +- type: "tool_response", +- ...message, +- }); +- } +- +- /** +- * Send tool error message +- */ +- public sendToolErrorMessage(message: Omit): void { +- this.sendPublish({ +- type: "tool_error", +- ...message, +- }); +- } +- +- /** +- * Send text input +- */ +- public sendUserInput(text: string): void { +- this.sendPublish({ +- type: "user_input", +- text, +- }); +- } +- + /** Connect to the websocket and register event handlers. */ + public connect(): ChatSocket { + this.socket.reconnect(); +@@ -213,13 +130,6 @@ export class ChatSocket { + }); + } + +- /** +- * @deprecated Use waitForOpen() instead +- */ +- public async tillSocketOpen(): Promise { +- return this.waitForOpen(); +- } +- + /** Asserts that the websocket is open. */ + private assertSocketIsOpen(): void { + if (!this.socket) { diff --git a/src/api/resources/empathicVoice/resources/chat/client/index.ts.diff b/src/api/resources/empathicVoice/resources/chat/client/index.ts.diff new file mode 100644 index 00000000..4e0b8ef6 --- /dev/null +++ b/src/api/resources/empathicVoice/resources/chat/client/index.ts.diff @@ -0,0 +1,9 @@ +diff --git a/src/api/resources/empathicVoice/resources/chat/client/index.ts b/src/api/resources/empathicVoice/resources/chat/client/index.ts +index 38d5d5ff..cb0ff5c3 100644 +--- a/src/api/resources/empathicVoice/resources/chat/client/index.ts ++++ b/src/api/resources/empathicVoice/resources/chat/client/index.ts +@@ -1,3 +1 @@ +-/** THIS FILE IS MANUALLY MAINTAINED: see .fernignore */ +-export { ChatSocket } from "./Socket.js"; +-export { Chat } from "./Client.js"; ++export {}; diff --git a/src/api/resources/empathicVoice/resources/chat/index.ts.diff b/src/api/resources/empathicVoice/resources/chat/index.ts.diff new file mode 100644 index 00000000..8c84c118 --- /dev/null +++ b/src/api/resources/empathicVoice/resources/chat/index.ts.diff @@ -0,0 +1,13 @@ +diff --git a/src/api/resources/empathicVoice/resources/chat/index.ts b/src/api/resources/empathicVoice/resources/chat/index.ts +index a2f33dc7..d9adb1af 100644 +--- a/src/api/resources/empathicVoice/resources/chat/index.ts ++++ b/src/api/resources/empathicVoice/resources/chat/index.ts +@@ -1,7 +1,2 @@ +-export * from "./types/index.js"; + export * from "./client/index.js"; +-/** +- * @deprecated Use `Hume.empathicVoice.SubscribeEvent` instead. +- * This type alias will be removed in a future version. +- */ +-export type { SubscribeEvent } from "./types/SubscribeEvent.js"; ++export * from "./types/index.js"; diff --git a/src/api/resources/empathicVoice/resources/controlPlane/client/Client.ts.diff b/src/api/resources/empathicVoice/resources/controlPlane/client/Client.ts.diff new file mode 100644 index 00000000..ee97553c --- /dev/null +++ b/src/api/resources/empathicVoice/resources/controlPlane/client/Client.ts.diff @@ -0,0 +1,30 @@ +diff --git a/src/api/resources/empathicVoice/resources/controlPlane/client/Client.ts b/src/api/resources/empathicVoice/resources/controlPlane/client/Client.ts +index e092f572..14ce2a9c 100644 +--- a/src/api/resources/empathicVoice/resources/controlPlane/client/Client.ts ++++ b/src/api/resources/empathicVoice/resources/controlPlane/client/Client.ts +@@ -144,7 +144,7 @@ export class ControlPlane { + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + ((await core.Supplier.get(this._options.environment)) ?? environments.HumeEnvironment.Prod).evi, +- `/chat/${core.url.encodePathParam(chat_id)}/connect`, ++ `/chat/${core.url.encodePathParam(chatId)}/connect`, + ), + protocols: [], + queryParameters: _queryParams, +@@ -153,12 +153,9 @@ export class ControlPlane { + }); + return new ControlPlaneSocket({ socket }); + } +- protected async _getCustomAuthorizationHeaders(): Promise> { +- const apiKeyValue = core.Supplier.get(this._options.apiKey); +- // This `authHeaderValue` is manually added as if you don't provide it it will +- // be omitted from the headers which means it won't reach the logic in ws.ts that +- // extracts values from the headers and adds them to query parameters. +- const authHeaderValue = core.Supplier.get(this._options.headers?.authorization); +- return { "X-Hume-Api-Key": apiKeyValue, Authorization: authHeaderValue }; ++ ++ protected async _getCustomAuthorizationHeaders(): Promise> { ++ const apiKeyValue = await core.Supplier.get(this._options.apiKey); ++ return { "X-Hume-Api-Key": apiKeyValue }; + } + } diff --git a/src/api/resources/tts/resources/streamInput/client/Client.ts.diff b/src/api/resources/tts/resources/streamInput/client/Client.ts.diff new file mode 100644 index 00000000..b53f0067 --- /dev/null +++ b/src/api/resources/tts/resources/streamInput/client/Client.ts.diff @@ -0,0 +1,20 @@ +diff --git a/src/api/resources/tts/resources/streamInput/client/Client.ts b/src/api/resources/tts/resources/streamInput/client/Client.ts +index 55e3be81..38701335 100644 +--- a/src/api/resources/tts/resources/streamInput/client/Client.ts ++++ b/src/api/resources/tts/resources/streamInput/client/Client.ts +@@ -125,12 +125,8 @@ export class StreamInput { + return new StreamInputSocket({ socket }); + } + +- protected async _getCustomAuthorizationHeaders(): Promise> { +- const apiKeyValue = core.Supplier.get(this._options.apiKey); +- // This `authHeaderValue` is manually added as if you don't provide it it will +- // be omitted from the headers which means it won't reach the logic in ws.ts that +- // extracts values from the headers and adds them to query parameters. +- const authHeaderValue = core.Supplier.get(this._options.headers?.authorization); +- return { "X-Hume-Api-Key": apiKeyValue, Authorization: authHeaderValue }; ++ protected async _getCustomAuthorizationHeaders(): Promise> { ++ const apiKeyValue = await core.Supplier.get(this._options.apiKey); ++ return { "X-Hume-Api-Key": apiKeyValue }; + } + } diff --git a/src/core/fetcher/Supplier.ts.diff b/src/core/fetcher/Supplier.ts.diff new file mode 100644 index 00000000..512d963b --- /dev/null +++ b/src/core/fetcher/Supplier.ts.diff @@ -0,0 +1,26 @@ +diff --git a/src/core/fetcher/Supplier.ts b/src/core/fetcher/Supplier.ts +index aa95dd85..867c931c 100644 +--- a/src/core/fetcher/Supplier.ts ++++ b/src/core/fetcher/Supplier.ts +@@ -1,19 +1,11 @@ +-/** THIS FILE IS MANUALLY MAINAINED: see .fernignore */ +-export type Supplier = T | (() => T); ++export type Supplier = T | Promise | (() => T | Promise); + + export const Supplier = { +- get: (supplier: Supplier): T => { ++ get: async (supplier: Supplier): Promise => { + if (typeof supplier === "function") { + return (supplier as () => T)(); + } else { + return supplier; + } + }, +- map: (supplier: Supplier, f: (value: T) => R): Supplier => { +- if (typeof supplier === "function") { +- return () => f(Supplier.get(supplier)); +- } else { +- return f(supplier); +- } +- }, + }; diff --git a/src/core/websocket/ws.ts.diff b/src/core/websocket/ws.ts.diff new file mode 100644 index 00000000..1a02cf70 --- /dev/null +++ b/src/core/websocket/ws.ts.diff @@ -0,0 +1,137 @@ +diff --git a/src/core/websocket/ws.ts b/src/core/websocket/ws.ts +index 9a16477e..cba4f692 100644 +--- a/src/core/websocket/ws.ts ++++ b/src/core/websocket/ws.ts +@@ -3,7 +3,6 @@ import { WebSocket as NodeWebSocket } from "ws"; + import { RUNTIME } from "../runtime/index.js"; + import { toQueryString } from "../url/qs.js"; + import * as Events from "./events.js"; +-import { SDK_VERSION } from "../../version.js"; + + const getGlobalWebSocket = (): WebSocket | undefined => { + if (typeof WebSocket !== "undefined") { +@@ -70,49 +69,6 @@ const DEFAULT_OPTIONS = { + debug: false, + }; + +-function addApiKeyFromHeader({ +- headers, +- queryParameters, +-}: { +- headers: Record | undefined; +- queryParameters: Record | undefined; +-}) { +- const apiKeyValue = Object.entries(headers ?? {}).find(([k]) => k.toLowerCase() === "x-hume-api-key")?.[1]; +- if (apiKeyValue && !queryParameters?.["api_key"]) { +- return { ...queryParameters, api_key: apiKeyValue }; +- } +- return queryParameters; +-} +- +-function addAccessTokenFromHeader({ +- headers, +- queryParameters, +-}: { +- headers: Record | undefined; +- queryParameters: Record | undefined; +-}) { +- const authHeaderValue = headers?.["Authorization"] || headers?.["authorization"]; +- if (!authHeaderValue) { +- return queryParameters; +- } +- if (!authHeaderValue.startsWith("Bearer ")) { +- return queryParameters; +- } +- if (queryParameters?.["access_token"]) { +- return queryParameters; +- } +- const token = authHeaderValue.substring("Bearer ".length); +- return { ...queryParameters, access_token: token }; +-} +- +-function addSdkTracking(queryParameters: Record | undefined) { +- return { +- ...queryParameters, +- fernSdkLanguage: "JavaScript", +- fernSdkVersion: SDK_VERSION, +- }; +-} +- + export class ReconnectingWebSocket { + private _ws?: WebSocket; + private _listeners: ReconnectingWebSocket.ListenersMap = { +@@ -141,47 +97,22 @@ export class ReconnectingWebSocket { + this._protocols = protocols; + this._options = options ?? DEFAULT_OPTIONS; + this._headers = headers; +- this._queryParameters = addSdkTracking( +- addAccessTokenFromHeader({ +- headers, +- queryParameters: addApiKeyFromHeader({ +- headers, +- queryParameters, +- }), +- }), +- ); +- ++ this._queryParameters = queryParameters; + if (this._options.startClosed) { + this._shouldReconnect = false; + } + this._connect(); + } + +- static get CONNECTING() { +- return 0; +- } +- static get OPEN() { +- return 1; +- } +- static get CLOSING() { +- return 2; +- } +- static get CLOSED() { +- return 3; +- } ++ public static readonly CONNECTING = 0; ++ public static readonly OPEN = 1; ++ public static readonly CLOSING = 2; ++ public static readonly CLOSED = 3; + +- get CONNECTING(): number { +- return ReconnectingWebSocket.CONNECTING; +- } +- get OPEN(): number { +- return ReconnectingWebSocket.OPEN; +- } +- get CLOSING(): number { +- return ReconnectingWebSocket.CLOSING; +- } +- get CLOSED(): number { +- return ReconnectingWebSocket.CLOSED; +- } ++ public readonly CONNECTING: typeof ReconnectingWebSocket.CONNECTING = ReconnectingWebSocket.CONNECTING; ++ public readonly OPEN: typeof ReconnectingWebSocket.OPEN = ReconnectingWebSocket.OPEN; ++ public readonly CLOSING: typeof ReconnectingWebSocket.CLOSING = ReconnectingWebSocket.CLOSING; ++ public readonly CLOSED: typeof ReconnectingWebSocket.CLOSED = ReconnectingWebSocket.CLOSED; + + get binaryType() { + return this._ws ? this._ws.binaryType : this._binaryType; +@@ -383,7 +314,7 @@ export class ReconnectingWebSocket { + } = this._options; + let delay = 0; + if (this._retryCount > 0) { +- delay = minReconnectionDelay * Math.pow(reconnectionDelayGrowFactor, this._retryCount - 1); ++ delay = minReconnectionDelay * reconnectionDelayGrowFactor ** (this._retryCount - 1); + if (delay > maxReconnectionDelay) { + delay = maxReconnectionDelay; + } +@@ -478,7 +409,7 @@ export class ReconnectingWebSocket { + try { + this._ws.close(code, reason); + this._handleClose(new Events.CloseEvent(code, reason, this)); +- } catch (error) { ++ } catch (_error) { + // ignore + } + } diff --git a/src/index.ts.diff b/src/index.ts.diff new file mode 100644 index 00000000..3c4cba14 --- /dev/null +++ b/src/index.ts.diff @@ -0,0 +1,17 @@ +diff --git a/src/index.ts b/src/index.ts +index 4d199020..c814670b 100644 +--- a/src/index.ts ++++ b/src/index.ts +@@ -1,8 +1,7 @@ + export * as Hume from "./api/index.js"; +-export * as serialization from "./serialization/index.js"; ++export type { BaseClientOptions, BaseRequestOptions } from "./BaseClient.js"; ++export { HumeClient } from "./Client.js"; ++export { HumeEnvironment, type HumeEnvironmentUrls } from "./environments.js"; + export { HumeError, HumeTimeoutError } from "./errors/index.js"; +-export { HumeEnvironment } from "./environments.js"; +-export type { HumeEnvironmentUrls } from "./environments.js"; + export * from "./exports.js"; +- +-export * from "./wrapper/index.js"; ++export * as serialization from "./serialization/index.js"; diff --git a/src/serialization/resources/empathicVoice/resources/chat/index.ts.diff b/src/serialization/resources/empathicVoice/resources/chat/index.ts.diff new file mode 100644 index 00000000..c11f606d --- /dev/null +++ b/src/serialization/resources/empathicVoice/resources/chat/index.ts.diff @@ -0,0 +1,12 @@ +diff --git a/src/serialization/resources/empathicVoice/resources/chat/index.ts b/src/serialization/resources/empathicVoice/resources/chat/index.ts +index f5ca113c..d9adb1af 100644 +--- a/src/serialization/resources/empathicVoice/resources/chat/index.ts ++++ b/src/serialization/resources/empathicVoice/resources/chat/index.ts +@@ -1,7 +1,2 @@ + export * from "./client/index.js"; + export * from "./types/index.js"; +-/** +- * @deprecated Use `serialization.empathicVoice.SubscribeEvent` instead. +- * This serializer alias will be removed in a future version. +- */ +-export { SubscribeEvent } from "./types/SubscribeEvent.js";