-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathalgorithm_tester.py
More file actions
77 lines (60 loc) · 2.03 KB
/
Copy pathalgorithm_tester.py
File metadata and controls
77 lines (60 loc) · 2.03 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/env python
# coding: utf-8
# In[5]:
# Algorithm Tester Developed by Hector Orozco
from openai import OpenAI
# 3 Inference Algorithms Developed by Hector Orozco
from chain_of_thought import run_cot
from self_consistency import run_scy
from tree_of_thought import run_tot
# 3 Inference Algorithms Developed by Melissa Diaz Paniagua
from react import run_react
from decomposition import run_decomp
from tool_augmented import run_tool_augmented
# 3 Inference Algorithms Developed by Bharath Gowda
from self_refine import run_self_refine
from analogical_reasoning import run_analogical
from self_debug import run_self_debug
# In[7]:
def run_menu():
# Asks user for first question on startup
quest=input("Enter your question: ").strip()
# Inference algorithm selections
algo={
"1": ("Chain of Thought",run_cot),
"2": ("Self-Consistency",run_scy),
"3": ("Tree of Thought",run_tot),
"4": ("ReACT",run_react),
"5": ("Decomposition",run_decomp),
"6": ("Tool-Augmented Reasoning",run_tool_augmented),
"7": ("Self-Refine",run_self_refine),
"8": ("Analogical Reasoning",run_analogical),
"9": ("Self-Debug",run_self_debug)
}
while True:
print("\nAvailable inference algorithms: ")
for key,(name,_)in algo.items():
print(f"{key},{name}")
print("c. Change question")
print("q. Quit")
select=input("\nSelect one of the following options: ").strip().lower()
# Quit menu
if select=="q":
print("Exiting tester...")
break
# Changes question
if select=="c":
quest=input("\nEnter a new question: ").strip()
continue
# Not valid option
if select not in algo:
print("Invalid selection, try again please...")
continue
# Running...
name,func=algo[select]
print(f"\nCurrently Running: {name}\n")
print(func(quest))
# In[11]:
# Starts up the menu for user
run_menu()
# In[ ]: