Skip to content

Commit

Permalink
Merge branch 'vocodedev:main' into elevenlabs_mulaw_streaming
Browse files Browse the repository at this point in the history
  • Loading branch information
skirdey authored Dec 1, 2023
2 parents 3061cfd + 8827d86 commit a4fe2a5
Show file tree
Hide file tree
Showing 9 changed files with 499 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
openapi: post /v1/account_connections/create
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
openapi: get /v1/account_connections
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
openapi: get /v1/account_connections/list
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
openapi: post /v1/account_connections/update
---
3 changes: 3 additions & 0 deletions docs/api-reference/numbers/link-number.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
openapi: post /v1/numbers/link
---
90 changes: 90 additions & 0 deletions docs/bring-your-own-openai.mdx
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!
70 changes: 70 additions & 0 deletions docs/bring-your-own-telephony.mdx
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'
}
}
```
22 changes: 17 additions & 5 deletions docs/mint.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,19 @@
"navigation": [
{
"group": "Getting Started",
"pages": ["welcome", "hosted-quickstart", "open-source-quickstart"]
"pages": [
"welcome",
"hosted-quickstart",
"open-source-quickstart"
]
},
{
"group": "Vocode 101",
"pages": ["what-is-vocode", "how-it-works", "how-to-use-it"]
"pages": [
"what-is-vocode",
"how-it-works",
"how-to-use-it"
]
},
{
"group": "Guides",
Expand Down Expand Up @@ -105,7 +113,9 @@
},
{
"group": "Usage",
"pages": ["api-reference/usage/get-usage"]
"pages": [
"api-reference/usage/get-usage"
]
},
{
"group": "Actions",
Expand Down Expand Up @@ -175,7 +185,9 @@
"machine-detection",
"ivr-navigation",
"hipaa-compliance",
"do-not-call-detection"
"do-not-call-detection",
"bring-your-own-telephony",
"bring-your-own-openai"
]
}
],
Expand All @@ -188,4 +200,4 @@
"twitter": "https://twitter.com/vocodehq",
"website": "https://www.vocode.dev/"
}
}
}
Loading

0 comments on commit a4fe2a5

Please sign in to comment.