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

chat UI not showing on jupyterhub #214

Closed
sqlreport opened this issue Jun 7, 2023 · 8 comments · Fixed by #794
Closed

chat UI not showing on jupyterhub #214

sqlreport opened this issue Jun 7, 2023 · 8 comments · Fixed by #794
Labels
bug Something isn't working @jupyter-ai/chatui
Milestone

Comments

@sqlreport
Copy link

Description

using: https://github.com/jupyterhub/zero-to-jupyterhub-k8s
chat UI doesn't appear after installing pip install jupyter_ai

Reproduce

  1. setup jupyterhub environment using https://github.com/jupyterhub/zero-to-jupyterhub-k8s
  2. open jupyterhub > terminal > pip install jupyter_ai
  3. restart jupyterhub
  4. check left navigation list

Expected behavior

chat UI on left navigation appears

Context

Trying to understand if Jupyterhub cannot support this JupyterLab extension. Listed Jupyter Lab Extension and found:
@jupyter-ai/core v0.7.3 enabled OK (python, jupyter_ai)

Are there more extensions that enables chat UI?

@sqlreport sqlreport added the bug Something isn't working label Jun 7, 2023
@welcome
Copy link

welcome bot commented Jun 7, 2023

Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! 🤗

If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively.
welcome
You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! 👋

Welcome to the Jupyter community! 🎉

@bjornarfjelldal
Copy link

bjornarfjelldal commented Nov 10, 2023

Hoping this one gets fixed in upcoming release(s). Not sure how to or if possible to connect to custom Azure OpenAI instance without this.

My k8s hub instance on reports this in the pod log:

  File "pydantic/main.py", line 341, in pydantic.main.BaseModel.__init__
pydantic.error_wrappers.ValidationError: 1 validation error for ChatUser
initials
  none is not an allowed value (type=type_error.none.not_allowed)
2023-11-10 14:53:37,802 - ServerApp - ERROR - Uncaught exception GET /user/xxx1/api/ai/chats?token=xxx (10.240.0.62)
HTTPServerRequest(protocol='https', host='xxx, method='GET', uri='/user/xxx/api/ai/chats?token=xxx', version='HTTP/1.1', remote_ip='10.240.0.62')
Traceback (most recent call last):
  File "/opt/conda/lib/python3.11/site-packages/tornado/websocket.py", line 937, in _accept_connection
    open_result = handler.open(*handler.open_args, **handler.open_kwargs)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.11/site-packages/jupyter_ai/handlers.py", line 154, in open
    current_user = self.get_chat_user().dict()
                   ^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.11/site-packages/jupyter_ai/handlers.py", line 133, in get_chat_user
    return ChatUser(**chat_user_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "pydantic/main.py", line 341, in pydantic.main.BaseModel.__init__
pydantic.error_wrappers.ValidationError: 1 validation error for ChatUser
initials
  none is not an allowed value (type=type_error.none.not_allowed)

@triinity2221
Copy link

triinity2221 commented May 13, 2024

First off, a huge thanks for developing such a fantastic tool 🤗. It's been incredibly useful for our team, reducing the initial barriers at the start of projects and providing a great jumpstart.

Previously, our Chat UI in JupyterHub was working seamlessly with jupyter-ai v2.14, allowing us to use Azure OpenAI without any problems. However, following a server upgrade and the installation of the latest version, jupyter-ai v2.15, although the Chat UI reappeared, the dropdown menu for language models no longer included OpenAI or Azure OpenAI options. After applying the solution provided here, we installed langchain-openai. But, we now encounter an issue where JupyterHub fails to spawn servers for users, which is similar to the problem described here.

@dlqqq
Copy link
Collaborator

dlqqq commented May 13, 2024

@triinity2221 I'm sorry to hear that you encountered a regression! Our team is not familiar with JupyterHub operation, so I will need some more information to help.

Can you share a quick list of commands to run in a new Python environment to reproduce your setup? References to upstream docs would also be helpful.

@triinity2221
Copy link

triinity2221 commented May 14, 2024

@dlqqq - we have a python-3.8.16 environment and we have installed jupyterhub through pip by pip install jupyterhub. Below is the output of pip freeze on our setup.
requirements.txt

there are no ready logs available for the jupyterhub server, we are looking into ways if we can generate one, will share it here if I get hands on it.

Thanks

@srdas
Copy link
Collaborator

srdas commented May 20, 2024

I installed jupyterhub on an old linux desktop using conda and it works as expected with jupyter-ai, but this is preliminary. Just dropping off the screen shot and the console trace pending more investigation.
jupyterhub is running

@triinity2221
Copy link

@dlqqq , @srdas - it must have been some setup issue at our end, after fresh installation and version management of some already existing packages, the ChatUI is back again.

But now we are facing below error when we trying to use azure openai, even though all the required credentials are set from the UI

`Sorry, an error occurred. Details below:

Traceback (most recent call last):
File "/data1/jupyterhub_new/lib/python3.8/site-packages/jupyter_ai/chat_handlers/base.py", line 125, in on_message
await self.process_message(message)
File "/data1/jupyterhub_new/lib/python3.8/site-packages/jupyter_ai/chat_handlers/default.py", line 60, in process_message
self.get_llm_chain()
File "/data1/jupyterhub_new/lib/python3.8/site-packages/jupyter_ai/chat_handlers/base.py", line 215, in get_llm_chain
self.create_llm_chain(lm_provider, lm_provider_params)
File "/data1/jupyterhub_new/lib/python3.8/site-packages/jupyter_ai/chat_handlers/default.py", line 30, in create_llm_chain
llm = provider(**unified_parameters)
File "/data1/jupyterhub_new/lib/python3.8/site-packages/jupyter_ai_magics/providers.py", line 322, in init
super().init(*args, **kwargs, **model_kwargs)
File "/data1/jupyterhub_new/lib/python3.8/site-packages/pydantic/v1/main.py", line 339, in init
values, fields_set, validation_error = validate_model(pydantic_self.class, data)
File "/data1/jupyterhub_new/lib/python3.8/site-packages/pydantic/v1/main.py", line 1100, in validate_model
values = validator(cls_, values)
File "/data1/jupyterhub_new/lib/python3.8/site-packages/langchain_openai/chat_models/azure.py", line 202, in validate_environment
values["client"] = openai.AzureOpenAI(
File "/data1/jupyterhub_new/lib/python3.8/site-packages/openai/lib/azure.py", line 169, in init
raise OpenAIError(
openai.OpenAIError: Missing credentials. Please pass one of api_key, azure_ad_token, azure_ad_token_provider, or the AZURE_OPENAI_API_KEY or AZURE_OPENAI_AD_TOKEN environment variables.
`

Seems like the AZURE_OPENAI_API_KEY set from the UI isn't getting passed on. Although I can view it in the jupyter_ai/config.json

@dlqqq
Copy link
Collaborator

dlqqq commented May 20, 2024

@triinity2221 This issue is due to an upstream change to the Azure OpenAI provider in LangChain. There is some discussion about this issue in this PR: #722

I will take some time to investigate this now for you and see if I can include a patch in the minor release planned for today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working @jupyter-ai/chatui
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants