-
Notifications
You must be signed in to change notification settings - Fork 1
/
debuger.py
53 lines (40 loc) · 1.66 KB
/
debuger.py
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
from assistant_initialization import assistant
from assistant_initialization import system_prompt
import config
thread_id = config.assistant_thread_id
def display_thread_messages(messages):
for message in messages.data:
role = message.role
content = message.content[0].text.value
print(f"{role.capitalize()}: {content}")
def main(thread_id, system_prompt=system_prompt, user_message="", file_ids=None):
response = assistant.get_assistant_response(
thread_id=thread_id,
instructions=system_prompt,
user_message=user_message,
file_ids=file_ids
)
# -- Print messages
display_thread_messages(response)
if __name__ == '__main__':
# -- Create thread
# thread = assistant.create_thread()
# print(thread)
# -- Delete thread
# thread = assistant.delete_thread(thread_id)
# print(thread)
# -- Retrieve thread messages
# response = assistant._retrieve_thread_messages(thread_id)
# display_thread_messages(response)
# -- Get assistant response
# query = "What is the weather in Lagos?"
query = "What is the cutoff date for your training data, and can you access real-time information?"
# query = "What are breaking changes in Kubernetes v1.25.0"
# query = "What should I consider before upgrading from Kubernetes 1.27 to Kubernetes 1.28?"
# query = "What the latest version of the Kubernetes?"
# query = "What is the weather in Berlin?"
main(thread_id, system_prompt=system_prompt, user_message=query)
# Cancel a run
# assistant.cancel_run(run_id="run_Uz5DCdnR5papdGqrJCRtuX4a", thread_id)
# -- Debug tools schema
# assistant.debug_tools()