Skip to content

Commit 9e5a207

Browse files
committed
Merge branch 'vocodedev-main'
2 parents 81cbab7 + cfd2eb4 commit 9e5a207

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1214
-385
lines changed

.pre-commit-config.yaml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
repos:
2-
- repo: https://github.com/psf/black
3-
rev: 23.1.0
4-
hooks:
5-
- id: black
6-
- repo: https://github.com/pre-commit/mirrors-mypy
7-
rev: v1.8.0
8-
hooks:
9-
- id: mypy
10-
args: [--ignore-missing-imports, ./]
11-
language: system
12-
pass_filenames: false
13-
stages: [pre-push]
2+
- repo: https://github.com/psf/black
3+
rev: 24.4.2
4+
hooks:
5+
- id: black
6+
- repo: https://github.com/pre-commit/mirrors-mypy
7+
rev: v1.8.0
8+
hooks:
9+
- id: mypy
10+
args: [--ignore-missing-imports, ./]
11+
language: system
12+
pass_filenames: false
13+
stages: [pre-push]

apps/telephony_app/main.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@
7373
account_sid=os.environ["TWILIO_ACCOUNT_SID"],
7474
auth_token=os.environ["TWILIO_AUTH_TOKEN"],
7575
),
76-
logger=logger,
7776
)
7877
],
7978
agent_factory=SpellerAgentFactory(),

contributing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ If you submit a PR, we'd love to feature your contribution on Twitter so please
4040

4141
## Linting and Typechecking
4242

43-
We use [`black`](https://black.readthedocs.io/en/stable/) for linting. If you're using VSCode, code should auto-format automatically. Otherwise, run the following script before pushing:
43+
We use [`black`](https://black.readthedocs.io/en/stable/) for linting. If you're using [VSCode](https://code.visualstudio.com/docs/editor/codebasics#_formatting), code should auto-format automatically. Otherwise, run the following script before pushing:
4444

4545
```
4646
make lint_diff

docs/action-triggers.mdx

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
---
2+
title: "Action Triggers"
3+
description: "Configure Vocode actions to run based on different triggers"
4+
---
5+
6+
# Phrase Triggers
7+
8+
Phrase triggers allow users to more explicitly control the behavior of their agents by configuring actions to run only once a bot has spoken a particular phrase. For example, you can configure an agent to transfer a call to a human agent only after the bot has said "I will transfer now".
9+
10+
## Creating a phrase trigger
11+
12+
You can create a phrase trigger as follows:
13+
14+
```python
15+
from vocode import (
16+
PhraseBasedActionTrigger,
17+
PhraseBasedActionTriggerConfig,
18+
PhraseTrigger,
19+
)
20+
21+
phrase_trigger = PhraseBasedActionTrigger(
22+
config=PhraseBasedActionTriggerConfig(
23+
phrase_triggers=[
24+
PhraseTrigger(
25+
phrase="I will transfer now",
26+
conditions=["phrase_condition_type_contains"],
27+
),
28+
PhraseTrigger(
29+
phrase="You can speak to a human now",
30+
conditions=["phrase_condition_type_contains"],
31+
)
32+
]
33+
)
34+
)
35+
```
36+
37+
In this example, the action that this phrase trigger is attached to will fire only after the bot has spoken a turn that contains "I will transfer now" or "You can speak to a human now".
38+
39+
`"phrase_condition_type_contains"` is the only condition type supported at this time, and does not match case, so in the above example, if the bot said "Okay, you can speak to a human now", the phrase trigger would still fire.
40+
41+
## Configuring your action
42+
43+
```python
44+
from vocode import (
45+
TransferCallActionParams,
46+
TransferCallConfig,
47+
)
48+
49+
vocode_client.agents.update_agent(
50+
actions=[
51+
TransferCallActionParams(
52+
type="action_transfer_call",
53+
config=TransferCallConfig(
54+
transfer_phone_number="<YOUR TRANSFER PHONE NUMBER>",
55+
),
56+
action_trigger=phrase_trigger # from the previous code block
57+
)
58+
]
59+
)
60+
```
61+
62+
# [Default] Function Call Triggers
63+
64+
To switch back to the default behavior, use a `FunctionCallActionTrigger`. These are open ended, meaning the
65+
Agent will decide when to use the action based on its prompting. Note that is is primarily achieved via the [Prompt](/prompts)
66+
but for [External Actions](/external-actions), it is also dependent on the description field.
67+
68+
```python
69+
from vocode import FunctionCallActionTrigger
70+
71+
function_trigger = FunctionCallActionTrigger(config={})
72+
vocode_client.agents.update_agent(
73+
actions=[
74+
TransferCallActionParams(
75+
type="action_transfer_call",
76+
config=TransferCallConfig(
77+
transfer_phone_number="<YOUR TRANSFER PHONE NUMBER>",
78+
),
79+
action_trigger=function_trigger
80+
)
81+
]
82+
)
83+
```

docs/actions.mdx

Lines changed: 221 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,221 @@
1+
---
2+
title: "Actions"
3+
description: "Give your agents the ability to execute actions"
4+
---
5+
6+
Vocode agents can decide to take actions synchronously during calls. There are two ways to configure actions:
7+
8+
1. Phrase Triggers
9+
2. Function Call Triggers (default)
10+
11+
See [Action Triggers](/action-triggers) for information on how to configure triggers. Below is the list of actions that an agent can perform:
12+
13+
#### EndConversation
14+
15+
`EndConversation` allows the agent to end the call, e.g. if the user says "Goodbye!"
16+
17+
<CodeGroup>
18+
19+
```python Python
20+
vocode_client.actions.create_action(
21+
request={
22+
"type": "action_end_conversation",
23+
}
24+
)
25+
```
26+
27+
```typescript TypeScript
28+
const number = await vocode.actions.createAction({
29+
type: "action_end_conversation",
30+
});
31+
```
32+
33+
```bash cURL
34+
curl --request POST \
35+
--url https://api.vocode.dev/v1/actions/create \
36+
--header 'Content-Type: application/json' \
37+
--header 'Authorization: Bearer <API_KEY>'
38+
--data '{
39+
"type": "action_end_conversation"
40+
}'
41+
```
42+
43+
</CodeGroup>
44+
45+
#### DTMF
46+
47+
`DTMF` allows the agent to hit dial tones during a call, e.g. navigating a phone tree
48+
49+
<CodeGroup>
50+
51+
```python Python
52+
vocode_client.actions.create_action(
53+
request={
54+
"type":"action_dtmf",
55+
}
56+
)
57+
```
58+
59+
```typescript TypeScript
60+
const number = await vocode.actions.createAction({
61+
type: "action_dtmf",
62+
});
63+
```
64+
65+
```bash cURL
66+
curl --request POST \
67+
--url https://api.vocode.dev/v1/actions/create \
68+
--header 'Content-Type: application/json' \
69+
--header 'Authorization: Bearer <API_KEY>'
70+
--data '{
71+
"type": "action_dtmf"
72+
}'
73+
```
74+
75+
</CodeGroup>
76+
77+
#### TransferCall
78+
79+
`TransferCall` allows the agent to transfer the call to another phone number
80+
81+
<CodeGroup>
82+
83+
```python Python
84+
vocode_client.actions.create_action(
85+
request={
86+
"type":"action_transfer_call",
87+
"config":{
88+
"phone_number":"11234567890"
89+
}
90+
}
91+
)
92+
```
93+
94+
```typescript TypeScript
95+
const number = await vocode.actions.createAction({
96+
type: "action_transfer_call",
97+
config: {
98+
phoneNumber: "11234567890",
99+
},
100+
});
101+
```
102+
103+
```bash cURL
104+
curl --request POST \
105+
--url https://api.vocode.dev/v1/actions/create \
106+
--header 'Content-Type: application/json' \
107+
--header 'Authorization: Bearer <API_KEY>'
108+
--data '{
109+
"type": "action_transfer_call",
110+
"config": {
111+
"phone_number": "11234567890"
112+
}
113+
}'
114+
```
115+
116+
</CodeGroup>
117+
118+
You can attach these as IDs to your phone number agent as follows:
119+
120+
<CodeGroup>
121+
122+
```python Python
123+
from vocode import AgentUpdateParams
124+
125+
vocode_client.numbers.update_number(
126+
phone_number="11234567890",
127+
inbound_agent=AgentUpdateParams(
128+
actions=["<ACTION UUID>"]
129+
)
130+
)
131+
```
132+
133+
```typescript TypeScript
134+
vocode.numbers.updateNumber({
135+
phoneNumber: "11234567890",
136+
inboundAgent: {
137+
actions: ["<ACTION UUID>"],
138+
},
139+
});
140+
```
141+
142+
```bash cURL
143+
curl --request POST \
144+
--url https://api.vocode.dev/v1/numbers/update?phone_number=11234567890 \
145+
--header 'Content-Type: application/json' \
146+
--header 'Authorization: Bearer <API_KEY>'
147+
--data '{
148+
"inbound_agent": {
149+
"actions": ["<ACTION UUID>"]
150+
}
151+
}'
152+
```
153+
154+
</CodeGroup>
155+
156+
You can also add these as actions as raw payloads as follows:
157+
158+
<CodeGroup>
159+
160+
```python Python
161+
from vocode import AgentUpdateParams, TransferCallActionUpdateParams
162+
163+
vocode_client.numbers.update_number(
164+
phone_number="11234567890",
165+
inbound_agent=AgentUpdateParams(
166+
actions=[TransferCallActionUpdateParams(
167+
type="action_transfer_call",
168+
config={
169+
"phone_number":"11234567890"
170+
}
171+
)]
172+
)
173+
)
174+
```
175+
176+
```typescript TypeScript
177+
vocode.numbers.updateNumber({
178+
phoneNumber: "11234567890",
179+
inboundAgent: {
180+
actions: [
181+
{
182+
type: "action_transfer_call",
183+
config: {
184+
phoneNumber: "11234567890",
185+
},
186+
},
187+
],
188+
},
189+
});
190+
```
191+
192+
```bash cURL
193+
curl --request POST \
194+
--url https://api.vocode.dev/v1/numbers/update?phone_number=11234567890 \
195+
--header 'Content-Type: application/json' \
196+
--header 'Authorization: Bearer <API_KEY>'
197+
--data '{
198+
"inbound_agent": {
199+
"actions": [{
200+
"type": "action_transfer_call",
201+
"config": {
202+
"phone_number": "11234567890"
203+
}
204+
}]
205+
}
206+
}'
207+
```
208+
209+
</CodeGroup>
210+
211+
#### [Beta] ExternalAction
212+
213+
`ExternalAction` allows your agent communicate with an External API and include the response as context in the conversation.
214+
215+
See [External Actions](/external-actions).
216+
217+
#### [Beta] Warm Transfer
218+
219+
Allows your agent to conference in another party into the call.
220+
221+
See [Warm Transfer](/warm-transfer).

docs/agents.mdx

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,34 @@
11
---
22
title: "Agents"
3-
description: "🚧 Under construction"
3+
description: "Powerful AI assistants that you can control"
44
---
55

66
# What are agents
77

8+
Vocode Agents are the core component of the Vocode API. Agents can be deployed to receive
9+
phone calls by attaching them to [Numbers](/numbers). Agents can also be used to make outbound calls
10+
via the `calls/create` endpoint.
11+
12+
At its core, the agent is an amalgamation of everything you need to build powerful AI assistants for
13+
your use cases:
14+
15+
- [Prompts](/prompts) – instructions given to the agent that control its behavior.
16+
- [Voices](/voices) – the synthetic voice given to your agent.
17+
- [Webhooks](/webhooks) – mechanism by which you can subscribe to agent events.
18+
- [Conversational Dials](/conversational-dials) – controls for how the agent communicates, like its interruption sensitivity.
19+
- [Actions](/actions) – tools available to your agent, like endint the conversation or transferring the call.
20+
821
# How to configure an agent
922

10-
# API Schema
23+
Agents can be configured via our [Dashboard](/dashboard) or via API. As with all of our API objects, Agents have
24+
`list`, `get`, `create`, and `update` endpoints that allow you to manipulate them as you see fit.
25+
26+
In addition to the other API objects enumerated above, agents have other reference fields that can be used to control
27+
agent behavior:
28+
29+
- `language` sets the agent language (for more context see [Multilingual Agents](/multilingual))
30+
- `initial_message` controls the agents first utterance.
31+
- `initial_message_delay` adds a delay to the initial message from when the call begins
32+
- `ask_if_human_present_on_idle` allows the agent to speak when there is more than 4s of silence on the call
33+
- `llm_temperature` controls the behavior of the underlying language model. Values can range from 0 to 1, with higher
34+
values leading to more diverse and creative results. Lower values generate more consistent outputs.

docs/call-object.mdx

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)