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 28aa126 commit 9c66392
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 522 deletions.
15 changes: 6 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
Expand All @@ -65,7 +62,7 @@ a subclass of `APIError` will be thrown:
<!-- prettier-ignore -->
```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) {
Expand Down Expand Up @@ -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
Expand Down
10 changes: 4 additions & 6 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,14 @@ Methods:

Types:

- <code><a href="./src/resources/agent.ts">AgentCreateResponse</a></code>
- <code><a href="./src/resources/agent.ts">AgentRetrieveResponse</a></code>
- <code><a href="./src/resources/agent.ts">AgentUpdateResponse</a></code>
- <code><a href="./src/resources/agent.ts">Agent</a></code>
- <code><a href="./src/resources/agent.ts">AgentListResponse</a></code>

Methods:

- <code title="post /create-agent">client.agent.<a href="./src/resources/agent.ts">create</a>({ ...params }) -> AgentCreateResponse</code>
- <code title="get /get-agent/{agent_id}">client.agent.<a href="./src/resources/agent.ts">retrieve</a>(agentId) -> AgentRetrieveResponse</code>
- <code title="patch /update-agent/{agent_id}">client.agent.<a href="./src/resources/agent.ts">update</a>(agentId, { ...params }) -> AgentUpdateResponse</code>
- <code title="post /create-agent">client.agent.<a href="./src/resources/agent.ts">create</a>({ ...params }) -> Agent</code>
- <code title="get /get-agent/{agent_id}">client.agent.<a href="./src/resources/agent.ts">retrieve</a>(agentId) -> Agent</code>
- <code title="patch /update-agent/{agent_id}">client.agent.<a href="./src/resources/agent.ts">update</a>(agentId, { ...params }) -> Agent</code>
- <code title="get /list-agents">client.agent.<a href="./src/resources/agent.ts">list</a>() -> AgentListResponse</code>
- <code title="delete /delete-agent/{agent_id}">client.agent.<a href="./src/resources/agent.ts">delete</a>(agentId) -> void</code>

Expand Down
6 changes: 2 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
Expand Down
Loading

0 comments on commit 9c66392

Please sign in to comment.