GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Support squads in start (#8) · VapiAI/client-sdk-python@b00183e

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • vapi_python
    • vapi_python.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎vapi_python/vapi_python.py‎

Copy file name to clipboardExpand all lines: vapi_python/vapi_python.py
+20-6Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
CHANNELS = 1
77

88

9-
def create_web_call(api_url, api_key, assistant):
9+
def create_web_call(api_url, api_key, payload):
1010
url = f"{api_url}/call/web"
1111
headers = {
1212
'Authorization': 'Bearer ' + api_key,
1313
'Content-Type': 'application/json'
1414
}
15-
response = requests.post(url, headers=headers, json=assistant)
15+
response = requests.post(url, headers=headers, json=payload)
1616
data = response.json()
1717
if response.status_code == 201:
1818
call_id = data.get('id')
@@ -27,15 +27,29 @@ 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, assistant_overrides=None):
30+
def start(
31+
self,
32+
*,
33+
assistant_id=None,
34+
assistant=None,
35+
assistant_overrides=None,
36+
squad_id=None,
37+
squad=None,
38+
):
3139
# Start a new call
3240
if assistant_id:
33-
assistant = {'assistantId': assistant_id, 'assistantOverrides': assistant_overrides}
41+
payload = {'assistantId': assistant_id, 'assistantOverrides': assistant_overrides}
3442
elif assistant:
35-
assistant = {'assistant': assistant, 'assistantOverrides': assistant_overrides}
43+
payload = {'assistant': assistant, 'assistantOverrides': assistant_overrides}
44+
elif squad_id:
45+
payload = {'squadId': squad_id}
46+
elif squad:
47+
payload = {'squad': squad}
48+
else:
49+
raise Exception("Error: No assistant specified.")
3650

3751
call_id, web_call_url = create_web_call(
38-
self.api_url, self.api_key, assistant)
52+
self.api_url, self.api_key, payload)
3953

4054
if not web_call_url:
4155
raise Exception("Error: Unable to create call.")

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.