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

No recourse when previously selected model is not present #409

Closed
3coins opened this issue Oct 16, 2023 · 3 comments · Fixed by #459 · May be fixed by #441
Closed

No recourse when previously selected model is not present #409

3coins opened this issue Oct 16, 2023 · 3 comments · Fixed by #459 · May be fixed by #441
Labels
bug Something isn't working

Comments

@3coins
Copy link
Collaborator

3coins commented Oct 16, 2023

Problem

There is no recourse for users when the providers/models are removed or re-arranged and the previously selected model is not present in the selection any more. This causes an error on the Chat UI, but has no way for users to correct it; even deleting and re-installing Jupyter AI reads the model config from the same location which causes the same issue.

Screenshot 2023-10-16 at 4 40 52 PM

Here is the error from the server log

[W 2023-10-16 16:16:34.758 ServerApp] jupyter_ai | extension failed loading with message: ValueError("No provider and model found with 'bedrock-chat:anthropic.claude-v1'")
    Traceback (most recent call last):
      File "/opt/anaconda3/envs/quarterly-report-scripts/lib/python3.10/site-packages/jupyter_server/extension/manager.py", line 356, in load_extension
        extension.load_all_points(self.serverapp)
      File "/opt/anaconda3/envs/quarterly-report-scripts/lib/python3.10/site-packages/jupyter_server/extension/manager.py", line 228, in load_all_points
        return [self.load_point(point_name, serverapp) for point_name in self.extension_points]
      File "/opt/anaconda3/envs/quarterly-report-scripts/lib/python3.10/site-packages/jupyter_server/extension/manager.py", line 228, in <listcomp>
        return [self.load_point(point_name, serverapp) for point_name in self.extension_points]
      File "/opt/anaconda3/envs/quarterly-report-scripts/lib/python3.10/site-packages/jupyter_server/extension/manager.py", line 219, in load_point
        return point.load(serverapp)
      File "/opt/anaconda3/envs/quarterly-report-scripts/lib/python3.10/site-packages/jupyter_server/extension/manager.py", line 147, in load
        return loader(serverapp)
      File "/opt/anaconda3/envs/quarterly-report-scripts/lib/python3.10/site-packages/jupyter_server/extension/application.py", line 466, in _load_jupyter_server_extension
        extension.initialize()
      File "/opt/anaconda3/envs/quarterly-report-scripts/lib/python3.10/site-packages/jupyter_server/extension/application.py", line 429, in initialize
        self._prepare_settings()
      File "/opt/anaconda3/envs/quarterly-report-scripts/lib/python3.10/site-packages/jupyter_server/extension/application.py", line 310, in _prepare_settings
        self.initialize_settings()
      File "/opt/anaconda3/envs/quarterly-report-scripts/lib/python3.10/site-packages/jupyter_ai/extension.py", line 42, in initialize_settings
        self.settings["jai_config_manager"] = ConfigManager(
      File "/opt/anaconda3/envs/quarterly-report-scripts/lib/python3.10/site-packages/jupyter_ai/config_manager.py", line 37, in __init__
        self._load()
      File "/opt/anaconda3/envs/quarterly-report-scripts/lib/python3.10/site-packages/jupyter_ai/config_manager.py", line 127, in _load
        self.update(config, False)
      File "/opt/anaconda3/envs/quarterly-report-scripts/lib/python3.10/site-packages/jupyter_ai/config_manager.py", line 40, in update
        self._update_lm_provider(config)
      File "/opt/anaconda3/envs/quarterly-report-scripts/lib/python3.10/site-packages/jupyter_ai/config_manager.py", line 88, in _update_lm_provider
        raise ValueError(f"No provider and model found with '{model_id}'")
    ValueError: No provider and model found with 'bedrock-chat:anthropic.claude-v1'

Solution

Add better handling of "missing model" error to show an error in the Chat UI, but present the user with the settings panel, so they can select another provider/model.

@3coins 3coins added the bug Something isn't working label Oct 16, 2023
@JasonWeill
Copy link
Collaborator

Prior issue concerning a no-longer-present model: #346

@andrii-i
Copy link
Collaborator

Steps to reproduce:

  1. get you data dir path by running echo "$(jupyter --data-dir)/jupyter_ai/config.json"
  2. open config.json in your data dir and change model_provider_id or embeddings_provider_id to one not provided by the server

@andrii-i
Copy link
Collaborator

Did some investigation:

Good solution would be to build an error boundary component and use it as a part of chat widget, similar to what was done in Jupyter Scheduler.

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
3 participants