-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathrun.py
More file actions
32 lines (27 loc) · 952 Bytes
/
run.py
File metadata and controls
32 lines (27 loc) · 952 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from ai21 import AI21Client
client = AI21Client()
def main():
try:
run_result = client.beta.maestro.runs.create_and_poll(
input="Tell me about AI21 Maestro",
requirements=[
{
"name": "length requirement",
"description": "The length of the response should be less than 2000 characters",
},
{
"name": "source requirement",
"description": (
"Should rely on information from these websites: "
"https://www.ai21.com/, https://www.ai21.com/maestro/, "
"https://docs.ai21.com/home"
),
},
],
include=["requirements_result"],
)
print(run_result)
except TimeoutError:
print("The run timed out")
if __name__ == "__main__":
main()