MCPcopy Create free account
hub / github.com/OpenBMB/AgentCPM-GUI / extract_and_validate_json

Function extract_and_validate_json

eval/run_predict_qwen2_5VL.py:379–392  ·  view source on GitHub ↗
(input_string)

Source from the content-addressed store, hash-verified

377
378
379def extract_and_validate_json(input_string):
380 # if input_string == "":
381 # raise ValueError("Error, empty output.")
382 try:
383 json_obj = json.loads(input_string)
384 # validate JSON data against Schema
385 jsonschema.validate(json_obj, ACTION_THOUGHT_SCHEMA)
386 return json_obj
387 except json.JSONDecodeError as e:
388 print("Error, JSON is NOT valid.",input_string,"over")
389 return input_string
390 except Exception as e:
391 print("Error, JSON is NOT valid according to the schema.",input_string,"over")
392 return input_string
393
394def load_image(episode,image_path,history_list,use_low_instruction):
395 return (episode,image_path,history_list,use_low_instruction)

Callers 1

run_episodeFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected