-
Notifications
You must be signed in to change notification settings - Fork 512
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'vocodedev:main' into elevenlabs_mulaw_streaming
- Loading branch information
Showing
9 changed files
with
499 additions
and
15 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
docs/api-reference/account_connections/create-account-connection.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
openapi: post /v1/account_connections/create | ||
--- |
3 changes: 3 additions & 0 deletions
3
docs/api-reference/account_connections/get-account-connection.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
openapi: get /v1/account_connections | ||
--- |
3 changes: 3 additions & 0 deletions
3
docs/api-reference/account_connections/list-account-connections.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
openapi: get /v1/account_connections/list | ||
--- |
3 changes: 3 additions & 0 deletions
3
docs/api-reference/account_connections/update-account-connection.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
openapi: post /v1/account_connections/update | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
openapi: post /v1/numbers/link | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
--- | ||
title: "[Enterprise] Bring Your Own OpenAI API Keys" | ||
description: "Use your own OpenAI keys and models with Vocode" | ||
--- | ||
|
||
You can connect your own OpenAI account with Vocode. With your own OpenAI account, you can use your own OpenAI models including custom, fine-tuned models! | ||
|
||
***NOTE:** This feature is only enabled for users on an Enterprise plan.* | ||
|
||
## Step 1: Add an OpenAI account connection | ||
|
||
Vocode uses account connections to manage your account parameters and associate them with phone numbers and calls. You can add multiple account connections if you have multiple OpenAI accounts you would like to integrate. You can quickly add an account connection [via our API](https://api.vocode.dev/docs#/account_connections/create_account_connection) by providing an OpenAI API key. | ||
|
||
|
||
```python | ||
from vocode.client import Vocode | ||
|
||
vocode_client.account_connections.create_account_connection( | ||
request={ | ||
"type": "account_connection_openai", | ||
"credentials": { | ||
"openai_api_key": "YOUR_OPENAI_API_KEY", | ||
}, | ||
} | ||
) | ||
``` | ||
|
||
`create_account_connection` will return the parameters for your new account connection, including an `id`, which is necessary for the following steps. | ||
|
||
## Step 2: Use the OpenAI account connection with your agent | ||
|
||
To use the new account connection with your calls, you need to configure your agents with the account connection. You can do so when you create a new agent or update an existing agent via the `openai_account_connection` parameter. | ||
|
||
<CodeGroup> | ||
```python Create Agent | ||
vocode_client.agents.create_agent( | ||
voice="...", | ||
prompt={ | ||
"content": "...", | ||
}, | ||
openai_account_connection="YOUR_ACCOUNT_CONNECTION_ID", | ||
) | ||
``` | ||
|
||
```python Update Agent | ||
from vocode import AgentUpdateParams | ||
|
||
vocode_client.agents.update_agent( | ||
id="YOUR_AGENT_ID", | ||
request=AgentUpdateParams( | ||
openai_account_connection="YOUR_ACCOUNT_CONNECTION_ID", | ||
), | ||
) | ||
``` | ||
</CodeGroup> | ||
|
||
Any calls with this agent will now use your OpenAI account. | ||
|
||
### Use your own OpenAI models | ||
|
||
You can add your own OpenAI models to your agents using the `openai_model_name_override` parameter when creating or updating your agents. These models can be the base OpenAI models (e.g. gpt-3.5-turbo-1106, gpt-4) or your own fine-tuned models. | ||
|
||
***NOTE:** A model name override can only be used if you add your own OpenAI account connection to the agent. Model overrides do not work when using Vocode's OpenAI system.* | ||
|
||
<CodeGroup> | ||
```python Create Agent | ||
vocode_client.agents.create_agent( | ||
voice="...", | ||
prompt={ | ||
"content": "...", | ||
}, | ||
openai_account_connection="YOUR_ACCOUNT_CONNECTION_ID", | ||
openai_model_name_override="ft:your_ft_model_name" | ||
) | ||
``` | ||
|
||
```python Update Agent | ||
from vocode import AgentUpdateParams | ||
|
||
vocode_client.agents.update_agent( | ||
id="YOUR_AGENT_ID", | ||
request=AgentUpdateParams( | ||
openai_account_connection="YOUR_ACCOUNT_CONNECTION_ID", # if not already updated | ||
openai_model_name_override="gpt-4-1106-preview" | ||
), | ||
) | ||
``` | ||
</CodeGroup> | ||
|
||
Now, your Vocode calls with this agent will use your own OpenAI account and your own OpenAI models! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
--- | ||
title: "[Enterprise] Bring Your Own Telephony" | ||
description: "Use your own Twilio account and phone numbers with Vocode" | ||
--- | ||
|
||
You can connect your own external Twilio accounts with Vocode, enabling you to send and receive calls on your own phone numbers and store recordings in your Twilio account. | ||
|
||
***NOTE:** This feature is only enabled for users on an Enterprise plan.* | ||
|
||
## Step 1: Add a Twilio account connection | ||
|
||
Vocode uses account connections to manage your account parameters and associate them with phone numbers and calls. You can add multiple account connections if you have multiple Twilio accounts you would like to integrate. You can quickly add an account connection [via our API](https://api.vocode.dev/docs#/account_connections/create_account_connection) by providing your account SID and an auth token. | ||
|
||
|
||
```python | ||
from vocode.client import Vocode | ||
|
||
vocode_client.account_connections.create_account_connection( | ||
request={ | ||
"type": "account_connection_twilio", | ||
"credentials": { | ||
"twilio_account_sid": "YOUR_ACCOUNT_SID", | ||
"twilio_auth_token": "YOUR_AUTH_TOKEN", | ||
}, | ||
} | ||
) | ||
``` | ||
|
||
`create_account_connection` will return the parameters for your new account connection, including an `id`, which is necessary for the following steps. | ||
|
||
## Step 2: Link existing Twilio numbers to Vocode | ||
|
||
Vocode now can make calls with your Twilio account, but our system needs to know which numbers to configure and use. We provide the `/v1/numbers/link` [endpoint](https://api.vocode.dev/docs#/numbers/link_number) to add these numbers to our system. You simply need to provide the phone number, your account connection id, and whether or not the phone number should be outbound only. | ||
|
||
```python Python | ||
vocode_client.numbers.link_number( | ||
phone_number="1234567890", | ||
telephony_account_connection="YOUR_ACCOUNT_CONNECTION_ID", | ||
outbound_only=True | ||
) | ||
``` | ||
|
||
You can now use this phone number for outbound calls (and inbound if you have it configured). | ||
|
||
|
||
## Step 3: View your call objects | ||
|
||
After making a call with your newly added number, you can see two new fields in your call object: | ||
- **Telephony Account Connection:** The account connection object associated with the call | ||
- **Telephony ID:** The Twilio call SID corresponding to the Vocode call | ||
|
||
```json | ||
{ | ||
id: 'call_id', | ||
userId: 'user_id', | ||
toNumber: '123456789', | ||
fromNumber: '123456789', | ||
... | ||
telephonyId: 'telephony_id', | ||
telephonyAccountConnection: { | ||
'id': 'account_connection_id', | ||
'user_id': 'user_id', | ||
'credentials': { | ||
'twilio_account_sid': 'YOUR_TWILIO_ACCOUNT_SID', | ||
'twilio_auth_token': 'YOUR_TWILIO_AUTH_TOKEN' | ||
}, | ||
'type': 'account_connection_twilio' | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.