[GH-ISSUE #42] Remote ChromaDB REST api errors #32

Closed
opened 2026-10-15 18:03:35 +00:00 by bsakaguchi · 7 comments
Owner

Originally created by @kingbri1 on GitHub (May 30, 2023).
Original GitHub issue: https://github.com/SillyTavern/SillyTavern-Extras/issues/42

Upsert on the chromaDB post request causes a numpy ndarray error. Cause has not been found. Only occurs with remote connections. Local connections are fine.

https://github.com/SillyTavern/SillyTavern-extras/blob/main/server.py#L715

Originally created by @kingbri1 on GitHub (May 30, 2023). Original GitHub issue: https://github.com/SillyTavern/SillyTavern-Extras/issues/42 Upsert on the chromaDB post request causes a numpy ndarray error. Cause has not been found. Only occurs with remote connections. Local connections are fine. https://github.com/SillyTavern/SillyTavern-extras/blob/main/server.py#L715
Author
Owner

@Seedbeat commented on GitHub (Jun 2, 2023):

Get the same error

<!-- gh-comment-id:1573146847 --> @Seedbeat commented on GitHub (Jun 2, 2023): Get the same error
Author
Owner

@BasadoBased commented on GitHub (Jun 3, 2023):

Same, chroma addon doesn't work because of it.
Traceback:

192.168.43.52 - - [03/Jun/2023 20:15:41] "OPTIONS /api/chromadb HTTP/1.1" 200 -
[2023-06-03 20:15:44,226] ERROR in app: Exception on /api/chromadb [POST]
Traceback (most recent call last):
  File "/root/miniconda3/envs/extras/lib/python3.10/site-packages/flask/app.py", line 2190, in wsgi_app
    response = self.full_dispatch_request()
  File "/root/miniconda3/envs/extras/lib/python3.10/site-packages/flask/app.py", line 1486, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/root/miniconda3/envs/extras/lib/python3.10/site-packages/flask_cors/extension.py", line 165, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  File "/root/miniconda3/envs/extras/lib/python3.10/site-packages/flask/app.py", line 1484, in full_dispatch_request
    rv = self.dispatch_request()
  File "/root/miniconda3/envs/extras/lib/python3.10/site-packages/flask/app.py", line 1469, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
  File "/scripts/SillyTavern-extras-main/server.py", line 289, in decorated_view
    return fn(*args, **kwargs)
  File "/scripts/SillyTavern-extras-main/server.py", line 715, in chromadb_add_messages
    collection.upsert(
  File "/root/miniconda3/envs/extras/lib/python3.10/site-packages/chromadb/api/models/Collection.py", line 306, in upsert
    self._client._upsert(
  File "/root/miniconda3/envs/extras/lib/python3.10/site-packages/chromadb/api/fastapi.py", line 274, in _upsert
    data=json.dumps(
  File "/root/miniconda3/envs/extras/lib/python3.10/json/__init__.py", line 231, in dumps
    return _default_encoder.encode(obj)
  File "/root/miniconda3/envs/extras/lib/python3.10/json/encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/root/miniconda3/envs/extras/lib/python3.10/json/encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
  File "/root/miniconda3/envs/extras/lib/python3.10/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type ndarray is not JSON serializable
192.168.43.52 - - [03/Jun/2023 20:15:44] "POST /api/chromadb HTTP/1.1" 500 -

<!-- gh-comment-id:1575170602 --> @BasadoBased commented on GitHub (Jun 3, 2023): Same, chroma addon doesn't work because of it. Traceback: ``` 192.168.43.52 - - [03/Jun/2023 20:15:41] "OPTIONS /api/chromadb HTTP/1.1" 200 - [2023-06-03 20:15:44,226] ERROR in app: Exception on /api/chromadb [POST] Traceback (most recent call last): File "/root/miniconda3/envs/extras/lib/python3.10/site-packages/flask/app.py", line 2190, in wsgi_app response = self.full_dispatch_request() File "/root/miniconda3/envs/extras/lib/python3.10/site-packages/flask/app.py", line 1486, in full_dispatch_request rv = self.handle_user_exception(e) File "/root/miniconda3/envs/extras/lib/python3.10/site-packages/flask_cors/extension.py", line 165, in wrapped_function return cors_after_request(app.make_response(f(*args, **kwargs))) File "/root/miniconda3/envs/extras/lib/python3.10/site-packages/flask/app.py", line 1484, in full_dispatch_request rv = self.dispatch_request() File "/root/miniconda3/envs/extras/lib/python3.10/site-packages/flask/app.py", line 1469, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) File "/scripts/SillyTavern-extras-main/server.py", line 289, in decorated_view return fn(*args, **kwargs) File "/scripts/SillyTavern-extras-main/server.py", line 715, in chromadb_add_messages collection.upsert( File "/root/miniconda3/envs/extras/lib/python3.10/site-packages/chromadb/api/models/Collection.py", line 306, in upsert self._client._upsert( File "/root/miniconda3/envs/extras/lib/python3.10/site-packages/chromadb/api/fastapi.py", line 274, in _upsert data=json.dumps( File "/root/miniconda3/envs/extras/lib/python3.10/json/__init__.py", line 231, in dumps return _default_encoder.encode(obj) File "/root/miniconda3/envs/extras/lib/python3.10/json/encoder.py", line 199, in encode chunks = self.iterencode(o, _one_shot=True) File "/root/miniconda3/envs/extras/lib/python3.10/json/encoder.py", line 257, in iterencode return _iterencode(o, 0) File "/root/miniconda3/envs/extras/lib/python3.10/json/encoder.py", line 179, in default raise TypeError(f'Object of type {o.__class__.__name__} ' TypeError: Object of type ndarray is not JSON serializable 192.168.43.52 - - [03/Jun/2023 20:15:44] "POST /api/chromadb HTTP/1.1" 500 - ```
Author
Owner

@kingbri1 commented on GitHub (Jun 3, 2023):

A current "workaround" is to not use remote chromadb hosting. The in-memory chromadb implementation has been updated to persist across extras launches on a local install. However, if you are on something such as colab, persistence will not occur and you will have to export your chat in ST.

tldr; Don't include --chroma-host and --chroma-portwhen starting up ST-extras until this issue is properly worked on.

<!-- gh-comment-id:1575182039 --> @kingbri1 commented on GitHub (Jun 3, 2023): A current "workaround" is to not use remote chromadb hosting. The in-memory chromadb implementation has been updated to persist across extras launches on a local install. However, if you are on something such as colab, persistence will not occur and you will have to export your chat in ST. tldr; Don't include `--chroma-host` and `--chroma-port`when starting up ST-extras until this issue is properly worked on.
Author
Owner

@BasadoBased commented on GitHub (Jun 3, 2023):

That workaround works for me, thank you for the information

<!-- gh-comment-id:1575189376 --> @BasadoBased commented on GitHub (Jun 3, 2023): That workaround works for me, thank you for the information
Author
Owner

@Cohee1207 commented on GitHub (Jun 3, 2023):

Fixed in github.com/SillyTavern/SillyTavern-extras@befdc746c5
Pull and check

<!-- gh-comment-id:1575238015 --> @Cohee1207 commented on GitHub (Jun 3, 2023): Fixed in https://github.com/SillyTavern/SillyTavern-extras/commit/befdc746c5312b872411a0b6d1ff1e4a2d664880 Pull and check
Author
Owner

@kingbri1 commented on GitHub (Jun 3, 2023):

I cannot check this since I'm away from my test machine at the moment. Can someone else take a look?

<!-- gh-comment-id:1575240478 --> @kingbri1 commented on GitHub (Jun 3, 2023): I cannot check this since I'm away from my test machine at the moment. Can someone else take a look?
Author
Owner

@Seedbeat commented on GitHub (Jun 5, 2023):

Seems work for remote chromadb, thanks!

<!-- gh-comment-id:1576819260 --> @Seedbeat commented on GitHub (Jun 5, 2023): Seems work for remote chromadb, thanks!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
SillyTavern/SillyTavern-Extras#32
No description provided.