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
22 changes: 18 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ You can install the package via pip:
pip install vapi_python
```

On Mac, you might need to install `brew install portaudio` to satisfy `pyaudio`'s dependency requirement.
On Mac, you might need to install `brew install portaudio` to satisfy `pyaudio`'s dependency requirement.

## Usage

Expand All @@ -31,7 +31,9 @@ You can start a new call by calling the `start` method and passing an `assistant
```python
vapi.start(assistant_id='your-assistant-id')
```

or

```python
assistant = {
'firstMessage': 'Hey, how are you?',
Expand All @@ -45,7 +47,21 @@ assistant = {
vapi.start(assistant=assistant)
```

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

You can override existing assistant parameters or set variables with the `assistant_overrides` parameter.
Assume the first message is `Hey, {{name}} how are you?` and you want to set the value of `name` to `John`:

```python
assistant_overrides = {
"recordingEnabled": False,
"variableValues": {
"name": "John"
}
}

vapi.start(assistant_id='your-assistant-id', assistant_overrides=assistant_overrides)
```

You can stop the session by calling the `stop` method:

Expand Down Expand Up @@ -80,5 +96,3 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```


16 changes: 15 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,21 @@ or

vapi.start(assistant=assistant)

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

You can override existing assistant parameters or set variables with the `assistant_overrides` parameter.
Assume the first message is `Hey, {{name}} how are you?` and you want to set the value of `name` to `John`:

.. code-block:: python

assistant_overrides = {
"recordingEnabled": False,
"variableValues": {
"name": "John"
}
}

vapi.start(assistant_id='your-assistant-id', assistant_overrides=assistant_overrides)

You can stop the session by calling the `stop` method:

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ def read_requirements(file):
test_suite='tests',
tests_require=test_requirements,
url='https://github.com/jordan.cde/vapi_python',
version='0.1.8',
version='0.1.9',
zip_safe=False,
)
6 changes: 3 additions & 3 deletions vapi_python/vapi_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ def __init__(self, *, api_key, api_url="https://api.vapi.ai"):
self.api_key = api_key
self.api_url = api_url

def start(self, *, assistant_id=None, assistant=None):
def start(self, *, assistant_id=None, assistant=None, assistant_overrides=None):
# Start a new call
if assistant_id:
assistant = {'assistantId': assistant_id}
assistant = {'assistantId': assistant_id, 'assistantOverrides': assistant_overrides}
elif assistant:
assistant = {'assistant': assistant}
assistant = {'assistant': assistant, 'assistantOverrides': assistant_overrides}

call_id, web_call_url = create_web_call(
self.api_url, self.api_key, assistant)
Expand Down