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
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
Consistent syntax
  • Loading branch information
JasonWeill committed Dec 5, 2023
commit abaf3c6dadc0cd53ded1eb11cfbc5a5b88b123de
24 changes: 16 additions & 8 deletions packages/jupyter-ai/jupyter_ai/chat_handlers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,27 @@
class BaseChatHandler(Configurable):
"""Base ChatHandler class containing shared methods and attributes used by
multiple chat handler classes."""
id: str = 'base-chat-handler' # TODO: make NotImplemented

# Class attributes
id: str = 'base-chat-handler'
"""ID for this chat handler; should be unique"""

name: str = 'Base Chat Handler' # TODO: make NotImplemented
# Description used for routing requests, to be used when dispatching
# messages to model providers. Also shown in the UI.
"""User-facing name of this handler"""

description: str = "Handler for messages that are not commands" # TODO: make NotImplemented
# What this chat handler does, which third-party models it contacts,
# the format of the data it returns to the user, etc. Used in the UI.
"""Description used for routing requests, to be used when dispatching
messages to model providers. Also shown in the UI."""

# TODO: make NotImplemented
help: str = "This is used when the message in the chat interface is not a command"
# Slash ID for routing a chat command to this handler. Only one handler
# may declare a particular slash ID. Must contain only alphanumerics and
# underscores.
"""What this chat handler does, which third-party models it contacts,
the format of the data it returns to the user, etc. Used in the UI."""
JasonWeill marked this conversation as resolved.
Show resolved Hide resolved

slash_id: Optional[str]
"""Slash ID for routing a chat command to this handler. Only one handler
may declare a particular slash ID. Must contain only alphanumerics and
underscores."""

def __init__(
self,
Expand Down