mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-23 15:38:55 +01:00
Remove ```python codeblock prefix from raw json before deserialize
This commit is contained in:
parent
001c13ef43
commit
0e7d611a80
1 changed files with 1 additions and 1 deletions
|
@ -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):
|
||||
|
|
Loading…
Reference in a new issue