support JSON output for ollama and openai

This commit is contained in:
b10902118
2024-11-29 21:41:37 +08:00
parent 4223b4f603
commit 753c1e6714
3 changed files with 42 additions and 18 deletions

View File

@@ -54,7 +54,7 @@ def locate_json_string_body_from_string(content: str) -> Union[str, None]:
maybe_json_str = maybe_json_str.replace("\\n", "")
maybe_json_str = maybe_json_str.replace("\n", "")
maybe_json_str = maybe_json_str.replace("'", '"')
json.loads(maybe_json_str)
# json.loads(maybe_json_str) # don't check here, cannot validate schema after all
return maybe_json_str
except Exception:
pass