-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathdataherald_assistant.py
More file actions
39 lines (35 loc) · 1.13 KB
/
dataherald_assistant.py
File metadata and controls
39 lines (35 loc) · 1.13 KB
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
33
34
35
36
37
38
39
from function import Function, Property
from dotenv import load_dotenv
from assistant import AIAssistant
from dataherald import answer_question
load_dotenv()
class DataheraldFunction(Function):
def __init__(self):
super().__init__(
name="dataherald",
description="Answer questions on a given database",
parameters=[
Property(
name="db_name",
description="The database to query, possible values are: RealEstate, SenateStock",
type="string",
required=False,
),
Property(
name="question",
description="The question to answer",
type="string",
required=True,
),
]
)
def function(self, db_name, question):
return answer_question(question, db_name)
if __name__ == "__main__":
assistant = AIAssistant(
instruction="",
model="gpt-3.5-turbo-1106",
functions=[DataheraldFunction()],
use_code_interpreter=True,
)
assistant.chat()