feat: support deepseek models (#821)

Co-authored-by: Charles Packer <packercharles@gmail.com>
Co-authored-by: Sarah Wooders <sarahwooders@gmail.com>
Co-authored-by: Shubham Naik <shub@memgpt.ai>
Co-authored-by: Shubham Naik <shub@letta.com>
This commit is contained in:
Kevin Lin
2025-02-18 15:28:01 -08:00
committed by GitHub
parent 6d49dc1ac5
commit 98f0062416
18 changed files with 709 additions and 20 deletions

View File

@@ -824,12 +824,16 @@ def parse_json(string) -> dict:
result = None
try:
result = json_loads(string)
if not isinstance(result, dict):
raise ValueError(f"JSON from string input ({string}) is not a dictionary (type {type(result)}): {result}")
return result
except Exception as e:
print(f"Error parsing json with json package: {e}")
try:
result = demjson.decode(string)
if not isinstance(result, dict):
raise ValueError(f"JSON from string input ({string}) is not a dictionary (type {type(result)}): {result}")
return result
except demjson.JSONDecodeError as e:
print(f"Error parsing json with demjson package: {e}")