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

Fixes lookup for custom chains #560

Merged
merged 1 commit into from
Jan 3, 2024

Conversation

JasonWeill
Copy link
Collaborator

Fixes #541, opened by @jamesjun (thank you!). Expands aliases to their full model name only when the alias is to a model name. When the alias is to a custom chain, it is not expanded to a function object.

Tested using commands.ipynb in the example files.

@JasonWeill JasonWeill added the bug Something isn't working label Jan 3, 2024
@dlqqq dlqqq force-pushed the custom-chain-handling branch from 4ea716a to 9c91b6a Compare January 3, 2024 18:03
Comment on lines +424 to 429
# custom_model_registry maps keys to either a model name (a string) or an LLMChain.
# If this is an alias to another model, expand the full name of the model.
if model_id in self.custom_model_registry and isinstance(
self.custom_model_registry[model_id], str
):
model_id = self.custom_model_registry[model_id]
Copy link
Member

Choose a reason for hiding this comment

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

Quick comment: it seems like it would be easier to re-define self.custom_model_registry to have values also be LLMChains in the case of an alias key. No need to do that in this PR if it's too big of a change though.

@JasonWeill JasonWeill enabled auto-merge (squash) January 3, 2024 18:08
@JasonWeill JasonWeill merged commit 5cd4dbb into jupyterlab:main Jan 3, 2024
8 checks passed
@JasonWeill
Copy link
Collaborator Author

@meeseeksdev please backport to 1.x

meeseeksmachine pushed a commit to meeseeksmachine/jupyter-ai that referenced this pull request Jan 3, 2024
JasonWeill added a commit that referenced this pull request Jan 3, 2024
dbelgrod pushed a commit to dbelgrod/jupyter-ai that referenced this pull request Jun 10, 2024
Marchlak pushed a commit to Marchlak/jupyter-ai that referenced this pull request Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error running an LLMChain object as a model alias
2 participants