From 720959a926e14bd5e2bccd519927cccb6e6ceff7 Mon Sep 17 00:00:00 2001 From: Phuc Van Phan <phanphuc1100@gmail.com> Date: Wed, 13 Mar 2024 04:01:28 +0700 Subject: [PATCH] fix: add postpreprocess_output_processor to json_query.py (#11862) --- .../llama_index/core/indices/struct_store/json_query.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/llama-index-core/llama_index/core/indices/struct_store/json_query.py b/llama-index-core/llama_index/core/indices/struct_store/json_query.py index 9e48eb786..6b6909154 100644 --- a/llama-index-core/llama_index/core/indices/struct_store/json_query.py +++ b/llama-index-core/llama_index/core/indices/struct_store/json_query.py @@ -63,6 +63,9 @@ def default_output_response_parser(llm_output: str) -> str: def default_output_processor(llm_output: str, json_value: JSONType) -> JSONType: """Default output processor that extracts values based on JSON Path expressions.""" + # Post-process the LLM output to remove the JSONPath: prefix + llm_output = llm_output.replace("JSONPath: ", "").replace("JSON Path: ", "").strip() + # Split the given string into separate JSON Path expressions expressions = [expr.strip() for expr in llm_output.split(",")] -- GitLab