From e4d70e355ee93a338c1d14bd4b6110492789e758 Mon Sep 17 00:00:00 2001 From: Jason Weill Date: Mon, 6 Nov 2023 16:38:38 -0800 Subject: [PATCH 1/4] Copy edits for Jupyternaut messages --- .../jupyter_ai/chat_handlers/learn.py | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/packages/jupyter-ai/jupyter_ai/chat_handlers/learn.py b/packages/jupyter-ai/jupyter_ai/chat_handlers/learn.py index b93685c0e..5fef20d33 100644 --- a/packages/jupyter-ai/jupyter_ai/chat_handlers/learn.py +++ b/packages/jupyter-ai/jupyter_ai/chat_handlers/learn.py @@ -82,7 +82,8 @@ async def process_message(self, message: HumanChatMessage): em_provider_cls, em_provider_args = self.get_embedding_provider() if not em_provider_cls: self.reply( - "Sorry, please select an embedding provider before using the `/learn` command." + "Please select an embedding provider in the chat settings, " + "then run your **/learn** command again." ) return @@ -121,17 +122,18 @@ async def process_message(self, message: HumanChatMessage): ) self.save() - response = f"""🎉 I have learned documents at **{load_path}** and I am ready to answer questions about them. - You can ask questions about these docs by prefixing your message with **/ask**.""" + response = f"""🎉 I have learned from documents at **{load_path}** and + I am ready to answer questions about them. You can ask questions about these + documents by starting your message with **/ask**.""" self.reply(response, message) def _build_list_response(self): if not self.metadata.dirs: - return "There are no docs that have been learned yet." + return "I haven't learned from any documents yet." dirs = [dir.path for dir in self.metadata.dirs] dir_list = "\n- " + "\n- ".join(dirs) + "\n\n" - message = f"""I can answer questions from docs in these directories: + message = f"""I can answer questions about documents in these directories: {dir_list}""" return message @@ -198,10 +200,10 @@ async def delete_and_relearn(self): self.log.info( f"Switching embedding provider from {prev_em_id} to {curr_em_id}." ) - message = f"""🔔 Hi there, it seems like you have updated the embeddings + message = f"""🔔 Hi there! It seems like you have changed the embedding model from `{prev_em_id}` to `{curr_em_id}`. I have to re-learn the - documents you had previously submitted for learning. Please wait to use - the **/ask** command until I am done with this task.""" + documents you had previously submitted for learning. Please wait + until I am done with this task before you use the **/ask** command.""" self.reply(message) @@ -236,9 +238,9 @@ async def relearn(self, metadata: IndexMetadata): dir_list = ( "\n- " + "\n- ".join([dir.path for dir in self.metadata.dirs]) + "\n\n" ) - message = f"""🎉 I am done learning docs in these directories: + message = f"""🎉 I am done learning about documents in these directories: {dir_list} I am ready to answer questions about them. - You can ask questions about these docs by prefixing your message with **/ask**.""" + You can ask me about these documents by prefixing your message with **/ask**.""" self.reply(message) def create( From 7145be54a7edbaf36ea45477462c415fb6bcd0bd Mon Sep 17 00:00:00 2001 From: Jason Weill Date: Mon, 6 Nov 2023 16:40:09 -0800 Subject: [PATCH 2/4] Revert "Copy edits for Jupyternaut messages" This reverts commit f24bb76d8dfb1793b84fdb7b2bf734e958327af0. --- .../jupyter_ai/chat_handlers/learn.py | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/packages/jupyter-ai/jupyter_ai/chat_handlers/learn.py b/packages/jupyter-ai/jupyter_ai/chat_handlers/learn.py index 5fef20d33..b93685c0e 100644 --- a/packages/jupyter-ai/jupyter_ai/chat_handlers/learn.py +++ b/packages/jupyter-ai/jupyter_ai/chat_handlers/learn.py @@ -82,8 +82,7 @@ async def process_message(self, message: HumanChatMessage): em_provider_cls, em_provider_args = self.get_embedding_provider() if not em_provider_cls: self.reply( - "Please select an embedding provider in the chat settings, " - "then run your **/learn** command again." + "Sorry, please select an embedding provider before using the `/learn` command." ) return @@ -122,18 +121,17 @@ async def process_message(self, message: HumanChatMessage): ) self.save() - response = f"""🎉 I have learned from documents at **{load_path}** and - I am ready to answer questions about them. You can ask questions about these - documents by starting your message with **/ask**.""" + response = f"""🎉 I have learned documents at **{load_path}** and I am ready to answer questions about them. + You can ask questions about these docs by prefixing your message with **/ask**.""" self.reply(response, message) def _build_list_response(self): if not self.metadata.dirs: - return "I haven't learned from any documents yet." + return "There are no docs that have been learned yet." dirs = [dir.path for dir in self.metadata.dirs] dir_list = "\n- " + "\n- ".join(dirs) + "\n\n" - message = f"""I can answer questions about documents in these directories: + message = f"""I can answer questions from docs in these directories: {dir_list}""" return message @@ -200,10 +198,10 @@ async def delete_and_relearn(self): self.log.info( f"Switching embedding provider from {prev_em_id} to {curr_em_id}." ) - message = f"""🔔 Hi there! It seems like you have changed the embedding + message = f"""🔔 Hi there, it seems like you have updated the embeddings model from `{prev_em_id}` to `{curr_em_id}`. I have to re-learn the - documents you had previously submitted for learning. Please wait - until I am done with this task before you use the **/ask** command.""" + documents you had previously submitted for learning. Please wait to use + the **/ask** command until I am done with this task.""" self.reply(message) @@ -238,9 +236,9 @@ async def relearn(self, metadata: IndexMetadata): dir_list = ( "\n- " + "\n- ".join([dir.path for dir in self.metadata.dirs]) + "\n\n" ) - message = f"""🎉 I am done learning about documents in these directories: + message = f"""🎉 I am done learning docs in these directories: {dir_list} I am ready to answer questions about them. - You can ask me about these documents by prefixing your message with **/ask**.""" + You can ask questions about these docs by prefixing your message with **/ask**.""" self.reply(message) def create( From 75a16991e1059dbcaeabcc784849c0cdda325575 Mon Sep 17 00:00:00 2001 From: Jason Weill Date: Mon, 6 Nov 2023 16:40:48 -0800 Subject: [PATCH 3/4] Revert "Revert "Copy edits for Jupyternaut messages"" This reverts commit 278e051a73e6037e1e829f165f893a2c9d8fea74. --- .../jupyter_ai/chat_handlers/learn.py | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/packages/jupyter-ai/jupyter_ai/chat_handlers/learn.py b/packages/jupyter-ai/jupyter_ai/chat_handlers/learn.py index b93685c0e..5fef20d33 100644 --- a/packages/jupyter-ai/jupyter_ai/chat_handlers/learn.py +++ b/packages/jupyter-ai/jupyter_ai/chat_handlers/learn.py @@ -82,7 +82,8 @@ async def process_message(self, message: HumanChatMessage): em_provider_cls, em_provider_args = self.get_embedding_provider() if not em_provider_cls: self.reply( - "Sorry, please select an embedding provider before using the `/learn` command." + "Please select an embedding provider in the chat settings, " + "then run your **/learn** command again." ) return @@ -121,17 +122,18 @@ async def process_message(self, message: HumanChatMessage): ) self.save() - response = f"""🎉 I have learned documents at **{load_path}** and I am ready to answer questions about them. - You can ask questions about these docs by prefixing your message with **/ask**.""" + response = f"""🎉 I have learned from documents at **{load_path}** and + I am ready to answer questions about them. You can ask questions about these + documents by starting your message with **/ask**.""" self.reply(response, message) def _build_list_response(self): if not self.metadata.dirs: - return "There are no docs that have been learned yet." + return "I haven't learned from any documents yet." dirs = [dir.path for dir in self.metadata.dirs] dir_list = "\n- " + "\n- ".join(dirs) + "\n\n" - message = f"""I can answer questions from docs in these directories: + message = f"""I can answer questions about documents in these directories: {dir_list}""" return message @@ -198,10 +200,10 @@ async def delete_and_relearn(self): self.log.info( f"Switching embedding provider from {prev_em_id} to {curr_em_id}." ) - message = f"""🔔 Hi there, it seems like you have updated the embeddings + message = f"""🔔 Hi there! It seems like you have changed the embedding model from `{prev_em_id}` to `{curr_em_id}`. I have to re-learn the - documents you had previously submitted for learning. Please wait to use - the **/ask** command until I am done with this task.""" + documents you had previously submitted for learning. Please wait + until I am done with this task before you use the **/ask** command.""" self.reply(message) @@ -236,9 +238,9 @@ async def relearn(self, metadata: IndexMetadata): dir_list = ( "\n- " + "\n- ".join([dir.path for dir in self.metadata.dirs]) + "\n\n" ) - message = f"""🎉 I am done learning docs in these directories: + message = f"""🎉 I am done learning about documents in these directories: {dir_list} I am ready to answer questions about them. - You can ask questions about these docs by prefixing your message with **/ask**.""" + You can ask me about these documents by prefixing your message with **/ask**.""" self.reply(message) def create( From 3875e291e1b1c634831103c44e2f23aef842764e Mon Sep 17 00:00:00 2001 From: Jason Weill <93281816+JasonWeill@users.noreply.github.com> Date: Wed, 8 Nov 2023 13:50:53 -0800 Subject: [PATCH 4/4] Update packages/jupyter-ai/jupyter_ai/chat_handlers/learn.py Co-authored-by: Piyush Jain --- packages/jupyter-ai/jupyter_ai/chat_handlers/learn.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/jupyter-ai/jupyter_ai/chat_handlers/learn.py b/packages/jupyter-ai/jupyter_ai/chat_handlers/learn.py index 5fef20d33..40cae643b 100644 --- a/packages/jupyter-ai/jupyter_ai/chat_handlers/learn.py +++ b/packages/jupyter-ai/jupyter_ai/chat_handlers/learn.py @@ -240,7 +240,7 @@ async def relearn(self, metadata: IndexMetadata): ) message = f"""🎉 I am done learning about documents in these directories: {dir_list} I am ready to answer questions about them. - You can ask me about these documents by prefixing your message with **/ask**.""" + You can ask me about these documents by starting your message with **/ask**.""" self.reply(message) def create(