MCPcopy Index your code
hub / github.com/caesarHQ/textSQL / extract_json_str_from_markdown

Function extract_json_str_from_markdown

byod/api/app/visualization/utils.py:95–106  ·  view source on GitHub ↗
(assistant_message_content)

Source from the content-addressed store, hash-verified

93
94
95def extract_json_str_from_markdown(assistant_message_content) -> str:
96 matches = re.findall(r"```([\s\S]+?)```", assistant_message_content)
97
98 if matches:
99 code_str = matches[0]
100 match = re.search(r"(?i)bash\s+(.*)", code_str, re.DOTALL)
101 if match:
102 code_str = match.group(1)
103 else:
104 code_str = assistant_message_content
105
106 return code_str

Callers 2

get_vega_lite_specFunction · 0.85
get_changed_vegaFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected