jupyter-ai: problem with the Chat backend

Description

“There seems to be a problem with the Chat backend, please look at the JupyterLab server logs or contact your administrator to correct this problem.” show on web In teminal, it showed 404 GET /api/ai/chats (662c3af254c24dc7939484fd0fb38feb@172.24.149.119) 1.17ms referer=None

Reproduce

  1. Go to ‘…’
  2. Click on ‘…’
  3. Scroll down to ‘…’
  4. See error ‘…’

Expected behavior

Context

  • Operating System and version:
  • Browser and version:
  • JupyterLab version:
Troubleshoot Output
Paste the output from running `jupyter troubleshoot` from the command line here.
pip list:
	Package                       Version
	----------------------------- ---------------
	about-time                    4.2.1
	aiofiles                      22.1.0
	aiohttp                       3.8.5
	aiosignal                     1.3.1
	aiosqlite                     0.18.0
	alabaster                     0.7.12
	alive-progress                3.0.1
	anaconda-client               1.12.0
	anaconda-navigator            2.4.0
	anaconda-project              0.11.1
	analytics-python              1.4.post1
	anyio                         3.6.2
	appdirs                       1.4.4
	argon2-cffi                   21.3.0
	argon2-cffi-bindings          21.2.0
	args-oap                      3.2.2
	arrow                         1.2.3
	astroid                       2.14.2
	astropy                       5.1
	asttokens                     2.0.5
	async-timeout                 4.0.3
	atomicwrites                  1.4.0
	attrs                         22.1.0
	Automat                       20.2.0
	autopep8                      1.6.0
	Babel                         2.11.0
	backcall                      0.2.0
	backoff                       2.2.1
	backports.functools-lru-cache 1.6.4
	backports.tempfile            1.0
	backports.weakref             1.0.post1
	bakta                         1.7.0
	bcbio-gff                     0.7.0
	bcrypt                        3.2.0
	beautifulsoup4                4.12.2
	binaryornot                   0.4.4
	biom-format                   2.1.13
	biopython                     1.81
	black                         0.0
	bleach                        4.1.0
	bokeh                         2.4.3
	boltons                       23.0.0
	Bottleneck                    1.3.5
	brotlipy                      0.7.0
	bx-python                     0.9.0
	certifi                       2023.7.22
	cffi                          1.15.1
	chardet                       4.0.0
	charset-normalizer            2.0.4
	click                         8.0.4
	cloudpickle                   2.2.1
	clyent                        1.2.2
	CMSeq                         1.0.4
	colorama                      0.4.6
	colorcet                      3.0.1
	comm                          0.1.2
	conda                         23.3.1
	conda-build                   3.26.0
	conda-content-trust           0.1.3
	conda_index                   0.2.3
	conda-pack                    0.6.0
	conda-package-handling        2.1.0
	conda_package_streaming       0.8.0
	conda-repo-cli                1.0.41
	conda-token                   0.4.0
	conda-verify                  3.4.2
	constantly                    15.1.0
	contourpy                     1.0.5
	cookiecutter                  1.7.3
	cryptography                  41.0.2
	cssselect                     1.1.0
	cycler                        0.11.0
	cytoolz                       0.12.0
	daal4py                       2023.1.1
	dask                          2023.4.1
	dataclasses-json              0.5.14
	datashader                    0.15.1
	datashape                     0.5.4
	debugpy                       1.5.1
	decorator                     5.1.1
	defusedxml                    0.7.1
	DendroPy                      4.5.2
	diff-match-patch              20200713
	dill                          0.3.6
	distributed                   2023.4.1
	docstring-to-markdown         0.11
	docutils                      0.18.1
	entrypoints                   0.4
	et-xmlfile                    1.1.0
	exceptiongroup                1.0.4
	executing                     0.8.3
	faiss-cpu                     1.7.4
	fastavro                      1.8.2
	fastjsonschema                2.16.2
	filelock                      3.9.0
	flake8                        6.0.0
	Flask                         2.2.2
	flit_core                     3.8.0
	flower-plot                   0.0.1
	fonttools                     4.25.0
	fqdn                          1.5.1
	frozenlist                    1.4.0
	fsspec                        2023.4.0
	future                        0.18.3
	gensim                        4.3.0
	glob2                         0.7
	gmpy2                         2.1.2
	grapheme                      0.6.0
	greenlet                      2.0.1
	h5py                          3.7.0
	HeapDict                      1.0.1
	huggingface-hub               0.15.1
	hyperlink                     21.0.0
	idna                          3.4
	imagecodecs-lite              2019.12.3
	imageio                       2.31.1
	imagesize                     1.4.1
	imbalanced-learn              0.10.1
	importlib-metadata            5.2.0
	incremental                   21.3.0
	inflection                    0.5.1
	iniconfig                     1.1.1
	intake                        0.6.8
	intervaltree                  3.1.0
	ipykernel                     6.19.2
	ipython                       8.12.0
	ipython-genutils              0.2.0
	isal                          1.1.0
	isoduration                   20.11.0
	isort                         5.9.3
	itemadapter                   0.3.0
	itemloaders                   1.0.4
	itsdangerous                  2.0.1
	jaraco.classes                3.2.1
	jedi                          0.18.1
	jeepney                       0.7.1
	jellyfish                     0.9.0
	Jinja2                        3.1.2
	jinja2-time                   0.2.0
	jmespath                      0.10.0
	joblib                        1.2.0
	json5                         0.9.6
	jsonpatch                     1.32
	jsonpath-ng                   1.5.3
	jsonpointer                   2.1
	jsonschema                    4.17.3
	jupyter_ai                    1.0.1
	jupyter_ai_magics             2.0.1
	jupyter_client                8.1.0
	jupyter_core                  5.3.0
	jupyter-events                0.6.3
	jupyter-lsp                   2.0.1
	jupyter_server                2.5.0
	jupyter_server_fileid         0.9.0
	jupyter_server_terminals      0.4.4
	jupyter_server_ydoc           0.8.0
	jupyter-ydoc                  0.2.4
	jupyterlab                    3.6.3
	jupyterlab_code_formatter     2.2.1
	jupyterlab-lsp                4.0.1
	jupyterlab-pygments           0.1.2
	jupyterlab_server             2.22.1
	jupyterlab-spellchecker       0.7.3
	keyring                       23.13.1
	kiwisolver                    1.4.4
	langchain                     0.0.220
	langchainplus-sdk             0.0.20
	lazy_loader                   0.2
	lazy-object-proxy             1.6.0
	libarchive-c                  2.9
	libmambapy                    1.3.1
	llvmlite                      0.39.1
	lmdb                          1.4.1
	locket                        1.0.0
	lxml                          4.9.2
	lz4                           4.3.2
	mamba                         1.3.1
	MarkupSafe                    2.1.1
	marshmallow                   3.20.1
	matplotlib                    3.7.1
	matplotlib-inline             0.1.6
	mccabe                        0.7.0
	MetaPhlAn                     4.0.6
	mistune                       0.8.4
	mitosheet                     0.1.473
	mkl-fft                       1.3.1
	mkl-random                    1.2.2
	mkl-service                   2.4.0
	mock                          4.0.3
	monotonic                     1.6
	more-itertools                8.12.0
	mpmath                        1.2.1
	msgpack                       1.0.3
	multidict                     6.0.4
	multipledispatch              0.6.0
	munkres                       1.1.4
	mypy-extensions               0.4.3
	navigator-updater             0.3.0
	nb-conda-kernels              2.3.1
	nbclassic                     0.5.5
	nbclient                      0.5.13
	nbconvert                     6.5.4
	nbformat                      5.7.0
	nest-asyncio                  1.5.6
	networkx                      2.8.4
	nltk                          3.8.1
	notebook                      6.5.4
	notebook_shim                 0.2.2
	numba                         0.56.4
	numexpr                       2.8.4
	numpy                         1.23.5
	numpydoc                      1.5.0
	openai                        0.27.8
	openapi-schema-pydantic       1.2.4
	openpyxl                      3.0.10
	packaging                     23.0
	pandas                        1.5.3
	pandocfilters                 1.5.0
	param                         1.13.0
	parsel                        1.6.0
	parso                         0.8.3
	partd                         1.2.0
	pathlib                       1.0.1
	pathspec                      0.10.3
	patsy                         0.5.3
	pep8                          1.7.1
	pexpect                       4.8.0
	PhyloPhlAn                    3.0
	pickleshare                   0.7.5
	Pillow                        9.4.0
	pip                           23.2.1
	pkginfo                       1.9.6
	platformdirs                  2.5.2
	plotly                        5.9.0
	pluggy                        1.0.0
	ply                           3.11
	pooch                         1.4.0
	poyo                          0.5.0
	prometheus-client             0.16.0
	prompt-toolkit                3.0.36
	Protego                       0.1.16
	psutil                        5.9.0
	ptyprocess                    0.7.0
	pure-eval                     0.2.2
	py                            1.11.0
	py-cpuinfo                    8.0.0
	pyasn1                        0.4.8
	pyasn1-modules                0.2.8
	pycirclize                    0.3.1
	pycodestyle                   2.10.0
	pycosat                       0.6.4
	pycparser                     2.21
	pyct                          0.5.0
	pydantic                      1.10.12
	PyDispatcher                  2.0.5
	pydocstyle                    6.3.0
	pyerfa                        2.0.0
	pyflakes                      3.0.1
	pygenomeviz                   0.3.2
	Pygments                      2.15.1
	PyHamcrest                    2.0.2
	PyJWT                         2.4.0
	pylint                        2.16.2
	pylint-venv                   2.3.0
	pyls-spyder                   0.4.0
	pyodbc                        4.0.34
	pyOpenSSL                     23.2.0
	pyparsing                     3.0.9
	PyQt5                         5.15.7
	PyQt5-sip                     12.11.0
	PyQtWebEngine                 5.15.4
	pyrodigal                     2.1.0
	pyrsistent                    0.18.0
	pysam                         0.20.0
	PySocks                       1.7.1
	pytest                        7.4.0
	python-dateutil               2.8.2
	python-json-logger            2.0.7
	python-lsp-black              1.2.1
	python-lsp-jsonrpc            1.0.0
	python-lsp-server             1.7.2
	python-lzo                    1.14
	python-slugify                5.0.2
	python-snappy                 0.6.1
	pytoolconfig                  1.2.5
	pytz                          2022.7
	PyWavelets                    1.4.1
	pyxdg                         0.27
	PyYAML                        6.0
	pyzmq                         25.1.0
	QDarkStyle                    3.0.2
	qstylizer                     0.2.2
	QtAwesome                     1.2.2
	qtconsole                     5.4.2
	QtPy                          2.2.0
	quast                         5.2.0
	queuelib                      1.5.0
	regex                         2022.7.9
	requests                      2.31.0
	requests-file                 1.5.1
	requests-toolbelt             0.9.1
	rfc3339-validator             0.1.4
	rfc3986-validator             0.1.1
	rope                          1.7.0
	rpy2                          3.5.11
	Rtree                         1.0.1
	ruamel.yaml                   0.17.21
	ruamel.yaml.clib              0.2.6
	ruamel-yaml-conda             0.17.21
	scikit-image                  0.20.0
	scikit-learn                  1.2.2
	scikit-learn-intelex          20230426.111436
	scipy                         1.10.1
	Scrapy                        2.8.0
	seaborn                       0.12.2
	SecretStorage                 3.3.1
	Send2Trash                    1.8.0
	service-identity              18.1.0
	setuptools                    68.0.0
	simplegeneric                 0.8.1
	simplejson                    3.17.6
	sip                           6.6.2
	six                           1.16.0
	smart-open                    5.2.1
	sniffio                       1.3.0
	snowballstemmer               2.2.0
	some-package                  0.1
	sortedcontainers              2.4.0
	soupsieve                     2.4
	Sphinx                        5.0.2
	sphinxcontrib-applehelp       1.0.2
	sphinxcontrib-devhelp         1.0.2
	sphinxcontrib-htmlhelp        2.0.0
	sphinxcontrib-jsmath          1.0.1
	sphinxcontrib-qthelp          1.0.3
	sphinxcontrib-serializinghtml 1.1.5
	spyder                        5.4.1
	spyder-kernels                2.4.3
	SQLAlchemy                    1.4.39
	stack-data                    0.2.0
	statsmodels                   0.14.0
	sympy                         1.11.1
	tables                        3.8.0
	tabulate                      0.8.10
	TBB                           0.2
	tblib                         1.7.0
	tenacity                      8.2.2
	terminado                     0.17.1
	text-unidecode                1.3
	textdistance                  4.2.1
	threadpoolctl                 2.2.0
	three-merge                   0.1.1
	tifffile                      2020.6.3
	tiktoken                      0.4.0
	tinycss2                      1.2.1
	tldextract                    3.2.0
	tokenizers                    0.13.2
	toml                          0.10.2
	tomli                         2.0.1
	tomlkit                       0.11.1
	toolz                         0.12.0
	torch                         2.0.1
	tornado                       6.3.2
	tqdm                          4.65.0
	traitlets                     5.7.1
	transformers                  4.24.0
	Twisted                       22.10.0
	typing_extensions             4.5.0
	typing-inspect                0.9.0
	tzlocal                       5.0.1
	ujson                         5.4.0
	Unidecode                     1.2.0
	uri-template                  1.2.0
	urllib3                       1.26.16
	w3lib                         1.21.0
	watchdog                      2.1.6
	wcwidth                       0.2.5
	webcolors                     1.13
	webencodings                  0.5.1
	websocket-client              1.5.1
	Werkzeug                      2.2.3
	whatthepatch                  1.0.2
	wheel                         0.38.4
	wrapt                         1.14.1
	wurlitzer                     3.0.2
	xarray                        2023.6.0
	XlsxWriter                    3.0.2
	xopen                         1.7.0
	y-py                          0.5.9
	yapf                          0.31.0
	yarl                          1.9.2
	ypy-websocket                 0.8.2
	zict                          2.2.0
	zipp                          3.11.0
	zope.interface                5.4.0
	zstandard                     0.19.0
Command Line Output
Paste the output from your command line running `jupyter lab` here, use `--debug` if possible.
Browser Output
Paste the output from your browser Javascript console here, if applicable.

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 1
  • Comments: 24 (2 by maintainers)

Most upvoted comments

Same error:

On local m2 mac: deleted the entire dir: /Users//%myname%/Library/Jupyter/ Building docker container with:

  • FROM jupyter/all-spark-notebook:spark-3.5.0.
  • Assign 8888 to localhost
  • Navigate to jupyter, select jupyterLabs
  • Install jupyter-ai
  • Click chat, get There seems to be a problem with the Chat backend, please look at the JupyterLab server logs or contact your administrator to correct this problem.

Why? This is a container, brand new, prestine?

Hey folks, I see that there has been a lot of activity in this issue, which was met from a limited response from us. We apologize and will be better about responding promptly in the future. To help remedy this for users, I will offer insight into this error, give recommendations to users, and then close this issue so discussion can begin anew.

Here’s some more information about this bug:

  • This is a generic error message that shows whenever an uncaught exception is raised from the frontend, usually due to some server error in the backend. Therefore, we’re generally not able to assist users with this bug if server logs are not provided.

  • @abbott has determined that there is a subtle edge case where the server will fail at startup, due to how we’re detecting whether RTC is enabled on the backend. This may be causing issues for users using anything other than the default implementation of Jupyter Server, e.g. JupyterHub.

    • @abbott has offered a fix in #660. We hope to merge & release this sometime this week.
  • Finally, I have recently noticed that this bug will arise when a user selects a language model in the chat panel without having the corresponding Python dependencies installed. For example, @HoshiyarDigari is likely experiencing this bug because they do not have boto3 installed when trying to use an Amazon model provider. This case is easily reached by new users who simply forgot to install the Python dependencies, and we need to improve how we handle this case.

    • I have opened a separate issue to track this. Our team will prioritize this: #680

Here are my recommendations to users:

  • Make sure you have the dependencies of your current model provider installed. You can find this information in the user documentation.

  • If disk space is not a concern, please install Jupyter AI with pip install jupyter-ai[all]. This will install all of the optional dependencies, meaning that any provider you select should work by default.

  • If you are still experiencing this issue, please open a new issue including server logs printed by the jupyter lab process.

I hope this helps. Thank you for using Jupyter AI! ❤️ 🤗

Other troubleshooting steps include deleting config.json in your Jupyter AI settings directory or deleting the local vector database (jupyter_ai/indices/default.faiss), then restarting JupyterLab and reconfiguring Jupyter AI. Thanks all for your interest!

HI I seem to be having the same problem.

installed via: pip install jupyter_ai jupyter-lab rel 4

In the chat window: There seems to be a problem with the Chat backend, please look at the JupyterLab server logs or contact your administrator to correct this problem.

On the console 404 GET /api/ai/chats?token=[secret] (6528bae4a0544efda2b6c6d07a6e3a4a@::1) 0.00ms referer=None

Any suggestion for resolution?

Thanks

@feika Could you provide details on how you installed Jupyter AI? We have seen some users on JupyterLab 3 trying to install jupyter_ai via the extension manager in the left panel of JupyterLab, which doesn’t work because that doesn’t install our server extension. The installation instructions in our user documentation are the authoritative reference for how to install Jupyter AI. We can’t guarantee a successful installation with methods not listed there.

I use pip install which mentioned in the link you paste , and " jupyter server extension list " reports all OK Sorry I forgot to mention that it worked at first time, when I installed Cohere with pip, it reported conflicts, so I uninstalled Cohere and reinstalled jupyter ai, it didn’t work like I mentioned above I found warning in terminal

“jupyter_ai | extension failed loading with message: ValidationError(model=‘CohereEmbeddingsProvider’, errors=[{‘loc’: (‘root’,), ‘msg’: ‘Could not import cohere python package. Please install it with pip install cohere.’, ‘type’: ‘value_error’}])”

but after I installed cohere withou confilict, it warned

"jupyter_ai | extension failed loading with message: JSONDecodeError(‘Expecting value: line 1 column 1 (char 0)’) Traceback (most recent call last): File “/home//anaconda3/lib/python3.10/site-packages/jupyter_ai/chat_handlers/learn.py", line 71, in _load_or_create self.index = FAISS.load_local( File "/home//anaconda3/lib/python3.10/site-packages/langchain/vectorstores/faiss.py”, line 636, in load_local index = faiss.read_index( File "/home//anaconda3/lib/python3.10/site-packages/faiss/swigfaiss_avx2.py", line 10206, in read_index return _swigfaiss_avx2.read_index(args) RuntimeError: Error in faiss::FileIOReader::FileIOReader(const char) at /project/faiss/faiss/impl/io.cpp:67: Error: ‘f’ failed: could not open /home//.local/share/jupyter/jupyter_ai/indices/default.faiss for reading: no such file or dictionary

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/**/anaconda3/lib/python3.10/site-packages/jupyter_server/extension/manager.py", line 356, in load_extension
    extension.load_all_points(self.serverapp)
  File "/home/**/anaconda3/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 "/home/**/anaconda3/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 "/home/**/anaconda3/lib/python3.10/site-packages/jupyter_server/extension/manager.py", line 219, in load_point
    return point.load(serverapp)
  File "/home/**/anaconda3/lib/python3.10/site-packages/jupyter_server/extension/manager.py", line 147, in load
    return loader(serverapp)
  File "/home/**/anaconda3/lib/python3.10/site-packages/jupyter_server/extension/application.py", line 466, in _load_jupyter_server_extension
    extension.initialize()
  File "/home/**/anaconda3/lib/python3.10/site-packages/jupyter_server/extension/application.py", line 429, in initialize
    self._prepare_settings()
  File "/home/**/anaconda3/lib/python3.10/site-packages/jupyter_server/extension/application.py", line 310, in _prepare_settings
    self.initialize_settings()
  File "/home/**/anaconda3/lib/python3.10/site-packages/jupyter_ai/extension.py", line 90, in initialize_settings
    learn_chat_handler = LearnChatHandler(
  File "/home/**/anaconda3/lib/python3.10/site-packages/jupyter_ai/chat_handlers/learn.py", line 62, in __init__
    self._load_or_create()
  File "/home/**/anaconda3/lib/python3.10/site-packages/jupyter_ai/chat_handlers/learn.py", line 76, in _load_or_create
    self.create()
  File "/home/**/anaconda3/lib/python3.10/site-packages/jupyter_ai/chat_handlers/learn.py", line 241, in create
    self.index = FAISS.from_texts(
  File "/home/**/anaconda3/lib/python3.10/site-packages/langchain/vectorstores/faiss.py", line 551, in from_texts
    embeddings = embedding.embed_documents(texts)
  File "/home/**/anaconda3/lib/python3.10/site-packages/langchain/embeddings/cohere.py", line 66, in embed_documents
    embeddings = self.client.embed(
  File "/home/**/anaconda3/lib/python3.10/site-packages/cohere/client.py", line 252, in embed
    for result in self._executor.map(lambda json_body: self._request(cohere.EMBED_URL, json=json_body), json_bodys):
  File "/home/**/anaconda3/lib/python3.10/concurrent/futures/_base.py", line 621, in result_iterator
    yield _result_or_cancel(fs.pop())
  File "/home/**/anaconda3/lib/python3.10/concurrent/futures/_base.py", line 319, in _result_or_cancel
    return fut.result(timeout)
  File "/home/**/anaconda3/lib/python3.10/concurrent/futures/_base.py", line 458, in result
    return self.__get_result()
  File "/home/**/anaconda3/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
    raise self._exception
  File "/home/**/anaconda3/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/**/anaconda3/lib/python3.10/site-packages/cohere/client.py", line 252, in <lambda>
    for result in self._executor.map(lambda json_body: self._request(cohere.EMBED_URL, json=json_body), json_bodys):
  File "/home/**/anaconda3/lib/python3.10/site-packages/cohere/client.py", line 545, in _request
    json_response = response.json()
  File "/home/**/anaconda3/lib/python3.10/site-packages/requests/models.py", line 975, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

``

Problem solved by delete config file in /home//.local/share/jupyter/jupyter_ai/config.json*