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

problem with the Chat backend #335

Closed
feika opened this issue Aug 11, 2023 · 24 comments · Fixed by #660
Closed

problem with the Chat backend #335

feika opened this issue Aug 11, 2023 · 24 comments · Fixed by #660
Labels
bug Something isn't working

Comments

@feika
Copy link

feika commented Aug 11, 2023

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.
@feika feika added the bug Something isn't working label Aug 11, 2023
@welcome
Copy link

welcome bot commented Aug 11, 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! 🎉

@dlqqq
Copy link
Collaborator

dlqqq commented Aug 11, 2023

@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.

@feika
Copy link
Author

feika commented Aug 12, 2023

@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

@feika
Copy link
Author

feika commented Aug 12, 2023

@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)

``

@feika
Copy link
Author

feika commented Aug 12, 2023

@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*

@feika feika closed this as completed Aug 12, 2023
@dlqqq
Copy link
Collaborator

dlqqq commented Aug 14, 2023

@feika This could be caused by your shell username being **, which might interfere with some path-handling libraries we are using.

@feika
Copy link
Author

feika commented Aug 15, 2023 via email

@scorpio0101
Copy link

scorpio0101 commented Oct 23, 2023

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

@Paveena12
Copy link

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

IS this resolved>???

@lokesh-repaka
Copy link

i have installed jupyter lab in a conda environment using pip install jupyter_ai i got this error

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.

@ethomas2
Copy link

ethomas2 commented Jan 5, 2024

same here

@paulsowman
Copy link

+1

@HoshiyarDigari
Copy link

I have the same issue,
I see the following error in the terminal running jupyter-lab
"
[W 2024-01-08 01:16:23.903 ServerApp] 404 GET /api/ai/chats?token=[secret] (bbeab1ef1c404270b3a2459a7884aa0f@::1) 4.58ms referer=None
"
the UI shows error "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."

and it doesn't allow me to reset my LLM model.

the issue first happened when jupyter-ai became unresponsive , i had asked to analyze quite a large js file .
I aborted and restarted and this error with chat backend showed up

i uninstalled and reintalled jupyter and jupyter-ai and the issue persists

diagnostics:

output of jupyter troubleshoot

  1. $PATH:
    /Users/hoshiyar.digari/Library/Python/3.9/bin
    /usr/local/bin
    /System/Cryptexes/App/usr/bin
    /usr/bin
    /bin
    /usr/sbin
    /sbin
    /var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin
    /var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin
    /var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin

sys.path:
/Users/hoshiyar.digari/Library/Python/3.9/bin
/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python39.zip
/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9
/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/lib-dynload
/Users/hoshiyar.digari/Library/Python/3.9/lib/python/site-packages
/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/site-packages

sys.executable:
/Library/Developer/CommandLineTools/usr/bin/python3

sys.version:
3.9.6 (default, Nov 10 2023, 13:38:27)
[Clang 15.0.0 (clang-1500.1.0.2.5)]

platform.platform():
macOS-14.2.1-arm64-arm-64bit

which -a jupyter:
/Users/hoshiyar.digari/Library/Python/3.9/bin/jupyter

pip list:
Package Version
------------------------- ----------
aiohttp 3.9.1
aiosignal 1.3.1
aiosqlite 0.19.0
altgraph 0.17.2
annotated-types 0.6.0
anyio 4.2.0
appnope 0.1.3
argon2-cffi 23.1.0
argon2-cffi-bindings 21.2.0
arrow 1.3.0
asttokens 2.4.1
async-lru 2.0.4
async-timeout 4.0.3
attrs 23.1.0
Babel 2.14.0
beautifulsoup4 4.12.2
bleach 6.1.0
certifi 2023.11.17
cffi 1.16.0
charset-normalizer 3.3.2
click 8.1.7
cloudpickle 3.0.0
comm 0.2.0
dask 2023.12.1
dataclasses-json 0.6.3
debugpy 1.8.0
decorator 5.1.1
deepmerge 1.1.1
defusedxml 0.7.1
distributed 2023.12.1
distro 1.9.0
exceptiongroup 1.2.0
executing 2.0.1
faiss-cpu 1.7.4
fastjsonschema 2.19.0
fqdn 1.5.1
frozenlist 1.4.1
fsspec 2023.12.2
future 0.18.2
h11 0.14.0
httpcore 1.0.2
httpx 0.26.0
idna 3.6
importlib-metadata 7.0.1
ipykernel 6.27.1
ipython 8.18.1
isoduration 20.11.0
jedi 0.19.1
Jinja2 3.1.2
json5 0.9.14
jsonpatch 1.33
jsonpath-ng 1.6.0
jsonpointer 2.4
jsonschema 4.20.0
jsonschema-specifications 2023.11.2
jupyter_ai 2.8.1
jupyter_ai_magics 2.8.1
jupyter_client 8.6.0
jupyter_core 5.5.1
jupyter-events 0.9.0
jupyter-lsp 2.2.1
jupyter_server 2.12.1
jupyter_server_terminals 0.5.0
jupyterlab 4.0.9
jupyterlab_pygments 0.3.0
jupyterlab_server 2.25.2
langchain 0.0.350
langchain-community 0.0.7
langchain-core 0.1.3
langsmith 0.0.77
locket 1.0.0
macholib 1.15.2
MarkupSafe 2.1.3
marshmallow 3.20.1
matplotlib-inline 0.1.6
mistune 3.0.2
msgpack 1.0.7
multidict 6.0.4
mypy-extensions 1.0.0
nbclient 0.9.0
nbconvert 7.13.1
nbformat 5.9.2
nest-asyncio 1.5.8
notebook 7.0.6
notebook_shim 0.2.3
numpy 1.26.3
openai 0.28.1
overrides 7.4.0
packaging 23.2
pandocfilters 1.5.0
parso 0.8.3
partd 1.4.1
pexpect 4.9.0
pi 0.1.2
pip 23.3.2
platformdirs 4.1.0
ply 3.11
prometheus-client 0.19.0
prompt-toolkit 3.0.43
psutil 5.9.7
ptyprocess 0.7.0
pure-eval 0.2.2
pycparser 2.21
pydantic 2.5.3
pydantic_core 2.14.6
Pygments 2.17.2
python-dateutil 2.8.2
python-json-logger 2.0.7
PyYAML 6.0.1
pyzmq 25.1.2
referencing 0.32.0
regex 2023.12.25
requests 2.31.0
rfc3339-validator 0.1.4
rfc3986-validator 0.1.1
rpds-py 0.15.2
Send2Trash 1.8.2
setuptools 58.0.4
six 1.15.0
sniffio 1.3.0
sortedcontainers 2.4.0
soupsieve 2.5
SQLAlchemy 2.0.25
stack-data 0.6.3
tblib 3.0.0
tenacity 8.2.3
terminado 0.18.0
tiktoken 0.5.2
tinycss2 1.2.1
tomli 2.0.1
toolz 0.12.0
tornado 6.4
tqdm 4.66.1
traitlets 5.14.0
types-python-dateutil 2.8.19.14
typing_extensions 4.9.0
typing-inspect 0.9.0
uri-template 1.3.0
urllib3 2.1.0
wcwidth 0.2.12
webcolors 1.13
webencodings 0.5.1
websocket-client 1.7.0
wheel 0.37.0
yarl 1.9.4
zict 3.0.0
zipp 3.17.

@JasonWeill JasonWeill reopened this Jan 8, 2024
@JasonWeill
Copy link
Collaborator

Reopened this issue due to recent comments.

If you're seeing a 404 error when calling GET /api/ai/chats, to diagnose this issue, please also include any other errors that you see in the console where you started JupyterLab. Do not include any API keys or other sensitive information, please.

@JasonWeill
Copy link
Collaborator

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!

@HoshiyarDigari
Copy link

Reopened this issue due to recent comments.

If you're seeing a 404 error when calling GET /api/ai/chats, to diagnose this issue, please also include any other errors that you see in the console where you started JupyterLab. Do not include any API keys or other sensitive information, please.

Here is the log of running the jupyter lab command and seeing the 404 error

jupyter-lab
/Users/hoshiyar.digari/Library/Python/3.9/lib/python/site-packages/urllib3/init.py:34: NotOpenSSLWarning: urllib3 v2 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'LibreSSL 2.8.3'. See: urllib3/urllib3#3020
warnings.warn(
[I 2024-01-09 22:14:41.719 ServerApp] Extension package jupyter_ai took 1.9347s to import
[W 2024-01-09 22:14:41.730 ServerApp] A _jupyter_server_extension_points function was not found in jupyter_lsp. Instead, a _jupyter_server_extension_paths function was found and will be used for now. This function name will be deprecated in future releases of Jupyter Server.
[W 2024-01-09 22:14:41.737 ServerApp] A _jupyter_server_extension_points function was not found in notebook_shim. Instead, a _jupyter_server_extension_paths function was found and will be used for now. This function name will be deprecated in future releases of Jupyter Server.
[I 2024-01-09 22:14:41.739 ServerApp] jupyter_ai | extension was successfully linked.
[I 2024-01-09 22:14:41.739 ServerApp] jupyter_lsp | extension was successfully linked.
[I 2024-01-09 22:14:41.741 ServerApp] jupyter_server_terminals | extension was successfully linked.
[I 2024-01-09 22:14:41.743 ServerApp] jupyterlab | extension was successfully linked.
[I 2024-01-09 22:14:41.745 ServerApp] notebook | extension was successfully linked.
[I 2024-01-09 22:14:41.750 ServerApp] notebook_shim | extension was successfully linked.
[I 2024-01-09 22:14:41.770 ServerApp] notebook_shim | extension was successfully loaded.
[I 2024-01-09 22:14:41.770 AiExtension] Configured provider allowlist: None
[I 2024-01-09 22:14:41.770 AiExtension] Configured provider blocklist: None
[I 2024-01-09 22:14:41.770 AiExtension] Configured model allowlist: None
[I 2024-01-09 22:14:41.770 AiExtension] Configured model blocklist: None
[I 2024-01-09 22:14:41.770 AiExtension] Configured model parameters: {}
[I 2024-01-09 22:14:41.774 AiExtension] Registered model provider ai21.
[I 2024-01-09 22:14:41.774 AiExtension] Registered model provider bedrock.
[I 2024-01-09 22:14:41.774 AiExtension] Registered model provider bedrock-chat.
[I 2024-01-09 22:14:41.774 AiExtension] Registered model provider anthropic.
[I 2024-01-09 22:14:41.774 AiExtension] Registered model provider anthropic-chat.
[I 2024-01-09 22:14:41.774 AiExtension] Registered model provider azure-chat-openai.
[I 2024-01-09 22:14:41.774 AiExtension] Registered model provider cohere.
[I 2024-01-09 22:14:41.774 AiExtension] Registered model provider gpt4all.
[I 2024-01-09 22:14:41.774 AiExtension] Registered model provider huggingface_hub.
[I 2024-01-09 22:14:41.774 AiExtension] Registered model provider openai.
[I 2024-01-09 22:14:41.774 AiExtension] Registered model provider openai-chat.
[I 2024-01-09 22:14:41.774 AiExtension] Registered model provider openai-chat-new.
[I 2024-01-09 22:14:41.774 AiExtension] Registered model provider qianfan.
[I 2024-01-09 22:14:41.774 AiExtension] Registered model provider sagemaker-endpoint.
[I 2024-01-09 22:14:41.778 AiExtension] Registered embeddings model provider bedrock.
[I 2024-01-09 22:14:41.778 AiExtension] Registered embeddings model provider cohere.
[I 2024-01-09 22:14:41.778 AiExtension] Registered embeddings model provider gpt4all.
[I 2024-01-09 22:14:41.778 AiExtension] Registered embeddings model provider huggingface_hub.
[I 2024-01-09 22:14:41.779 AiExtension] Registered embeddings model provider openai.
[I 2024-01-09 22:14:41.779 AiExtension] Registered embeddings model provider qianfan.
[I 2024-01-09 22:14:41.782 AiExtension] Registered providers.
[I 2024-01-09 22:14:41.782 AiExtension] Registered jupyter_ai server extension
[W 2024-01-09 22:14:41.787 ServerApp] jupyter_ai | extension failed loading with message: ModuleNotFoundError('Could not import boto3 python package. Please install it with pip install boto3.')
Traceback (most recent call last):
File "/Users/hoshiyar.digari/Library/Python/3.9/lib/python/site-packages/langchain_community/embeddings/bedrock.py", line 80, in validate_environment
import boto3
ModuleNotFoundError: No module named 'boto3'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/hoshiyar.digari/Library/Python/3.9/lib/python/site-packages/jupyter_server/extension/manager.py", line 359, in load_extension
    extension.load_all_points(self.serverapp)
  File "/Users/hoshiyar.digari/Library/Python/3.9/lib/python/site-packages/jupyter_server/extension/manager.py", line 231, in load_all_points
    return [self.load_point(point_name, serverapp) for point_name in self.extension_points]
  File "/Users/hoshiyar.digari/Library/Python/3.9/lib/python/site-packages/jupyter_server/extension/manager.py", line 231, in <listcomp>
    return [self.load_point(point_name, serverapp) for point_name in self.extension_points]
  File "/Users/hoshiyar.digari/Library/Python/3.9/lib/python/site-packages/jupyter_server/extension/manager.py", line 222, in load_point
    return point.load(serverapp)
  File "/Users/hoshiyar.digari/Library/Python/3.9/lib/python/site-packages/jupyter_server/extension/manager.py", line 150, in load
    return loader(serverapp)
  File "/Users/hoshiyar.digari/Library/Python/3.9/lib/python/site-packages/jupyter_server/extension/application.py", line 474, in _load_jupyter_server_extension
    extension.initialize()
  File "/Users/hoshiyar.digari/Library/Python/3.9/lib/python/site-packages/jupyter_server/extension/application.py", line 435, in initialize
    self._prepare_settings()
  File "/Users/hoshiyar.digari/Library/Python/3.9/lib/python/site-packages/jupyter_server/extension/application.py", line 315, in _prepare_settings
    self.initialize_settings()
  File "/Users/hoshiyar.digari/Library/Python/3.9/lib/python/site-packages/jupyter_ai/extension.py", line 191, in initialize_settings
    learn_chat_handler = LearnChatHandler(**chat_handler_kwargs)
  File "/Users/hoshiyar.digari/Library/Python/3.9/lib/python/site-packages/jupyter_ai/chat_handlers/learn.py", line 67, in __init__
    self._load()
  File "/Users/hoshiyar.digari/Library/Python/3.9/lib/python/site-packages/jupyter_ai/chat_handlers/learn.py", line 71, in _load
    embeddings = self.get_embedding_model()
  File "/Users/hoshiyar.digari/Library/Python/3.9/lib/python/site-packages/jupyter_ai/chat_handlers/learn.py", line 296, in get_embedding_model
    return em_provider_cls(**em_provider_args)
  File "/Users/hoshiyar.digari/Library/Python/3.9/lib/python/site-packages/jupyter_ai_magics/embedding_providers.py", line 69, in __init__
    super().__init__(*args, **kwargs, **model_kwargs)
  File "/Users/hoshiyar.digari/Library/Python/3.9/lib/python/site-packages/pydantic/v1/main.py", line 339, in __init__
    values, fields_set, validation_error = validate_model(__pydantic_self__.__class__, data)
  File "/Users/hoshiyar.digari/Library/Python/3.9/lib/python/site-packages/pydantic/v1/main.py", line 1102, in validate_model
    values = validator(cls_, values)
  File "/Users/hoshiyar.digari/Library/Python/3.9/lib/python/site-packages/langchain_community/embeddings/bedrock.py", line 98, in validate_environment
    raise ModuleNotFoundError(
ModuleNotFoundError: Could not import boto3 python package. Please install it with `pip install boto3`.

[I 2024-01-09 22:14:41.802 ServerApp] jupyter_lsp | extension was successfully loaded.
[I 2024-01-09 22:14:41.802 ServerApp] jupyter_server_terminals | extension was successfully loaded.
[I 2024-01-09 22:14:41.804 LabApp] JupyterLab extension loaded from /Users/hoshiyar.digari/Library/Python/3.9/lib/python/site-packages/jupyterlab
[I 2024-01-09 22:14:41.804 LabApp] JupyterLab application directory is /Users/hoshiyar.digari/Library/Python/3.9/share/jupyter/lab
[I 2024-01-09 22:14:41.805 LabApp] Extension Manager is 'pypi'.
[I 2024-01-09 22:14:41.806 ServerApp] jupyterlab | extension was successfully loaded.
[I 2024-01-09 22:14:41.807 ServerApp] notebook | extension was successfully loaded.
[I 2024-01-09 22:14:41.808 ServerApp] Serving notebooks from local directory: /Users/hoshiyar.digari/cicd
[I 2024-01-09 22:14:41.808 ServerApp] Jupyter Server 2.12.1 is running at:
[I 2024-01-09 22:14:41.808 ServerApp] http://localhost:8888/lab?token=4a9751f122836478118239d706d8639e77828cc7b36b53d1
[I 2024-01-09 22:14:41.808 ServerApp] http://127.0.0.1:8888/lab?token=4a9751f122836478118239d706d8639e77828cc7b36b53d1
[I 2024-01-09 22:14:41.808 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 2024-01-09 22:14:41.811 ServerApp]

To access the server, open this file in a browser:
    file:///Users/hoshiyar.digari/Library/Jupyter/runtime/jpserver-27025-open.html
Or copy and paste one of these URLs:
    http://localhost:8888/lab?token=4a9751f122836478118239d706d8639e77828cc7b36b53d1
    http://127.0.0.1:8888/lab?token=4a9751f122836478118239d706d8639e77828cc7b36b53d1

[I 2024-01-09 22:14:42.336 ServerApp] Skipped non-installed server(s): bash-language-server, dockerfile-language-server-nodejs, javascript-typescript-langserver, jedi-language-server, julia-language-server, pyright, python-language-server, python-lsp-server, r-languageserver, sql-language-server, texlab, typescript-language-server, unified-language-server, vscode-css-languageserver-bin, vscode-html-languageserver-bin, vscode-json-languageserver-bin, yaml-language-server
[W 2024-01-09 22:14:45.338 ServerApp] 404 GET /api/ai/chats?token=[secret] (bbeab1ef1c404270b3a2459a7884aa0f@::1) 11.32ms referer=None
[I 2024-01-09 22:14:45.531 LabApp] Build is up to date
[W 2024-01-09 22:14:46.422 ServerApp] 404 GET /api/ai/chats?token=[secret] (bbeab1ef1c404270b3a2459a7884aa0f@::1) 4.34ms referer=None
[W 2024-01-09 22:14:47.433 ServerApp] 404 GET /api/ai/chats?token=[secret] (bbeab1ef1c404270b3a2459a7884aa0f@::1) 4.55ms referer=None
[W 2024-01-09 22:14:48.446 ServerApp] 404 GET /api/ai/chats?token=[secret] (bbeab1ef1c404270b3a2459a7884aa0f@::1) 4.69ms referer=None
[W 2024-01-09 22:14:49.460 ServerApp] 404 GET /api/ai/chats?token=[secret] (bbeab1ef1c404270b3a2459a7884aa0f@::1) 5.13ms referer=None

@HoshiyarDigari
Copy link

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!

Yeah, deleting the config.json file gave me the option to reconfigure the LLM backends

@gitwittidbit
Copy link

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!

Yeah, deleting the config.json file gave me the option to reconfigure the LLM backends

Where did you find that file? It says it is in the Jupyter AI settings directory. Where is that?

These are the contents of my Jupyter AI folder:
chat_handlers config config_manager.py document_loaders extension.py handlers.py init.py models.py pycache tests _version.py

@HoshiyarDigari
Copy link

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!

Yeah, deleting the config.json file gave me the option to reconfigure the LLM backends

Where did you find that file? It says it is in the Jupyter AI settings directory. Where is that?

These are the contents of my Jupyter AI folder: chat_handlers config config_manager.py document_loaders extension.py handlers.py init.py models.py pycache tests _version.py

the file on my mac was in folder
/Users//hoshiyar.digari/Library/Jupyter/jupyter_ai/config.json

@evogelpohl
Copy link

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?

@abbott
Copy link
Contributor

abbott commented Feb 27, 2024

Same here:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/tornado/websocket.py", line 938, in _accept_connection
    open_result = handler.open(*handler.open_args, **handler.open_kwargs)
  File "/venv/lib/python3.10/site-packages/jupyter_ai/handlers.py", line 159, in open
    current_user = self.get_chat_user().dict()
  File "/venv/lib/python3.10/site-packages/jupyter_ai/handlers.py", line 119, in get_chat_user
    collaborative = self.config.ServerApp.jpserver_extensions.get_value({}).get(
AttributeError: 'dict' object has no attribute 'get_value'
2024-02-26 20:33:59,622 - ServerApp - ERROR - Uncaught exception GET /jupyter/api/ai/chats?token=... (127.0.0.1)

Server log

I called out "[E 2024-02-26 20:33:16.835 AiExtension] Could not load vector index from disk." below...

(venv) nonroot@moon:~$ jupyter lab --config=$JUP_CONF
[I 2024-02-26 20:33:16.425 ServerApp] jupyter_ai | extension was successfully linked.
[I 2024-02-26 20:33:16.425 ServerApp] jupyter_lsp | extension was successfully linked.
[I 2024-02-26 20:33:16.430 ServerApp] jupyter_server_terminals | extension was successfully linked.
[W 2024-02-26 20:33:16.435 LabApp] 'logging_config' is found in LabApp, NotebookApp, and ServerApp. This is a recent change. This config will only be set in LabApp. Please check if you should also config these traits in NotebookApp and ServerApp for your purpose.
[I 2024-02-26 20:33:16.438 ServerApp] jupyterlab | extension was successfully linked.
[I 2024-02-26 20:33:16.443 ServerApp] notebook_shim | extension was successfully linked.
[I 2024-02-26 20:33:16.443 ServerApp] panel.io.jupyter_server_extension | extension was successfully linked.
[I 2024-02-26 20:33:16.456 ServerApp] notebook_shim | extension was successfully loaded.
[I 2024-02-26 20:33:16.457 AiExtension] Configured provider allowlist: None
[I 2024-02-26 20:33:16.457 AiExtension] Configured provider blocklist: None
[I 2024-02-26 20:33:16.457 AiExtension] Configured model allowlist: None
[I 2024-02-26 20:33:16.457 AiExtension] Configured model blocklist: None
[I 2024-02-26 20:33:16.457 AiExtension] Configured model parameters: {}
[I 2024-02-26 20:33:16.486 AiExtension] Registered model provider ai21.
[I 2024-02-26 20:33:16.486 AiExtension] Registered model provider bedrock.
[I 2024-02-26 20:33:16.486 AiExtension] Registered model provider bedrock-chat.
[I 2024-02-26 20:33:16.486 AiExtension] Registered model provider anthropic.
[I 2024-02-26 20:33:16.486 AiExtension] Registered model provider anthropic-chat.
[I 2024-02-26 20:33:16.486 AiExtension] Registered model provider azure-chat-openai.
[I 2024-02-26 20:33:16.486 AiExtension] Registered model provider cohere.
[I 2024-02-26 20:33:16.486 AiExtension] Registered model provider gpt4all.
[I 2024-02-26 20:33:16.486 AiExtension] Registered model provider huggingface_hub.
[I 2024-02-26 20:33:16.521 AiExtension] Registered model provider nvidia-chat.
[I 2024-02-26 20:33:16.521 AiExtension] Registered model provider openai.
[I 2024-02-26 20:33:16.521 AiExtension] Registered model provider openai-chat.
[I 2024-02-26 20:33:16.521 AiExtension] Registered model provider qianfan.
[I 2024-02-26 20:33:16.521 AiExtension] Registered model provider sagemaker-endpoint.
[I 2024-02-26 20:33:16.541 AiExtension] Registered embeddings model provider bedrock.
[I 2024-02-26 20:33:16.541 AiExtension] Registered embeddings model provider cohere.
[I 2024-02-26 20:33:16.541 AiExtension] Registered embeddings model provider gpt4all.
[I 2024-02-26 20:33:16.541 AiExtension] Registered embeddings model provider huggingface_hub.
[I 2024-02-26 20:33:16.541 AiExtension] Registered embeddings model provider openai.
[I 2024-02-26 20:33:16.541 AiExtension] Registered embeddings model provider qianfan.
[I 2024-02-26 20:33:16.547 AiExtension] Registered providers.
[I 2024-02-26 20:33:16.547 AiExtension] Registered jupyter_ai server extension

[E 2024-02-26 20:33:16.835 AiExtension] Could not load vector index from disk.

[I 2024-02-26 20:33:16.836 AiExtension] Initialized Jupyter AI server extension in 379 ms.
[I 2024-02-26 20:33:16.837 ServerApp] jupyter_ai | extension was successfully loaded.
[I 2024-02-26 20:33:16.838 ServerApp] jupyter_lsp | extension was successfully loaded.
[I 2024-02-26 20:33:16.839 ServerApp] jupyter_server_terminals | extension was successfully loaded.
[I 2024-02-26 20:33:16.840 LabApp] JupyterLab extension loaded from /venv/lib/python3.10/site-packages/jupyterlab
[I 2024-02-26 20:33:16.840 LabApp] JupyterLab application directory is /venv/share/jupyter/lab
[I 2024-02-26 20:33:16.841 LabApp] Extension Manager is 'pypi'.
[I 2024-02-26 20:33:16.884 ServerApp] jupyterlab | extension was successfully loaded.
[I 2024-02-26 20:33:16.885 ServerApp] panel.io.jupyter_server_extension | extension was successfully loaded.
[I 2024-02-26 20:33:16.885 ServerApp] Serving notebooks from local directory: /home/bruce/_project
[I 2024-02-26 20:33:16.885 ServerApp] Jupyter Server 2.12.5 is running at:
[I 2024-02-26 20:33:16.885 ServerApp] http://moon:8888/jupyter/lab?token=...
[I 2024-02-26 20:33:16.885 ServerApp] http://127.0.0.1:8888/jupyter/lab?token=...
[I 2024-02-26 20:33:16.885 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).

@evogelpohl
Copy link

@abbott - #659. I'm making progress on this error, but now encountering a new one. My dockerFile and compose included in the referring repo.

@abbott
Copy link
Contributor

abbott commented Feb 28, 2024

Traceback (most recent call last):
  File "/venv/lib/python3.10/site-packages/jupyter_ai/handlers.py", line 119, in get_chat_user
    collaborative = self.config.ServerApp.jpserver_extensions.get_value({}).get(
AttributeError: 'dict' object has no attribute 'get_value'
2024-02-26 20:33:59,622 - ServerApp - ERROR - Uncaught exception GET /jupyter/api/ai/chats?token=... (127.0.0.1)

I resolved my issue by removing get_value({}) from this line in handlers.py. After restarting my kernel, the AI chat error message disappeared and the chat view loaded.

The command should read:

collaborative = self.config.ServerApp.jpserver_extensions.get(
            "jupyter_collaboration", False
        )

@dlqqq
Copy link
Collaborator

dlqqq commented Mar 6, 2024

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.

  • 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.

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! ❤️ 🤗

@dlqqq dlqqq closed this as completed Mar 6, 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 a pull request may close this issue.