Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Base chat handler refactor for custom slash commands #398

Merged
merged 35 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
162815f
Adds attributes, starts adding to subclasses
JasonWeill Sep 21, 2023
abaf3c6
Consistent syntax
JasonWeill Sep 21, 2023
9aa348f
Help for all handlers
JasonWeill Sep 21, 2023
5086b3c
Fix slash ID error
JasonWeill Sep 21, 2023
fd8529f
Iterate through entry points
JasonWeill Sep 21, 2023
9084554
Fix typo in call to select()
JasonWeill Sep 25, 2023
ffbc583
Moves config to magics, modifies extensions to attempt to load classes
JasonWeill Sep 27, 2023
87db726
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 27, 2023
bfde43f
Moves config to proper location, improves error logging
JasonWeill Sep 28, 2023
e5abafe
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 19, 2023
f053e08
WIP: Updates per feedback, adds custom handler
JasonWeill Oct 24, 2023
526366c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 24, 2023
963495b
Removes redundant code, style fixes
JasonWeill Oct 24, 2023
7caf1ef
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 24, 2023
1709d21
Removes unnecessary custom message
JasonWeill Oct 25, 2023
0a6ab9d
Instantiates class
JasonWeill Oct 25, 2023
daecd57
Validates slash ID
JasonWeill Oct 25, 2023
b7b5501
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 25, 2023
a4f33b6
Consistent arguments to chat handlers
JasonWeill Oct 25, 2023
6fcf87e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 25, 2023
178b0be
Refactors to avoid intentionally unused params
JasonWeill Nov 2, 2023
29d4964
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 2, 2023
91a50cb
Updates docs, removes custom handler from source and config
JasonWeill Nov 6, 2023
e04e09b
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 6, 2023
7e4d597
Renames process_message to match base class
JasonWeill Nov 6, 2023
3a031e4
Adds needed parameter that had been deleted
JasonWeill Dec 4, 2023
ffb77a1
Joins lines in contributor doc
JasonWeill Dec 5, 2023
74c6d21
Removes natural language routing type, which is not yet used
JasonWeill Dec 5, 2023
bea1f99
Update docs/source/developers/index.md
JasonWeill Dec 6, 2023
1589146
Update docs/source/developers/index.md
JasonWeill Dec 6, 2023
dedeb6f
Update docs/source/developers/index.md
JasonWeill Dec 6, 2023
7fcaa7b
Revises per @3coins, avoids Latinism
JasonWeill Dec 6, 2023
7c98f4e
Removes Configurable, since we do not yet have configurable traits
JasonWeill Dec 6, 2023
55b3f08
Uses Literal for validation
JasonWeill Dec 6, 2023
ef97045
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 6, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Help for all handlers
  • Loading branch information
JasonWeill committed Dec 5, 2023
commit 9aa348f55d04a1b4362d2774547a59510f1743bb
8 changes: 4 additions & 4 deletions packages/jupyter-ai/jupyter_ai/chat_handlers/ask.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ class AskChatHandler(BaseChatHandler):
query the documents from the index, and sends this context
to the LLM to generate the final reply.
"""
id = 'ask-chat-handler'
id = "ask-chat-handler"
name = "Ask with Local Data"
description = 'Ask a question augmented with learned data'
help = 'Asks a question with retrieval augmented generation (RAG)'
slash_id = 'ask'
description = "Ask a question augmented with learned data"
help = "Asks a question with retrieval augmented generation (RAG)"
slash_id = "ask"

def __init__(self, retriever, *args, **kwargs):
super().__init__(*args, **kwargs)
Expand Down
6 changes: 6 additions & 0 deletions packages/jupyter-ai/jupyter_ai/chat_handlers/clear.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@


class ClearChatHandler(BaseChatHandler):
id = "clear-chat-handler"
name = "Clear chat messages"
description = "Clear the chat message history display"
help = "Clears the displayed chat message history only; does not clear the context sent to chat providers"
slash_id = "clear"

def __init__(self, chat_history: List[ChatMessage], *args, **kwargs):
super().__init__(*args, **kwargs)
self._chat_history = chat_history
Expand Down
6 changes: 5 additions & 1 deletion packages/jupyter-ai/jupyter_ai/chat_handlers/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,11 @@ def create_notebook(outline):


class GenerateChatHandler(BaseChatHandler):
"""Generates a Jupyter notebook given a description."""
id = "generate-chat-handler"
name = "Generate Notebook"
description = "Generates a Jupyter notebook given a description"
help = "Generates a Jupyter notebook, including name, outline, and section contents"
slash_id = "generate"

def __init__(self, root_dir: str, *args, **kwargs):
super().__init__(*args, **kwargs)
Expand Down
6 changes: 6 additions & 0 deletions packages/jupyter-ai/jupyter_ai/chat_handlers/help.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ def HelpMessage():


class HelpChatHandler(BaseChatHandler):
id = "help-chat-handler"
name = "Help"
description = "Displays information about available commands"
help = "Displays a help message in the chat message area"
slash_id = "help"

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

Expand Down
6 changes: 6 additions & 0 deletions packages/jupyter-ai/jupyter_ai/chat_handlers/learn.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@


class LearnChatHandler(BaseChatHandler):
id = "learn-chat-handler"
name = "Learn Local Data"
description = "Embed a list of files and directories for use with /ask"
help = "Pass a list of files and directories. Once converted to vector format, you can ask about them with /ask."
slash_id = "ask"

def __init__(
self, root_dir: str, dask_client_future: Awaitable[DaskClient], *args, **kwargs
):
Expand Down