You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"Welcome to this RAG command-line interface! 🧠", "green", bold=True
34
43
)
35
44
print(
36
-
"Available commands are: config, rag, setK, setModel, setWebrag, exit, help. To learn more about usage of a specific command, use the following: \n help <command>"
45
+
f"\nPress {str_green('Enter', bold=True)} to start asking questions about your documents.\n"
37
46
)
38
47
print(
39
-
f"Available commands:\n\
48
+
f"Other commands:\n\
40
49
{str_green('config')} : see the current config \n\
41
-
{str_green('rag')} : enter the RAG CLI \n\
42
50
{str_green('setK')} : set the number of documents to retrieve \n\
43
51
{str_green('setModel')} : set the model for generation \n\
44
52
{str_green('setWebrag')} : decide whether to use web rag \n\
45
-
{str_green('help')} : learn more about a command \n\
53
+
{str_green('help')} : learn more about a command (help <command>) \n\
46
54
{str_green('exit')} : exit the CLI"
47
55
)
48
-
print_in_color(
49
-
"To learn more about usage of a specific command, use the following: \n help <command>",
50
-
"blue",
51
-
bold=True,
52
-
)
53
56
whileTrue:
54
57
try:
55
58
cmd=input("> ").strip()
@@ -58,7 +61,7 @@ def launch_cli(self):
58
61
break
59
62
elifcmd=="help":
60
63
print(
61
-
"Available commands are: config, rag, setK, setModel, webrag, exit, help. To learn more about usage of a specific command, use the following: \n help <command>"
64
+
f"Press {str_green('Enter')} (or type rag) to start asking questions about your documents.\nOther commands are: config, setK, setModel, setWebrag, exit, help. To learn more about usage of a specific command, use the following: \n help <command>"
62
65
)
63
66
elifcmd.startswith("help "):
64
67
command=cmd.split(" ", 1)[1]
@@ -69,7 +72,9 @@ def launch_cli(self):
69
72
elifcommand=="config":
70
73
print("Print the current configuration.")
71
74
elifcommand=="rag":
72
-
print("Enter the RAG CLI. Type /bye to exit.")
75
+
print(
76
+
"Start a chat session to ask questions about your documents. Type /bye to exit."
77
+
)
73
78
elifcommand=="setK":
74
79
print(
75
80
"Use the command in the following way: 'setK <k>', for a positive integer k. This will set the number of documents to retrieve during RAG."
@@ -147,27 +152,42 @@ def launch_cli(self):
147
152
f"Invalid output. Enter {str_in_color('setWebrag True', 'green')} or {str_in_color('setWebrag False', 'red')}."
148
153
)
149
154
150
-
elifcmd=="rag":
155
+
elifcmdin ("", "rag"):
151
156
self.cli_ception()
152
157
153
158
else:
154
159
print(f"Unknown command: {cmd}")
160
+
if" "incmdorcmd.endswith("?"):
161
+
print(
162
+
f"Looks like a question! Press {str_green('Enter')} first to start asking questions about your documents."
163
+
)
155
164
except (EOFError, KeyboardInterrupt):
156
165
print("\nExiting...")
157
166
break
158
167
159
168
defcli_ception(self):
169
+
self.init_config()
170
+
ifself.ragPPisNoneorself.modified:
171
+
try:
172
+
withSpinner():
173
+
self.initialize_ragpp()
174
+
exceptMilvusExceptionase:
175
+
print_in_color(f"Failed to open the document database: {e}", "red")
176
+
print(
177
+
f"A previous session may still be holding it. Run {str_green('pkill -f milvus_lite/lib/milvus')} and try again."
178
+
)
179
+
return
180
+
self.modified=False
181
+
print_in_color("RAG pipeline ready! Ask your questions.", "green")
160
182
whileTrue:
161
183
query=input(str_in_color("rag (type /bye to exit) > ", "red", bold=True))
162
184
ifquery=="/bye":
163
185
print_in_color("Exiting the RAG CLI", "red", True)
0 commit comments