mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-06 21:29:12 +00:00
Remove ```python codeblock prefix from raw json before deserialize
This commit is contained in:
@@ -528,7 +528,7 @@ def reciprocal_conversation_to_chatml(message_pair):
|
||||
|
||||
def clean_json(response: str):
|
||||
"""Remove any markdown json codeblock and newline formatting if present. Useful for non schema enforceable models"""
|
||||
return response.strip().replace("\n", "").removeprefix("```json").removesuffix("```")
|
||||
return response.strip().replace("\n", "").removeprefix("```json").removeprefix("```python").removesuffix("```")
|
||||
|
||||
|
||||
def clean_code_python(code: str):
|
||||
|
||||
Reference in New Issue
Block a user