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

Register, update, and delete aliases #136

Merged
merged 24 commits into from
Jun 6, 2023

Conversation

JasonWeill
Copy link
Collaborator

@JasonWeill JasonWeill commented May 2, 2023

Fixes #45 and #46.

Adds %ai register, %ai delete, and %ai update commands to manage aliases. Modifies %ai list to display aliases. Reclassifies shortcut AI model aliases as a default set. Modifies magic command logic to use the alias dictionary. Updates sample notebook and documentation.

Users can set aliases to models (but not to other aliases), and to variables of type LLMChain.

image

image

@JasonWeill
Copy link
Collaborator Author

Updates PR to add support for registering names for custom LangChain chains.

Copy link
Member

@dlqqq dlqqq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the monumental effort you've put into this! Awesome work. I have two main concerns:

  1. Let's get alignment on the syntax. I'm not really sure if we want to be using the same subcommands to register aliases and chains. Chains and aliases are different and should be registered/updated/deleted differently.

  2. Right now, we are handling the implementation and parsing imperatively rather than relying on argparse. This strategy is often brittle, based on the simple fact that string parsing is easy to get wrong. I would like to work with you on this.

@JasonWeill
Copy link
Collaborator Author

This pull request is now updated to incorporate the click changes in #188.

@3coins
Copy link
Collaborator

3coins commented Jun 6, 2023

@JasonWeill
Thanks for working on this. Did you had a chance to resolve or discuss @dlq's comments about separating syntax for registering aliases vs chains?

@JasonWeill
Copy link
Collaborator Author

Per discussion with @ellisonbg and @3coins earlier today: We're going to retain the single set of commands for registering, updating, and deleting aliases to both models and chains. Both models and chains are invoked in the same way, without additional arguments. This also sets us up for future invocation methods, such as by registering an alias to a named Python function, if we want to do so later. Using fewer commands is easier to learn and remember.

docs/source/users/index.md Outdated Show resolved Hide resolved
docs/source/users/index.md Outdated Show resolved Hide resolved
JasonWeill and others added 3 commits June 6, 2023 15:08
Co-authored-by: Piyush Jain <piyushjain@duck.com>
Co-authored-by: Piyush Jain <piyushjain@duck.com>
@3coins 3coins merged commit 5be0a21 into jupyterlab:main Jun 6, 2023
3coins added a commit to krassowski/jupyter-ai that referenced this pull request Jun 15, 2023
* Validates registry name

* WIP: Register alias

* Raises exceptions

* Refactors, adds delete and update commands

* Additional examples

* Update sample notebook

* Update docs

* List aliases

* Refactoring

* Recommends using 'update' command

* WIP: Gets variable from user namespace, tests whether it's a chain

* Updates sample workbook, calls custom chain

* Updates user docs for aliases

* Edits sample notebook

* Alias list in text display, updates messaging

* Updates sample workbook

* Updates sample notebook, parsers to use click

* Additional cleanup

* Updates sample notebook, removes unahppy case

* Fix error from rebase, updates sample notebook

* Fixed error when --format is used

* Update docs/source/users/index.md

Co-authored-by: Piyush Jain <piyushjain@duck.com>

* Update docs/source/users/index.md

Co-authored-by: Piyush Jain <piyushjain@duck.com>

* Wraps ValueError exceptions to not print stack trace

---------

Co-authored-by: Piyush Jain <piyushjain@duck.com>
dbelgrod pushed a commit to dbelgrod/jupyter-ai that referenced this pull request Jun 10, 2024
* Validates registry name

* WIP: Register alias

* Raises exceptions

* Refactors, adds delete and update commands

* Additional examples

* Update sample notebook

* Update docs

* List aliases

* Refactoring

* Recommends using 'update' command

* WIP: Gets variable from user namespace, tests whether it's a chain

* Updates sample workbook, calls custom chain

* Updates user docs for aliases

* Edits sample notebook

* Alias list in text display, updates messaging

* Updates sample workbook

* Updates sample notebook, parsers to use click

* Additional cleanup

* Updates sample notebook, removes unahppy case

* Fix error from rebase, updates sample notebook

* Fixed error when --format is used

* Update docs/source/users/index.md

Co-authored-by: Piyush Jain <piyushjain@duck.com>

* Update docs/source/users/index.md

Co-authored-by: Piyush Jain <piyushjain@duck.com>

* Wraps ValueError exceptions to not print stack trace

---------

Co-authored-by: Piyush Jain <piyushjain@duck.com>
Marchlak pushed a commit to Marchlak/jupyter-ai that referenced this pull request Oct 28, 2024
* Validates registry name

* WIP: Register alias

* Raises exceptions

* Refactors, adds delete and update commands

* Additional examples

* Update sample notebook

* Update docs

* List aliases

* Refactoring

* Recommends using 'update' command

* WIP: Gets variable from user namespace, tests whether it's a chain

* Updates sample workbook, calls custom chain

* Updates user docs for aliases

* Edits sample notebook

* Alias list in text display, updates messaging

* Updates sample workbook

* Updates sample notebook, parsers to use click

* Additional cleanup

* Updates sample notebook, removes unahppy case

* Fix error from rebase, updates sample notebook

* Fixed error when --format is used

* Update docs/source/users/index.md

Co-authored-by: Piyush Jain <piyushjain@duck.com>

* Update docs/source/users/index.md

Co-authored-by: Piyush Jain <piyushjain@duck.com>

* Wraps ValueError exceptions to not print stack trace

---------

Co-authored-by: Piyush Jain <piyushjain@duck.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request @jupyter-ai/magics
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Register any LangChain chain as a magic with %ai register Add magic command to create aliases for AI models
4 participants