From d03e9af0b7262bce1497ba8e49a7096279e9d7cd Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Fri, 31 Jul 2026 23:31:14 +0200 Subject: [PATCH] perf: use the orjson codec to parse Oracle vector metadata (#27813) `_json_to_metadata` parses the metadata of every result row returned by search and get. It now goes through `JSONCodec`, which selects orjson when `ENABLE_ORJSON` is set. The text it parses is produced by Oracle's own `JSON_SERIALIZE`, and the column is a native `JSON` type, so the database normalises whatever was written and the reader never depends on the writer's escaping. The matching `_metadata_to_json` write deliberately keeps stdlib `json`: it passes `default=self._decimal_handler`, orjson accepts none of stdlib's keyword arguments, and dropping the handler would turn a currently successful insert of a `Decimal` into a hard failure. The read side has no such constraint. With `ENABLE_ORJSON` unset, which is the default, `JSONCodec` is stdlib `json` and this call site behaves exactly as before. --- backend/open_webui/retrieval/vector/dbs/oracle23ai.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/open_webui/retrieval/vector/dbs/oracle23ai.py b/backend/open_webui/retrieval/vector/dbs/oracle23ai.py index b09eacb81d..bc3a5fbc8e 100644 --- a/backend/open_webui/retrieval/vector/dbs/oracle23ai.py +++ b/backend/open_webui/retrieval/vector/dbs/oracle23ai.py @@ -56,6 +56,7 @@ from open_webui.retrieval.vector.main import ( VectorDBBase, VectorItem, ) +from open_webui.utils.json_codec import JSONCodec log = logging.getLogger(__name__) @@ -390,7 +391,7 @@ class Oracle23aiClient(VectorDBBase): Returns: Dict: Metadata dictionary """ - return json.loads(json_str) if json_str else {} + return JSONCodec.loads(json_str) if json_str else {} def insert(self, collection_name: str, items: List[VectorItem]) -> None: """