Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@elevenlabs/elevenlabs-js",
"version": "v2.35.0",
"version": "v2.36.0",
"private": false,
"repository": "github:elevenlabs/elevenlabs-js",
"license": "MIT",
Expand Down
136 changes: 98 additions & 38 deletions reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -1542,7 +1542,7 @@ await client.textToVoice.remix("21m00Tcm4TlvDq8ikWAM", {
</dl>
</details>

## user
## User
<details><summary><code>client.user.<a href="/src/api/resources/user/client/Client.ts">get</a>() -> ElevenLabs.User</code></summary>
<dl>
<dd>
Expand Down Expand Up @@ -2765,7 +2765,7 @@ await client.audioNative.update("21m00Tcm4TlvDq8ikWAM", {});
</dl>
</details>

## usage
## Usage
<details><summary><code>client.usage.<a href="/src/api/resources/usage/client/Client.ts">get</a>({ ...params }) -> ElevenLabs.UsageCharactersResponseModel</code></summary>
<dl>
<dd>
Expand Down Expand Up @@ -2973,7 +2973,7 @@ await client.pronunciationDictionaries.createFromRules({
</dl>
</details>

<details><summary><code>client.pronunciationDictionaries.<a href="/src/api/resources/pronunciationDictionaries/client/Client.ts">get</a>(pronunciation_dictionary_id) -> ElevenLabs.GetPronunciationDictionaryMetadataResponse</code></summary>
<details><summary><code>client.pronunciationDictionaries.<a href="/src/api/resources/pronunciationDictionaries/client/Client.ts">get</a>(pronunciation_dictionary_id) -> ElevenLabs.GetPronunciationDictionaryWithRulesResponseModel</code></summary>
<dl>
<dd>

Expand Down Expand Up @@ -4840,7 +4840,7 @@ await client.conversationalAi.agents.create({
</dl>
</details>

<details><summary><code>client.conversationalAi.agents.<a href="/src/api/resources/conversationalAi/resources/agents/client/Client.ts">get</a>(agent_id) -> ElevenLabs.GetAgentResponseModel</code></summary>
<details><summary><code>client.conversationalAi.agents.<a href="/src/api/resources/conversationalAi/resources/agents/client/Client.ts">get</a>(agent_id, { ...params }) -> ElevenLabs.GetAgentResponseModel</code></summary>
<dl>
<dd>

Expand All @@ -4867,7 +4867,10 @@ Retrieve config for an agent
<dd>

```typescript
await client.conversationalAi.agents.get("agent_3701k3ttaq12ewp8b7qv5rfyszkz");
await client.conversationalAi.agents.get("agent_3701k3ttaq12ewp8b7qv5rfyszkz", {
versionId: "version_id",
branchId: "branch_id"
});

```
</dd>
Expand All @@ -4891,6 +4894,14 @@ await client.conversationalAi.agents.get("agent_3701k3ttaq12ewp8b7qv5rfyszkz");
<dl>
<dd>

**request:** `ElevenLabs.conversationalAi.AgentsGetRequest`

</dd>
</dl>

<dl>
<dd>

**requestOptions:** `AgentsClient.RequestOptions`

</dd>
Expand Down Expand Up @@ -4993,7 +5004,9 @@ Patches an Agent settings
<dd>

```typescript
await client.conversationalAi.agents.update("agent_3701k3ttaq12ewp8b7qv5rfyszkz");
await client.conversationalAi.agents.update("agent_3701k3ttaq12ewp8b7qv5rfyszkz", {
branchId: "branch_id"
});

```
</dd>
Expand Down Expand Up @@ -5413,7 +5426,7 @@ await client.conversationalAi.agents.runTests("agent_3701k3ttaq12ewp8b7qv5rfyszk
</details>

## ConversationalAi Tests
<details><summary><code>client.conversationalAi.tests.<a href="/src/api/resources/conversationalAi/resources/tests/client/Client.ts">create</a>({ ...params }) -> ElevenLabs.CreateUnitTestResponseModel</code></summary>
<details><summary><code>client.conversationalAi.tests.<a href="/src/api/resources/conversationalAi/resources/tests/client/Client.ts">create</a>({ ...params }) -> ElevenLabs.CreateAgentTestResponseModel</code></summary>
<dl>
<dd>

Expand Down Expand Up @@ -5441,19 +5454,7 @@ Creates a new agent response test.

```typescript
await client.conversationalAi.tests.create({
chatHistory: [{
role: "user",
timeInCallSecs: 1
}],
successCondition: "success_condition",
successExamples: [{
response: "response",
type: "success"
}],
failureExamples: [{
response: "response",
type: "failure"
}],
type: "llm",
name: "name"
});

Expand All @@ -5471,7 +5472,7 @@ await client.conversationalAi.tests.create({
<dl>
<dd>

**request:** `ElevenLabs.conversationalAi.CreateUnitTestRequest`
**request:** `ElevenLabs.TestsCreateRequestBody`

</dd>
</dl>
Expand All @@ -5491,7 +5492,7 @@ await client.conversationalAi.tests.create({
</dl>
</details>

<details><summary><code>client.conversationalAi.tests.<a href="/src/api/resources/conversationalAi/resources/tests/client/Client.ts">get</a>(test_id) -> ElevenLabs.GetUnitTestResponseModel</code></summary>
<details><summary><code>client.conversationalAi.tests.<a href="/src/api/resources/conversationalAi/resources/tests/client/Client.ts">get</a>(test_id) -> ElevenLabs.TestsGetResponse</code></summary>
<dl>
<dd>

Expand Down Expand Up @@ -5554,7 +5555,7 @@ await client.conversationalAi.tests.get("TeaqRRdTcIfIu2i7BYfT");
</dl>
</details>

<details><summary><code>client.conversationalAi.tests.<a href="/src/api/resources/conversationalAi/resources/tests/client/Client.ts">update</a>(test_id, { ...params }) -> ElevenLabs.GetUnitTestResponseModel</code></summary>
<details><summary><code>client.conversationalAi.tests.<a href="/src/api/resources/conversationalAi/resources/tests/client/Client.ts">update</a>(test_id, { ...params }) -> ElevenLabs.TestsUpdateResponse</code></summary>
<dl>
<dd>

Expand Down Expand Up @@ -5582,19 +5583,7 @@ Updates an agent response test by ID.

```typescript
await client.conversationalAi.tests.update("TeaqRRdTcIfIu2i7BYfT", {
chatHistory: [{
role: "user",
timeInCallSecs: 1
}],
successCondition: "success_condition",
successExamples: [{
response: "response",
type: "success"
}],
failureExamples: [{
response: "response",
type: "failure"
}],
type: "llm",
name: "name"
});

Expand All @@ -5620,7 +5609,7 @@ await client.conversationalAi.tests.update("TeaqRRdTcIfIu2i7BYfT", {
<dl>
<dd>

**request:** `ElevenLabs.conversationalAi.UpdateUnitTestRequest`
**request:** `ElevenLabs.TestsUpdateRequestBody`

</dd>
</dl>
Expand Down Expand Up @@ -5831,6 +5820,77 @@ await client.conversationalAi.tests.list({
</dl>


</dd>
</dl>
</details>

## ConversationalAi Users
<details><summary><code>client.conversationalAi.users.<a href="/src/api/resources/conversationalAi/resources/users/client/Client.ts">list</a>({ ...params }) -> ElevenLabs.GetConversationUsersPageResponseModel</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

Get distinct users from conversations with pagination.
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.conversationalAi.users.list({
agentId: "agent_id",
callStartBeforeUnix: 1,
callStartAfterUnix: 1,
search: "search",
pageSize: 1,
cursor: "cursor"
});

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**request:** `ElevenLabs.conversationalAi.UsersListRequest`

</dd>
</dl>

<dl>
<dd>

**requestOptions:** `UsersClient.RequestOptions`

</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>
Expand Down Expand Up @@ -10047,7 +10107,7 @@ await client.conversationalAi.knowledgeBase.documents.get("21m00Tcm4TlvDq8ikWAM"
<dl>
<dd>

Delete a document from the knowledge base
Delete a document or folder from the knowledge base.
</dd>
</dl>
</dd>
Expand Down
4 changes: 2 additions & 2 deletions src/BaseClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ export function normalizeClientOptions<T extends BaseClientOptions>(options: T):
{
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@elevenlabs/elevenlabs-js",
"X-Fern-SDK-Version": "v2.35.0",
"User-Agent": "@elevenlabs/elevenlabs-js/v2.35.0",
"X-Fern-SDK-Version": "v2.36.0",
"User-Agent": "@elevenlabs/elevenlabs-js/v2.36.0",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
"xi-api-key": options?.apiKey,
Expand Down
6 changes: 6 additions & 0 deletions src/api/resources/conversationalAi/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { SipTrunkClient } from "../resources/sipTrunk/client/Client";
import { TestsClient } from "../resources/tests/client/Client";
import { ToolsClient } from "../resources/tools/client/Client";
import { TwilioClient } from "../resources/twilio/client/Client";
import { UsersClient } from "../resources/users/client/Client";
import { WhatsappClient } from "../resources/whatsapp/client/Client";
import { WhatsappAccountsClient } from "../resources/whatsappAccounts/client/Client";

Expand All @@ -40,6 +41,7 @@ export class ConversationalAiClient {
protected _whatsapp: WhatsappClient | undefined;
protected _agents: AgentsClient | undefined;
protected _tests: TestsClient | undefined;
protected _users: UsersClient | undefined;
protected _phoneNumbers: PhoneNumbersClient | undefined;
protected _llmUsage: LlmUsageClient | undefined;
protected _knowledgeBase: KnowledgeBaseClient | undefined;
Expand Down Expand Up @@ -77,6 +79,10 @@ export class ConversationalAiClient {
return (this._tests ??= new TestsClient(this._options));
}

public get users(): UsersClient {
return (this._users ??= new UsersClient(this._options));
}

public get phoneNumbers(): PhoneNumbersClient {
return (this._phoneNumbers ??= new PhoneNumbersClient(this._options));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,24 +161,40 @@ export class AgentsClient {
* Retrieve config for an agent
*
* @param {string} agent_id - The id of an agent. This is returned on agent creation.
* @param {ElevenLabs.conversationalAi.AgentsGetRequest} request
* @param {AgentsClient.RequestOptions} requestOptions - Request-specific configuration.
*
* @throws {@link ElevenLabs.UnprocessableEntityError}
*
* @example
* await client.conversationalAi.agents.get("agent_3701k3ttaq12ewp8b7qv5rfyszkz")
* await client.conversationalAi.agents.get("agent_3701k3ttaq12ewp8b7qv5rfyszkz", {
* versionId: "version_id",
* branchId: "branch_id"
* })
*/
public get(
agent_id: string,
request: ElevenLabs.conversationalAi.AgentsGetRequest = {},
requestOptions?: AgentsClient.RequestOptions,
): core.HttpResponsePromise<ElevenLabs.GetAgentResponseModel> {
return core.HttpResponsePromise.fromPromise(this.__get(agent_id, requestOptions));
return core.HttpResponsePromise.fromPromise(this.__get(agent_id, request, requestOptions));
}

private async __get(
agent_id: string,
request: ElevenLabs.conversationalAi.AgentsGetRequest = {},
requestOptions?: AgentsClient.RequestOptions,
): Promise<core.WithRawResponse<ElevenLabs.GetAgentResponseModel>> {
const { versionId, branchId } = request;
const _queryParams: Record<string, string | string[] | object | object[] | null> = {};
if (versionId != null) {
_queryParams.version_id = versionId;
}

if (branchId != null) {
_queryParams.branch_id = branchId;
}

const _headers: core.Fetcher.Args["headers"] = mergeHeaders(
this._options?.headers,
mergeOnlyDefinedHeaders({ "xi-api-key": requestOptions?.apiKey ?? this._options?.apiKey }),
Expand All @@ -193,7 +209,7 @@ export class AgentsClient {
),
method: "GET",
headers: _headers,
queryParameters: requestOptions?.queryParams,
queryParameters: { ..._queryParams, ...requestOptions?.queryParams },
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 240) * 1000,
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
abortSignal: requestOptions?.abortSignal,
Expand Down Expand Up @@ -319,7 +335,9 @@ export class AgentsClient {
* @throws {@link ElevenLabs.UnprocessableEntityError}
*
* @example
* await client.conversationalAi.agents.update("agent_3701k3ttaq12ewp8b7qv5rfyszkz")
* await client.conversationalAi.agents.update("agent_3701k3ttaq12ewp8b7qv5rfyszkz", {
* branchId: "branch_id"
* })
*/
public update(
agent_id: string,
Expand All @@ -334,6 +352,12 @@ export class AgentsClient {
request: ElevenLabs.conversationalAi.UpdateAgentRequest = {},
requestOptions?: AgentsClient.RequestOptions,
): Promise<core.WithRawResponse<ElevenLabs.GetAgentResponseModel>> {
const { branchId, ..._body } = request;
const _queryParams: Record<string, string | string[] | object | object[] | null> = {};
if (branchId != null) {
_queryParams.branch_id = branchId;
}

const _headers: core.Fetcher.Args["headers"] = mergeHeaders(
this._options?.headers,
mergeOnlyDefinedHeaders({ "xi-api-key": requestOptions?.apiKey ?? this._options?.apiKey }),
Expand All @@ -349,9 +373,9 @@ export class AgentsClient {
method: "PATCH",
headers: _headers,
contentType: "application/json",
queryParameters: requestOptions?.queryParams,
queryParameters: { ..._queryParams, ...requestOptions?.queryParams },
requestType: "json",
body: serializers.conversationalAi.UpdateAgentRequest.jsonOrThrow(request, {
body: serializers.conversationalAi.UpdateAgentRequest.jsonOrThrow(_body, {
unrecognizedObjectKeys: "strip",
}),
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 240) * 1000,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// This file was auto-generated by Fern from our API Definition.

/**
* @example
* {
* versionId: "version_id",
* branchId: "branch_id"
* }
*/
export interface AgentsGetRequest {
/** The ID of the agent version to use */
versionId?: string;
/** The ID of the branch to use */
branchId?: string;
}
Loading