diff --git a/README.md b/README.md
index fb17c10..4d71088 100644
--- a/README.md
+++ b/README.md
@@ -25,12 +25,9 @@ import RetellSdk from 'retell-sdk';
const retellSdk = new RetellSdk();
async function main() {
- const agentCreateResponse = await retellSdk.agent.create({
- llm_type: 'retell-llm',
- voice_id: '11labs-Adrian',
- });
+ const agent = await retellSdk.agent.create({ llm_type: 'retell-llm', voice_id: '11labs-Adrian' });
- console.log(agentCreateResponse.agent_id);
+ console.log(agent.voice_id);
}
main();
@@ -48,7 +45,7 @@ const retellSdk = new RetellSdk();
async function main() {
const params: RetellSdk.AgentCreateParams = { llm_type: 'retell-llm', voice_id: '11labs-Adrian' };
- const agentCreateResponse: RetellSdk.AgentCreateResponse = await retellSdk.agent.create(params);
+ const agent: RetellSdk.Agent = await retellSdk.agent.create(params);
}
main();
@@ -65,7 +62,7 @@ a subclass of `APIError` will be thrown:
```ts
async function main() {
- const agentCreateResponse = await retellSdk.agent
+ const agent = await retellSdk.agent
.create({ llm_type: 'retell-llm', voice_id: '11labs-Adrian' })
.catch(async (err) => {
if (err instanceof RetellSdk.APIError) {
@@ -154,11 +151,11 @@ const response = await retellSdk.agent
console.log(response.headers.get('X-My-Header'));
console.log(response.statusText); // access the underlying Response object
-const { data: agentCreateResponse, response: raw } = await retellSdk.agent
+const { data: agent, response: raw } = await retellSdk.agent
.create({ llm_type: 'retell-llm', voice_id: '11labs-Adrian' })
.withResponse();
console.log(raw.headers.get('X-My-Header'));
-console.log(agentCreateResponse.agent_id);
+console.log(agent.voice_id);
```
### Making custom/undocumented requests
diff --git a/api.md b/api.md
index ea6ec45..f3dfafa 100644
--- a/api.md
+++ b/api.md
@@ -33,16 +33,14 @@ Methods:
Types:
-- AgentCreateResponse
-- AgentRetrieveResponse
-- AgentUpdateResponse
+- Agent
- AgentListResponse
Methods:
-- client.agent.create({ ...params }) -> AgentCreateResponse
-- client.agent.retrieve(agentId) -> AgentRetrieveResponse
-- client.agent.update(agentId, { ...params }) -> AgentUpdateResponse
+- client.agent.create({ ...params }) -> Agent
+- client.agent.retrieve(agentId) -> Agent
+- client.agent.update(agentId, { ...params }) -> Agent
- client.agent.list() -> AgentListResponse
- client.agent.delete(agentId) -> void
diff --git a/src/index.ts b/src/index.ts
index 1b2c203..2593f9a 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -119,7 +119,7 @@ export class RetellSdk extends Core.APIClient {
call: API.Call = new API.Call(this);
phoneNumber: API.PhoneNumberResource = new API.PhoneNumberResource(this);
- agent: API.Agent = new API.Agent(this);
+ agent: API.AgentResource = new API.AgentResource(this);
llm: API.Llm = new API.Llm(this);
protected override defaultQuery(): Core.DefaultQuery | undefined {
@@ -199,10 +199,8 @@ export namespace RetellSdk {
export import PhoneNumberCreateParams = API.PhoneNumberCreateParams;
export import PhoneNumberUpdateParams = API.PhoneNumberUpdateParams;
+ export import AgentResource = API.AgentResource;
export import Agent = API.Agent;
- export import AgentCreateResponse = API.AgentCreateResponse;
- export import AgentRetrieveResponse = API.AgentRetrieveResponse;
- export import AgentUpdateResponse = API.AgentUpdateResponse;
export import AgentListResponse = API.AgentListResponse;
export import AgentCreateParams = API.AgentCreateParams;
export import AgentUpdateParams = API.AgentUpdateParams;
diff --git a/src/resources/agent.ts b/src/resources/agent.ts
index b4efe31..1766ee7 100644
--- a/src/resources/agent.ts
+++ b/src/resources/agent.ts
@@ -4,29 +4,25 @@ import * as Core from 'retell-sdk/core';
import { APIResource } from 'retell-sdk/resource';
import * as AgentAPI from 'retell-sdk/resources/agent';
-export class Agent extends APIResource {
+export class AgentResource extends APIResource {
/**
* Create a new agent
*/
- create(body: AgentCreateParams, options?: Core.RequestOptions): Core.APIPromise {
+ create(body: AgentCreateParams, options?: Core.RequestOptions): Core.APIPromise {
return this._client.post('/create-agent', { body, ...options });
}
/**
* Retrieve details of a specific agent
*/
- retrieve(agentId: string, options?: Core.RequestOptions): Core.APIPromise {
+ retrieve(agentId: string, options?: Core.RequestOptions): Core.APIPromise {
return this._client.get(`/get-agent/${agentId}`, options);
}
/**
* Update an existing agent
*/
- update(
- agentId: string,
- body: AgentUpdateParams,
- options?: Core.RequestOptions,
- ): Core.APIPromise {
+ update(agentId: string, body: AgentUpdateParams, options?: Core.RequestOptions): Core.APIPromise {
return this._client.patch(`/update-agent/${agentId}`, { body, ...options });
}
@@ -48,321 +44,19 @@ export class Agent extends APIResource {
}
}
-export interface AgentCreateResponse {
- /**
- * Unique id of agent.
- */
- agent_id?: string;
-
- /**
- * The name of the agent. Only used for your own reference.
- */
- agent_name?: string;
-
- /**
- * If set, will add ambient environment sound to the call to make experience more
- * realistic. Currently supports the following options:
- *
- * - `coffee-shop`: Coffee shop ambience with people chatting in background.
- * [Listen to Ambience](https://retell-utils-public.s3.us-west-2.amazonaws.com/coffee-shop.wav)
- *
- * - `convention-hall`: Convention hall ambience, with some echo and people
- * chatting in background.
- * [Listen to Ambience](https://retell-utils-public.s3.us-west-2.amazonaws.com/convention-hall.wav)
- *
- * - `summer-outdoor`: Summer outdoor ambience with cicada chirping.
- * [Listen to Ambience](https://retell-utils-public.s3.us-west-2.amazonaws.com/summer-outdoor.wav)
- *
- * - `mountain-outdoor`: Mountain outdoor ambience with birds singing.
- * [Listen to Ambience](https://retell-utils-public.s3.us-west-2.amazonaws.com/mountain-outdoor.wav)
- *
- * Set to string `null` to remove ambient sound from this agent.
- */
- ambient_sound?: 'coffee-shop' | 'convention-hall' | 'summer-outdoor' | 'mountain-outdoor' | 'null';
-
- /**
- * Provide a customized list of keywords to bias the transcriber model, so that
- * these words are more likely to get transcribed. Commonly used for names, brands,
- * street, etc.
- */
- boosted_keywords?: Array;
-
- /**
- * Controls whether the agent would backchannel (agent interjects the speaker with
- * phrases like "yeah", "uh-huh" to signify interest and engagement). Backchannel
- * when enabled tends to show up more in longer user utterances. If not set, agent
- * will not backchannel.
- */
- enable_backchannel?: boolean;
-
- /**
- * Whether to format the transcribed text with inverse text normalization. It
- * transforms the spoken form of text into written form for entities like phone
- * number, email address, street address, etc. For example, "february fourth twenty
- * twenty two" can be converted into "february 4th 2022". If not set, the default
- * is true.
- */
- format_text?: boolean;
-
- /**
- * `Beta feature, use with caution.`
- *
- * This setting specifies the agent's operational language, including base language
- * and dialect. Speech recognition considers both elements, but text-to-speech
- * currently only recognizes the base language.
- *
- * For instance, selecting `en-GB` optimizes speech recognition for British
- * English, yet text-to-speech output will be in standard English. If
- * dialect-specific text-to-speech is required, please contact us for support.
- *
- * - `11lab voices`: supports English(en), German(de), Spanish(es), Hindi(hi),
- * Portuguese(pt)
- *
- * - `openAI voices`: supports English(en), German(de), Spanish(es), Hindi(hi),
- * Portuguese(pt), Japanese(ja)
- *
- * - `deepgram voices`: supports English(en)
- */
- language?:
- | 'en-US'
- | 'en-IN'
- | 'en-GB'
- | 'de-DE'
- | 'es-ES'
- | 'es-419'
- | 'hi-IN'
- | 'ja-JP'
- | 'pt-PT'
- | 'pt-BR';
-
- /**
- * Last modification timestamp (milliseconds since epoch). Either the time of last
- * update or creation if no updates available.
- */
- last_modification_timestamp?: number;
-
- /**
- * If using retell-llm, add retell_llm_id by calling create-retell-llm API. If
- * using custom LLM, specific a llm_websocket_url.
- */
- llm_type?: 'retell-llm' | 'custom-llm';
-
+export interface Agent {
/**
* The URL we will establish LLM websocket for getting response, usually your
* server. Check out [LLM WebSocket](/api-references/llm-websocket) for more about
* request format (sent from us) and response format (send to us).
*/
- llm_websocket_url?: string;
-
- /**
- * Disable transcripts and recordings storage for enhanced privacy. Access
- * transcripts securely via webhooks.
- */
- optOutSensitiveDataStorage?: boolean;
-
- /**
- * Controls how responsive is the agent. Value ranging from [0,1]. Lower value
- * means less responsive agent (wait more, respond slower), while higher value
- * means faster exchanges (respond when it can). If unset, default value 1 will
- * apply.
- */
- responsiveness?: number;
-
- /**
- * Get your retell_llm_id from create-retell-llm API.
- */
- retell_llm_id?: string;
+ llm_websocket_url: string;
/**
* Unique voice id used for the agent. Find list of available voices and their
* preview in Dashboard.
*/
- voice_id?: string;
-
- /**
- * Controls speed of voice. Value ranging from [0.5,2]. Lower value means slower
- * speech, while higher value means faster speech rate. If unset, default value 1
- * will apply.
- */
- voice_speed?: number;
-
- /**
- * Controls how stable the voice is. Value ranging from [0,2]. Lower value means
- * more stable, and higher value means more variant speech generation. Currently
- * this setting only applies to `11labs` voices. If unset, default value 1 will
- * apply.
- */
- voice_temperature?: number;
-
- /**
- * The webhook for agent to listen to call events. See what events it would get at
- * [webhook doc](/features/webhook). If set, will binds webhook events for this
- * agent to the specified url, and will ignore the account level webhook for this
- * agent. Set to string `null` to remove webhook url from this agent.
- */
- webhook_url?: string;
-}
-
-export interface AgentRetrieveResponse {
- /**
- * Unique id of agent.
- */
- agent_id?: string;
-
- /**
- * The name of the agent. Only used for your own reference.
- */
- agent_name?: string;
-
- /**
- * If set, will add ambient environment sound to the call to make experience more
- * realistic. Currently supports the following options:
- *
- * - `coffee-shop`: Coffee shop ambience with people chatting in background.
- * [Listen to Ambience](https://retell-utils-public.s3.us-west-2.amazonaws.com/coffee-shop.wav)
- *
- * - `convention-hall`: Convention hall ambience, with some echo and people
- * chatting in background.
- * [Listen to Ambience](https://retell-utils-public.s3.us-west-2.amazonaws.com/convention-hall.wav)
- *
- * - `summer-outdoor`: Summer outdoor ambience with cicada chirping.
- * [Listen to Ambience](https://retell-utils-public.s3.us-west-2.amazonaws.com/summer-outdoor.wav)
- *
- * - `mountain-outdoor`: Mountain outdoor ambience with birds singing.
- * [Listen to Ambience](https://retell-utils-public.s3.us-west-2.amazonaws.com/mountain-outdoor.wav)
- *
- * Set to string `null` to remove ambient sound from this agent.
- */
- ambient_sound?: 'coffee-shop' | 'convention-hall' | 'summer-outdoor' | 'mountain-outdoor' | 'null';
-
- /**
- * Provide a customized list of keywords to bias the transcriber model, so that
- * these words are more likely to get transcribed. Commonly used for names, brands,
- * street, etc.
- */
- boosted_keywords?: Array;
-
- /**
- * Controls whether the agent would backchannel (agent interjects the speaker with
- * phrases like "yeah", "uh-huh" to signify interest and engagement). Backchannel
- * when enabled tends to show up more in longer user utterances. If not set, agent
- * will not backchannel.
- */
- enable_backchannel?: boolean;
-
- /**
- * Whether to format the transcribed text with inverse text normalization. It
- * transforms the spoken form of text into written form for entities like phone
- * number, email address, street address, etc. For example, "february fourth twenty
- * twenty two" can be converted into "february 4th 2022". If not set, the default
- * is true.
- */
- format_text?: boolean;
-
- /**
- * `Beta feature, use with caution.`
- *
- * This setting specifies the agent's operational language, including base language
- * and dialect. Speech recognition considers both elements, but text-to-speech
- * currently only recognizes the base language.
- *
- * For instance, selecting `en-GB` optimizes speech recognition for British
- * English, yet text-to-speech output will be in standard English. If
- * dialect-specific text-to-speech is required, please contact us for support.
- *
- * - `11lab voices`: supports English(en), German(de), Spanish(es), Hindi(hi),
- * Portuguese(pt)
- *
- * - `openAI voices`: supports English(en), German(de), Spanish(es), Hindi(hi),
- * Portuguese(pt), Japanese(ja)
- *
- * - `deepgram voices`: supports English(en)
- */
- language?:
- | 'en-US'
- | 'en-IN'
- | 'en-GB'
- | 'de-DE'
- | 'es-ES'
- | 'es-419'
- | 'hi-IN'
- | 'ja-JP'
- | 'pt-PT'
- | 'pt-BR';
-
- /**
- * Last modification timestamp (milliseconds since epoch). Either the time of last
- * update or creation if no updates available.
- */
- last_modification_timestamp?: number;
-
- /**
- * If using retell-llm, add retell_llm_id by calling create-retell-llm API. If
- * using custom LLM, specific a llm_websocket_url.
- */
- llm_type?: 'retell-llm' | 'custom-llm';
-
- /**
- * The URL we will establish LLM websocket for getting response, usually your
- * server. Check out [LLM WebSocket](/api-references/llm-websocket) for more about
- * request format (sent from us) and response format (send to us).
- */
- llm_websocket_url?: string;
-
- /**
- * Disable transcripts and recordings storage for enhanced privacy. Access
- * transcripts securely via webhooks.
- */
- optOutSensitiveDataStorage?: boolean;
-
- /**
- * Controls how responsive is the agent. Value ranging from [0,1]. Lower value
- * means less responsive agent (wait more, respond slower), while higher value
- * means faster exchanges (respond when it can). If unset, default value 1 will
- * apply.
- */
- responsiveness?: number;
-
- /**
- * Get your retell_llm_id from create-retell-llm API.
- */
- retell_llm_id?: string;
-
- /**
- * Unique voice id used for the agent. Find list of available voices and their
- * preview in Dashboard.
- */
- voice_id?: string;
-
- /**
- * Controls speed of voice. Value ranging from [0.5,2]. Lower value means slower
- * speech, while higher value means faster speech rate. If unset, default value 1
- * will apply.
- */
- voice_speed?: number;
-
- /**
- * Controls how stable the voice is. Value ranging from [0,2]. Lower value means
- * more stable, and higher value means more variant speech generation. Currently
- * this setting only applies to `11labs` voices. If unset, default value 1 will
- * apply.
- */
- voice_temperature?: number;
-
- /**
- * The webhook for agent to listen to call events. See what events it would get at
- * [webhook doc](/features/webhook). If set, will binds webhook events for this
- * agent to the specified url, and will ignore the account level webhook for this
- * agent. Set to string `null` to remove webhook url from this agent.
- */
- webhook_url?: string;
-}
-
-export interface AgentUpdateResponse {
- /**
- * Unique id of agent.
- */
- agent_id?: string;
+ voice_id: string;
/**
* The name of the agent. Only used for your own reference.
@@ -445,25 +139,12 @@ export interface AgentUpdateResponse {
| 'pt-PT'
| 'pt-BR';
- /**
- * Last modification timestamp (milliseconds since epoch). Either the time of last
- * update or creation if no updates available.
- */
- last_modification_timestamp?: number;
-
/**
* If using retell-llm, add retell_llm_id by calling create-retell-llm API. If
* using custom LLM, specific a llm_websocket_url.
*/
llm_type?: 'retell-llm' | 'custom-llm';
- /**
- * The URL we will establish LLM websocket for getting response, usually your
- * server. Check out [LLM WebSocket](/api-references/llm-websocket) for more about
- * request format (sent from us) and response format (send to us).
- */
- llm_websocket_url?: string;
-
/**
* Disable transcripts and recordings storage for enhanced privacy. Access
* transcripts securely via webhooks.
@@ -483,12 +164,6 @@ export interface AgentUpdateResponse {
*/
retell_llm_id?: string;
- /**
- * Unique voice id used for the agent. Find list of available voices and their
- * preview in Dashboard.
- */
- voice_id?: string;
-
/**
* Controls speed of voice. Value ranging from [0.5,2]. Lower value means slower
* speech, while higher value means faster speech rate. If unset, default value 1
@@ -513,164 +188,7 @@ export interface AgentUpdateResponse {
webhook_url?: string;
}
-export type AgentListResponse = Array;
-
-export namespace AgentListResponse {
- export interface AgentListResponseItem {
- /**
- * Unique id of agent.
- */
- agent_id?: string;
-
- /**
- * The name of the agent. Only used for your own reference.
- */
- agent_name?: string;
-
- /**
- * If set, will add ambient environment sound to the call to make experience more
- * realistic. Currently supports the following options:
- *
- * - `coffee-shop`: Coffee shop ambience with people chatting in background.
- * [Listen to Ambience](https://retell-utils-public.s3.us-west-2.amazonaws.com/coffee-shop.wav)
- *
- * - `convention-hall`: Convention hall ambience, with some echo and people
- * chatting in background.
- * [Listen to Ambience](https://retell-utils-public.s3.us-west-2.amazonaws.com/convention-hall.wav)
- *
- * - `summer-outdoor`: Summer outdoor ambience with cicada chirping.
- * [Listen to Ambience](https://retell-utils-public.s3.us-west-2.amazonaws.com/summer-outdoor.wav)
- *
- * - `mountain-outdoor`: Mountain outdoor ambience with birds singing.
- * [Listen to Ambience](https://retell-utils-public.s3.us-west-2.amazonaws.com/mountain-outdoor.wav)
- *
- * Set to string `null` to remove ambient sound from this agent.
- */
- ambient_sound?: 'coffee-shop' | 'convention-hall' | 'summer-outdoor' | 'mountain-outdoor' | 'null';
-
- /**
- * Provide a customized list of keywords to bias the transcriber model, so that
- * these words are more likely to get transcribed. Commonly used for names, brands,
- * street, etc.
- */
- boosted_keywords?: Array;
-
- /**
- * Controls whether the agent would backchannel (agent interjects the speaker with
- * phrases like "yeah", "uh-huh" to signify interest and engagement). Backchannel
- * when enabled tends to show up more in longer user utterances. If not set, agent
- * will not backchannel.
- */
- enable_backchannel?: boolean;
-
- /**
- * Whether to format the transcribed text with inverse text normalization. It
- * transforms the spoken form of text into written form for entities like phone
- * number, email address, street address, etc. For example, "february fourth twenty
- * twenty two" can be converted into "february 4th 2022". If not set, the default
- * is true.
- */
- format_text?: boolean;
-
- /**
- * `Beta feature, use with caution.`
- *
- * This setting specifies the agent's operational language, including base language
- * and dialect. Speech recognition considers both elements, but text-to-speech
- * currently only recognizes the base language.
- *
- * For instance, selecting `en-GB` optimizes speech recognition for British
- * English, yet text-to-speech output will be in standard English. If
- * dialect-specific text-to-speech is required, please contact us for support.
- *
- * - `11lab voices`: supports English(en), German(de), Spanish(es), Hindi(hi),
- * Portuguese(pt)
- *
- * - `openAI voices`: supports English(en), German(de), Spanish(es), Hindi(hi),
- * Portuguese(pt), Japanese(ja)
- *
- * - `deepgram voices`: supports English(en)
- */
- language?:
- | 'en-US'
- | 'en-IN'
- | 'en-GB'
- | 'de-DE'
- | 'es-ES'
- | 'es-419'
- | 'hi-IN'
- | 'ja-JP'
- | 'pt-PT'
- | 'pt-BR';
-
- /**
- * Last modification timestamp (milliseconds since epoch). Either the time of last
- * update or creation if no updates available.
- */
- last_modification_timestamp?: number;
-
- /**
- * If using retell-llm, add retell_llm_id by calling create-retell-llm API. If
- * using custom LLM, specific a llm_websocket_url.
- */
- llm_type?: 'retell-llm' | 'custom-llm';
-
- /**
- * The URL we will establish LLM websocket for getting response, usually your
- * server. Check out [LLM WebSocket](/api-references/llm-websocket) for more about
- * request format (sent from us) and response format (send to us).
- */
- llm_websocket_url?: string;
-
- /**
- * Disable transcripts and recordings storage for enhanced privacy. Access
- * transcripts securely via webhooks.
- */
- optOutSensitiveDataStorage?: boolean;
-
- /**
- * Controls how responsive is the agent. Value ranging from [0,1]. Lower value
- * means less responsive agent (wait more, respond slower), while higher value
- * means faster exchanges (respond when it can). If unset, default value 1 will
- * apply.
- */
- responsiveness?: number;
-
- /**
- * Get your retell_llm_id from create-retell-llm API.
- */
- retell_llm_id?: string;
-
- /**
- * Unique voice id used for the agent. Find list of available voices and their
- * preview in Dashboard.
- */
- voice_id?: string;
-
- /**
- * Controls speed of voice. Value ranging from [0.5,2]. Lower value means slower
- * speech, while higher value means faster speech rate. If unset, default value 1
- * will apply.
- */
- voice_speed?: number;
-
- /**
- * Controls how stable the voice is. Value ranging from [0,2]. Lower value means
- * more stable, and higher value means more variant speech generation. Currently
- * this setting only applies to `11labs` voices. If unset, default value 1 will
- * apply.
- */
- voice_temperature?: number;
-
- /**
- * The webhook for agent to listen to call events. See what events it would get at
- * [webhook doc](/features/webhook). If set, will binds webhook events for this
- * agent to the specified url, and will ignore the account level webhook for this
- * agent. Set to string `null` to remove webhook url from this agent.
- */
- webhook_url?: string;
- }
-}
+export type AgentListResponse = Array;
export interface AgentCreateParams {
/**
@@ -960,10 +478,8 @@ export interface AgentUpdateParams {
webhook_url?: string;
}
-export namespace Agent {
- export import AgentCreateResponse = AgentAPI.AgentCreateResponse;
- export import AgentRetrieveResponse = AgentAPI.AgentRetrieveResponse;
- export import AgentUpdateResponse = AgentAPI.AgentUpdateResponse;
+export namespace AgentResource {
+ export import Agent = AgentAPI.Agent;
export import AgentListResponse = AgentAPI.AgentListResponse;
export import AgentCreateParams = AgentAPI.AgentCreateParams;
export import AgentUpdateParams = AgentAPI.AgentUpdateParams;
diff --git a/src/resources/index.ts b/src/resources/index.ts
index 0ca0f02..d69ef60 100644
--- a/src/resources/index.ts
+++ b/src/resources/index.ts
@@ -1,14 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-export {
- AgentCreateResponse,
- AgentRetrieveResponse,
- AgentUpdateResponse,
- AgentListResponse,
- AgentCreateParams,
- AgentUpdateParams,
- Agent,
-} from './agent';
+export { Agent, AgentListResponse, AgentCreateParams, AgentUpdateParams, AgentResource } from './agent';
export {
CallDetail,
CallCreateResponse,