| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,7 +10,7 @@ You can install the package via pip: | |||
| 10 | 10 | pip install vapi_python | |
| 11 | 11 | ``` | |
| 12 | 12 | ||
| 13 | - On Mac, you might need to install `brew install portaudio` to satisfy `pyaudio`'s dependency requirement. | ||
| 13 | + On Mac, you might need to install `brew install portaudio` to satisfy `pyaudio`'s dependency requirement. | ||
| 14 | 14 | ||
| 15 | 15 | ## Usage | |
| 16 | 16 | ||
@@ -31,7 +31,9 @@ You can start a new call by calling the `start` method and passing an `assistant | |||
| 31 | 31 | ```python | |
| 32 | 32 | vapi.start(assistant_id='your-assistant-id') | |
| 33 | 33 | ``` | |
| 34 | + | ||
| 34 | 35 | or | |
| 36 | + | ||
| 35 | 37 | ```python | |
| 36 | 38 | assistant = { | |
| 37 | 39 | 'firstMessage': 'Hey, how are you?', | |
@@ -45,7 +47,21 @@ assistant = { | |||
| 45 | 47 | vapi.start(assistant=assistant) | |
| 46 | 48 | ``` | |
| 47 | 49 | ||
| 48 | - The `start` method will initiate a new call. | ||
| 50 | + The `start` method will initiate a new call. | ||
| 51 | + | ||
| 52 | + You can override existing assistant parameters or set variables with the `assistant_overrides` parameter. | ||
| 53 | + Assume the first message is `Hey, {{name}} how are you?` and you want to set the value of `name` to `John`: | ||
| 54 | + | ||
| 55 | + ```python | ||
| 56 | + assistant_overrides = { | ||
| 57 | + "recordingEnabled": False, | ||
| 58 | + "variableValues": { | ||
| 59 | + "name": "John" | ||
| 60 | + } | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + vapi.start(assistant_id='your-assistant-id', assistant_overrides=assistant_overrides) | ||
| 64 | + ``` | ||
| 49 | 65 | ||
| 50 | 66 | You can stop the session by calling the `stop` method: | |
| 51 | 67 | ||
@@ -80,5 +96,3 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |||
| 80 | 96 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |
| 81 | 97 | SOFTWARE. | |
| 82 | 98 | ``` | |
| 83 | - | ||
| 84 | - | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -75,7 +75,21 @@ or | |||
| 75 | 75 | ||
| 76 | 76 | vapi.start(assistant=assistant) | |
| 77 | 77 | ||
| 78 | - The `start` method will initiate a new call. | ||
| 78 | + The `start` method will initiate a new call. | ||
| 79 | + | ||
| 80 | + You can override existing assistant parameters or set variables with the `assistant_overrides` parameter. | ||
| 81 | + Assume the first message is `Hey, {{name}} how are you?` and you want to set the value of `name` to `John`: | ||
| 82 | + | ||
| 83 | + .. code-block:: python | ||
| 84 | + | ||
| 85 | + assistant_overrides = { | ||
| 86 | + "recordingEnabled": False, | ||
| 87 | + "variableValues": { | ||
| 88 | + "name": "John" | ||
| 89 | + } | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | + vapi.start(assistant_id='your-assistant-id', assistant_overrides=assistant_overrides) | ||
| 79 | 93 | ||
| 80 | 94 | You can stop the session by calling the `stop` method: | |
| 81 | 95 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -49,6 +49,6 @@ def read_requirements(file): | |||
| 49 | 49 | test_suite='tests', | |
| 50 | 50 | tests_require=test_requirements, | |
| 51 | 51 | url='https://github.com/jordan.cde/vapi_python', | |
| 52 | - version='0.1.8', | ||
| 52 | + version='0.1.9', | ||
| 53 | 53 | zip_safe=False, | |
| 54 | 54 | ) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -27,12 +27,12 @@ def __init__(self, *, api_key, api_url="https://api.vapi.ai"): | |||
| 27 | 27 | self.api_key = api_key | |
| 28 | 28 | self.api_url = api_url | |
| 29 | 29 | ||
| 30 | - def start(self, *, assistant_id=None, assistant=None): | ||
| 30 | + def start(self, *, assistant_id=None, assistant=None, assistant_overrides=None): | ||
| 31 | 31 | # Start a new call | |
| 32 | 32 | if assistant_id: | |
| 33 | - assistant = {'assistantId': assistant_id} | ||
| 33 | + assistant = {'assistantId': assistant_id, 'assistantOverrides': assistant_overrides} | ||
| 34 | 34 | elif assistant: | |
| 35 | - assistant = {'assistant': assistant} | ||
| 35 | + assistant = {'assistant': assistant, 'assistantOverrides': assistant_overrides} | ||
| 36 | 36 | ||
| 37 | 37 | call_id, web_call_url = create_web_call( | |
| 38 | 38 | self.api_url, self.api_key, assistant) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments