Skip to content

Commit

Permalink
feat(api): update via SDK Studio
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-bot committed Mar 25, 2024
1 parent 9c66392 commit 8c76b67
Show file tree
Hide file tree
Showing 13 changed files with 1,674 additions and 556 deletions.
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
configured_endpoints: 19
configured_endpoints: 17
22 changes: 14 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ import RetellSdk from 'retell-sdk';
const retellSdk = new RetellSdk();

async function main() {
const agent = await retellSdk.agent.create({ llm_type: 'retell-llm', voice_id: '11labs-Adrian' });
const agent = await retellSdk.agent.create({
llm_websocket_url: 'wss://your-websocket-endpoint',
voice_id: '11labs-Adrian',
});

console.log(agent.voice_id);
}
Expand All @@ -44,7 +47,10 @@ import RetellSdk from 'retell-sdk';
const retellSdk = new RetellSdk();

async function main() {
const params: RetellSdk.AgentCreateParams = { llm_type: 'retell-llm', voice_id: '11labs-Adrian' };
const params: RetellSdk.AgentCreateParams = {
llm_websocket_url: 'wss://your-websocket-endpoint',
voice_id: '11labs-Adrian',
};
const agent: RetellSdk.Agent = await retellSdk.agent.create(params);
}

Expand All @@ -63,7 +69,7 @@ a subclass of `APIError` will be thrown:
```ts
async function main() {
const agent = await retellSdk.agent
.create({ llm_type: 'retell-llm', voice_id: '11labs-Adrian' })
.create({ llm_websocket_url: 'wss://your-websocket-endpoint', voice_id: '11labs-Adrian' })
.catch(async (err) => {
if (err instanceof RetellSdk.APIError) {
console.log(err.status); // 400
Expand Down Expand Up @@ -107,7 +113,7 @@ const retellSdk = new RetellSdk({
});

// Or, configure per-request:
await retellSdk.agent.create({ llm_type: 'retell-llm', voice_id: '11labs-Adrian' }, {
await retellSdk.agent.create({ llm_websocket_url: 'wss://your-websocket-endpoint', voice_id: '11labs-Adrian' }, {
maxRetries: 5,
});
```
Expand All @@ -124,7 +130,7 @@ const retellSdk = new RetellSdk({
});

// Override per-request:
await retellSdk.agent.create({ llm_type: 'retell-llm', voice_id: '11labs-Adrian' }, {
await retellSdk.agent.create({ llm_websocket_url: 'wss://your-websocket-endpoint', voice_id: '11labs-Adrian' }, {
timeout: 5 * 1000,
});
```
Expand All @@ -146,13 +152,13 @@ You can also use the `.withResponse()` method to get the raw `Response` along wi
const retellSdk = new RetellSdk();

const response = await retellSdk.agent
.create({ llm_type: 'retell-llm', voice_id: '11labs-Adrian' })
.create({ llm_websocket_url: 'wss://your-websocket-endpoint', voice_id: '11labs-Adrian' })
.asResponse();
console.log(response.headers.get('X-My-Header'));
console.log(response.statusText); // access the underlying Response object

const { data: agent, response: raw } = await retellSdk.agent
.create({ llm_type: 'retell-llm', voice_id: '11labs-Adrian' })
.create({ llm_websocket_url: 'wss://your-websocket-endpoint', voice_id: '11labs-Adrian' })
.withResponse();
console.log(raw.headers.get('X-My-Header'));
console.log(agent.voice_id);
Expand Down Expand Up @@ -260,7 +266,7 @@ const retellSdk = new RetellSdk({

// Override per-request:
await retellSdk.agent.create(
{ llm_type: 'retell-llm', voice_id: '11labs-Adrian' },
{ llm_websocket_url: 'wss://your-websocket-endpoint', voice_id: '11labs-Adrian' },
{
httpAgent: new http.Agent({ keepAlive: false }),
},
Expand Down
4 changes: 0 additions & 4 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,12 @@ Methods:
Types:

- <code><a href="./src/resources/phone-number.ts">PhoneNumber</a></code>
- <code><a href="./src/resources/phone-number.ts">PhoneNumberListResponse</a></code>

Methods:

- <code title="post /create-phone-number">client.phoneNumber.<a href="./src/resources/phone-number.ts">create</a>({ ...params }) -> PhoneNumber</code>
- <code title="get /get-phone-number/{phone_number}">client.phoneNumber.<a href="./src/resources/phone-number.ts">retrieve</a>(phoneNumber) -> PhoneNumber</code>
- <code title="patch /update-phone-number/{phone_number}">client.phoneNumber.<a href="./src/resources/phone-number.ts">update</a>(phoneNumber, { ...params }) -> PhoneNumber</code>
- <code title="get /list-phone-number">client.phoneNumber.<a href="./src/resources/phone-number.ts">list</a>() -> PhoneNumberListResponse</code>
- <code title="delete /delete-phone-number/{phone_number}">client.phoneNumber.<a href="./src/resources/phone-number.ts">delete</a>(phoneNumber) -> void</code>

# Agent
Expand All @@ -51,12 +49,10 @@ Types:
- <code><a href="./src/resources/llm.ts">LlmCreateResponse</a></code>
- <code><a href="./src/resources/llm.ts">LlmRetrieveResponse</a></code>
- <code><a href="./src/resources/llm.ts">LlmUpdateResponse</a></code>
- <code><a href="./src/resources/llm.ts">LlmListResponse</a></code>

Methods:

- <code title="post /create-retell-llm">client.llm.<a href="./src/resources/llm.ts">create</a>({ ...params }) -> LlmCreateResponse</code>
- <code title="get /get-retell-llm/{llm_id}">client.llm.<a href="./src/resources/llm.ts">retrieve</a>(llmId) -> LlmRetrieveResponse</code>
- <code title="patch /update-retell-llm/{llm_id}">client.llm.<a href="./src/resources/llm.ts">update</a>(llmId, { ...params }) -> LlmUpdateResponse</code>
- <code title="get /list-retell-llm">client.llm.<a href="./src/resources/llm.ts">list</a>() -> LlmListResponse</code>
- <code title="delete /delete-retell-llm/{llm_id}">client.llm.<a href="./src/resources/llm.ts">delete</a>(llmId) -> void</code>
2 changes: 0 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ export namespace RetellSdk {

export import PhoneNumberResource = API.PhoneNumberResource;
export import PhoneNumber = API.PhoneNumber;
export import PhoneNumberListResponse = API.PhoneNumberListResponse;
export import PhoneNumberCreateParams = API.PhoneNumberCreateParams;
export import PhoneNumberUpdateParams = API.PhoneNumberUpdateParams;

Expand All @@ -209,7 +208,6 @@ export namespace RetellSdk {
export import LlmCreateResponse = API.LlmCreateResponse;
export import LlmRetrieveResponse = API.LlmRetrieveResponse;
export import LlmUpdateResponse = API.LlmUpdateResponse;
export import LlmListResponse = API.LlmListResponse;
export import LlmCreateParams = API.LlmCreateParams;
export import LlmUpdateParams = API.LlmUpdateParams;
}
Expand Down
41 changes: 4 additions & 37 deletions src/resources/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,6 @@ export interface Agent {
| 'pt-PT'
| 'pt-BR';

/**
* 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';

/**
* Disable transcripts and recordings storage for enhanced privacy. Access
* transcripts securely via webhooks.
Expand All @@ -159,11 +153,6 @@ export interface Agent {
*/
responsiveness?: number;

/**
* Get your retell_llm_id from create-retell-llm API.
*/
retell_llm_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
Expand Down Expand Up @@ -192,10 +181,11 @@ export type AgentListResponse = Array<Agent>;

export interface AgentCreateParams {
/**
* If using retell-llm, add retell_llm_id by calling create-retell-llm API. If
* using custom LLM, specific a llm_websocket_url.
* 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_type: 'retell-llm' | 'custom-llm';
llm_websocket_url: string;

/**
* Unique voice id used for the agent. Find list of available voices and their
Expand Down Expand Up @@ -284,13 +274,6 @@ export interface AgentCreateParams {
| 'pt-PT'
| 'pt-BR';

/**
* 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.
Expand All @@ -305,11 +288,6 @@ export interface AgentCreateParams {
*/
responsiveness?: number;

/**
* Get your retell_llm_id from create-retell-llm API.
*/
retell_llm_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
Expand Down Expand Up @@ -416,12 +394,6 @@ export interface AgentUpdateParams {
| 'pt-PT'
| 'pt-BR';

/**
* 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
Expand All @@ -443,11 +415,6 @@ export interface AgentUpdateParams {
*/
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.
Expand Down
32 changes: 26 additions & 6 deletions src/resources/call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,12 @@ export interface CallDetail {
*/
metadata?: unknown;

/**
* Add optional dynamic variables in key value pairs of string that injects into
* your Retell LLM prompt and tool description. Only applicable for Retell LLM.
*/
retell_llm_dynamic_variables?: Record<string, unknown>;

/**
* The callee number. This field is storage purpose only, set this if you want the
* call object to contain it so that it's easier to reference it. Not used for
Expand Down Expand Up @@ -240,6 +246,12 @@ export interface CallCreateResponse {
*/
metadata?: unknown;

/**
* Add optional dynamic variables in key value pairs of string that injects into
* your Retell LLM prompt and tool description. Only applicable for Retell LLM.
*/
retell_llm_dynamic_variables?: Record<string, unknown>;

/**
* The callee number. This field is storage purpose only, set this if you want the
* call object to contain it so that it's easier to reference it. Not used for
Expand Down Expand Up @@ -345,6 +357,12 @@ export interface CallRegisterResponse {
*/
metadata?: unknown;

/**
* Add optional dynamic variables in key value pairs of string that injects into
* your Retell LLM prompt and tool description. Only applicable for Retell LLM.
*/
retell_llm_dynamic_variables?: Record<string, unknown>;

/**
* The callee number. This field is storage purpose only, set this if you want the
* call object to contain it so that it's easier to reference it. Not used for
Expand All @@ -358,26 +376,27 @@ export interface CallCreateParams {
phone_number: CallCreateParams.PhoneNumber;

/**
* Unique id of agent used for the call. Your agent would contain the LLM Websocket
* url used for this call.
* For this particular call, override the agent used with this agent id. This does
* not bind the agent to this number, this is for one time override.
*/
override_agent_id?: string;

/**
* Add optional dynamic variables that injects into your Retell LLM prompt.
* Add optional dynamic variables in key value pairs of string that injects into
* your Retell LLM prompt and tool description. Only applicable for Retell LLM.
*/
retell_llm_dynamic_variables?: Record<string, unknown>;
}

export namespace CallCreateParams {
export interface PhoneNumber {
/**
* From a number you own
* The number you own in BCP 47 format.
*/
from: string;

/**
* To your customer number
* The number you want to call, in BCP 47 format.
*/
to: string;
}
Expand Down Expand Up @@ -498,7 +517,8 @@ export interface CallRegisterParams {
metadata?: unknown;

/**
* Add optional dynamic variables that injects into your Retell LLM prompt.
* Add optional dynamic variables in key value pairs of string that injects into
* your Retell LLM prompt and tool description. Only applicable for Retell LLM.
*/
retell_llm_dynamic_variables?: Record<string, unknown>;

Expand Down
2 changes: 0 additions & 2 deletions src/resources/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,12 @@ export {
LlmCreateResponse,
LlmRetrieveResponse,
LlmUpdateResponse,
LlmListResponse,
LlmCreateParams,
LlmUpdateParams,
Llm,
} from './llm';
export {
PhoneNumber,
PhoneNumberListResponse,
PhoneNumberCreateParams,
PhoneNumberUpdateParams,
PhoneNumberResource,
Expand Down
Loading

0 comments on commit 8c76b67

Please sign in to comment.