-
-
Notifications
You must be signed in to change notification settings - Fork 476
Introduce AI persona framework #1324
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
Merged
Merged
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
7e85f0f
add dev-reinstall script for convenience
dlqqq dec9ea6
add PersonaManager and JupyternautPersona
dlqqq 025281a
add PersonaAwareness to allow awareness on >1 persona
dlqqq 90641c4
add DebugPersona to jupyter_ai_test
dlqqq db49a4e
upgrade to Jupyter Chat v0.10.0
dlqqq e2df564
automatically generate IDs for personas
dlqqq 259c2e7
add mention-based routing to PersonaManager
dlqqq 612e46d
implement streaming replies in Jupyternaut persona
dlqqq a3ac8a6
correctly identify AI messages in YChatHistory
dlqqq f4bc8d2
fix mention routing to actually work
dlqqq 61b9e01
add logging capability to PersonaAwareness
dlqqq 8a14858
update BasePersona.id to not depend on module path
dlqqq 528d239
improve logging in PersonaManager
dlqqq 8440df6
log time elapsed in PersonaManager
dlqqq 6aa7932
simplify jupyternaut prompt template
dlqqq c159a87
pre-commit
dlqqq c6a00cf
add comment to ref jupyter-chat#212
dlqqq a8e54b6
have _init_persona_manager() explicitly return None on exception
dlqqq 91860ef
pre-commit
dlqqq deaa247
update docstrings on BasePersona
dlqqq 2331c89
pre-commit
dlqqq 47dd108
add return type annotation to forward_reply_stream()
dlqqq 47bc2ec
remove unused return
dlqqq f394f3f
add comment explaining _init_persona_classes()
dlqqq 0ec5051
add docstrings to persona_manager methods
dlqqq 5dae5a7
remove redundant error logs
dlqqq 9c5a65c
pre-commit
dlqqq 366ea50
fix mypy errors
dlqqq da47052
remove tests on chat handlers as they are superseded by personas
dlqqq 00a17a9
fix type annotation for Py39 compat
dlqqq 6ece57a
rename forward_reply_stream() to stream_message()
dlqqq 261a611
add send_message() method to BasePersona
dlqqq 2090901
pre-commit
dlqqq File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| from jupyter_ai.personas.base_persona import BasePersona, PersonaDefaults | ||
| from jupyterlab_chat.models import Message, NewMessage | ||
|
|
||
|
|
||
| class DebugPersona(BasePersona): | ||
| """ | ||
| The Jupyternaut persona, the main persona provided by Jupyter AI. | ||
| """ | ||
|
|
||
| def __init__(self, *args, **kwargs): | ||
| super().__init__(*args, **kwargs) | ||
|
|
||
| @property | ||
| def defaults(self): | ||
| return PersonaDefaults( | ||
| name="DebugPersona", | ||
| avatar_path="/api/ai/static/jupyternaut.svg", | ||
| description="A mock persona used for debugging in local dev environments.", | ||
| system_prompt="...", | ||
| ) | ||
|
|
||
| async def process_message(self, message: Message): | ||
| self.ychat.add_message(NewMessage(body="Hello!", sender=self.id)) | ||
| return | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| from .base_persona import BasePersona, PersonaDefaults | ||
| from .persona_manager import PersonaManager |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.