Skip to content

Allow chat handlers to be initialized in any order #1268

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 2 commits into from
Mar 3, 2025

Conversation

Darshan808
Copy link
Member

Fixes #1267

This PR resolves issue seen in #1257 by ensuring that chat handlers can be initialized in any order.
Specifically, it modifies AskChatHandler._retriever to be a lazily initialized property, eliminating the need for LearnChatHandler to be defined and stored before initializing AskChatHandler. This improves maintainability and flexibility in handler initialization.

@Darshan808 Darshan808 requested a review from dlqqq February 27, 2025 17:52
@Darshan808 Darshan808 self-assigned this Feb 27, 2025
@Darshan808 Darshan808 added the bug:confirmed Bugs that have been confirmed by maintainers label Feb 27, 2025
@dlqqq dlqqq added enhancement New feature or request and removed bug:confirmed Bugs that have been confirmed by maintainers labels Feb 27, 2025
@dlqqq
Copy link
Member

dlqqq commented Feb 27, 2025

@Darshan808 Thank you for working on this so quickly! The code looks perfect, aside from some minor feedback above.

@Darshan808 Darshan808 requested a review from dlqqq February 28, 2025 05:13
@Darshan808
Copy link
Member Author

Thanks for the feedback

@keerthi-swarna
Copy link
Collaborator

Good work @Darshan808

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.

@Darshan808 Awesome, thank you! 🎉

I'll merge this to help fix Jupyter AI on main. Can you help backport this to 2.x?

@dlqqq dlqqq merged commit 45ab90f into jupyterlab:main Mar 3, 2025
9 checks passed
@dlqqq
Copy link
Member

dlqqq commented Mar 3, 2025

@meeseeksdev please backport to 2.x

@dlqqq
Copy link
Member

dlqqq commented Mar 3, 2025

Oh wow, it was backported without conflicts. Didn't expect that. We can take this from here and reach out if we need anything.

srdas pushed a commit that referenced this pull request Mar 3, 2025
Darshan808 added a commit to Darshan808/jupyter-ai that referenced this pull request Mar 4, 2025
* lazy-initialize-retriever

* add-retriever-property
dlqqq pushed a commit that referenced this pull request Mar 10, 2025
* make native chat handlers customizable

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* remove-ci-error

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* add-disabled-check-and-sort-entrypoints

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Refactor Chat Handlers to Simplify Initialization (#1257)

* simplify-entrypoints-loading

* fix-lint

* fix-tests

* add-retriever-typing

* remove-retriever-from-base

* fix-circular-import(ydoc-import)

* fix-tests

* fix-type-check-failure

* refactor-retriever-init

* Allow chat handlers to be initialized in any order (#1268)

* lazy-initialize-retriever

* add-retriever-property

* rebase-into-main

* update-docs

* update-documentation

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
srdas pushed a commit to srdas/jupyter-ai that referenced this pull request Mar 11, 2025
* make native chat handlers customizable

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* remove-ci-error

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* add-disabled-check-and-sort-entrypoints

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Refactor Chat Handlers to Simplify Initialization (jupyterlab#1257)

* simplify-entrypoints-loading

* fix-lint

* fix-tests

* add-retriever-typing

* remove-retriever-from-base

* fix-circular-import(ydoc-import)

* fix-tests

* fix-type-check-failure

* refactor-retriever-init

* Allow chat handlers to be initialized in any order (jupyterlab#1268)

* lazy-initialize-retriever

* add-retriever-property

* rebase-into-main

* update-docs

* update-documentation

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
srdas added a commit that referenced this pull request Mar 20, 2025
…enAI provider (#1264)

* Simplifying the OpenAI provider to use multiple model providers

* Update openrouter.md

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* openai general interface added

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* embedding

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Updated settings to take OpenAI generic embedding models

* added openai generic embeddings screenshot

* Fixed Issue 1261

* bump version floor on jupyter server

* linter

* adding embedding model fields

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update test_config_manager

* Update pyproject.toml

* Update pyproject.toml

* Update pyproject.toml

* pyproject.toml fixes

* pyproject.toml updates

* Update pyproject.toml

* Update pyproject.toml

* Make Native Chat Handlers Overridable via Entry Points (#1249)

* make native chat handlers customizable

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* remove-ci-error

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* add-disabled-check-and-sort-entrypoints

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Refactor Chat Handlers to Simplify Initialization (#1257)

* simplify-entrypoints-loading

* fix-lint

* fix-tests

* add-retriever-typing

* remove-retriever-from-base

* fix-circular-import(ydoc-import)

* fix-tests

* fix-type-check-failure

* refactor-retriever-init

* Allow chat handlers to be initialized in any order (#1268)

* lazy-initialize-retriever

* add-retriever-property

* rebase-into-main

* update-docs

* update-documentation

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* pyproject toml files

* pyproject toml updates

* update snapshot

* writing config file correctly

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* tsx lint

* Update use-server-info.ts

* Update pyproject.toml

* adds embedding_models attribute

* Fixed display of Base url for embeddings and completions

* removed embedding_models

* Added help fields

* Update chat-settings.tsx

* minor reversions moved to new issue

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Darshan Poudel <[email protected]>
@dlqqq dlqqq mentioned this pull request Apr 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow chat handlers to be initialized in any order
3 participants