Skip to content

Commit

Permalink
Copy edits for Jupyternaut messages (#439)
Browse files Browse the repository at this point in the history
* Copy edits for Jupyternaut messages

* Revert "Copy edits for Jupyternaut messages"

This reverts commit f24bb76.

* Revert "Revert "Copy edits for Jupyternaut messages""

This reverts commit 278e051.

* Update packages/jupyter-ai/jupyter_ai/chat_handlers/learn.py

Co-authored-by: Piyush Jain <[email protected]>

---------

Co-authored-by: Piyush Jain <[email protected]>
  • Loading branch information
JasonWeill and 3coins authored Nov 13, 2023
1 parent 531aced commit a39480a
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions packages/jupyter-ai/jupyter_ai/chat_handlers/learn.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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 starting your message with **/ask**."""
self.reply(message)

def create(
Expand Down

0 comments on commit a39480a

Please sign in to comment.