Skip to content

Commit 75dde1e

Browse files
committed
Update Python SDK to support assistant overrides
1 parent 774cdca commit 75dde1e

File tree

4 files changed

+41
-5
lines changed

4 files changed

+41
-5
lines changed

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,24 @@ vapi.start(assistant=assistant)
4747

4848
The `start` method will initiate a new call.
4949

50+
You can also override existing assistant parameters or set variables with the `assistant_overrides` parameter:
51+
52+
```python
53+
# Assume the below has already been set for the assistant with ID 'your-assistant-id'
54+
assistant = {
55+
'firstMessage': 'Hey, {{name}} how are you?',
56+
}
57+
58+
assistant_overrides = {
59+
"recordingEnabled": False,
60+
"variableValues": {
61+
"name": "John"
62+
}
63+
}
64+
65+
vapi.start(assistant_id='your-assistant-id', assistant_overrides=assistant_overrides)
66+
```
67+
5068
You can stop the session by calling the `stop` method:
5169

5270
```python

README.rst

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,25 @@ or
7575
7676
vapi.start(assistant=assistant)
7777
78-
The `start` method will initiate a new call.
78+
The `start` method will initiate a new call.
79+
80+
You can also override existing assistant parameters or set variables with the `assistant_overrides` parameter:
81+
82+
.. code-block:: python
83+
84+
# Assume the below has already been set for the assistant with ID 'your-assistant-id'
85+
assistant = {
86+
'firstMessage': 'Hey, {{name}} how are you?',
87+
}
88+
89+
assistant_overrides = {
90+
"recordingEnabled": False,
91+
"variableValues": {
92+
"name": "John"
93+
}
94+
}
95+
96+
vapi.start(assistant_id='your-assistant-id', assistant_overrides=assistant_overrides)
7997
8098
You can stop the session by calling the `stop` method:
8199

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,6 @@ def read_requirements(file):
4949
test_suite='tests',
5050
tests_require=test_requirements,
5151
url='https://github.com/jordan.cde/vapi_python',
52-
version='0.1.8',
52+
version='0.1.9',
5353
zip_safe=False,
5454
)

vapi_python/vapi_python.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ def __init__(self, *, api_key, api_url="https://api.vapi.ai"):
2727
self.api_key = api_key
2828
self.api_url = api_url
2929

30-
def start(self, *, assistant_id=None, assistant=None):
30+
def start(self, *, assistant_id=None, assistant=None, assistant_overrides=None):
3131
# Start a new call
3232
if assistant_id:
33-
assistant = {'assistantId': assistant_id}
33+
assistant = {'assistantId': assistant_id, 'assistantOverrides': assistant_overrides}
3434
elif assistant:
35-
assistant = {'assistant': assistant}
35+
assistant = {'assistant': assistant, 'assistantOverrides': assistant_overrides}
3636

3737
call_id, web_call_url = create_web_call(
3838
self.api_url, self.api_key, assistant)

0 commit comments

Comments
 (0)