MCPcopy Create free account
hub / github.com/caesarHQ/textSQL / extract_sql_from_markdown

Function extract_sql_from_markdown

api/app/api/utils/messages.py:160–172  ·  view source on GitHub ↗
(assistant_message_content)

Source from the content-addressed store, hash-verified

158
159
160def extract_sql_from_markdown(assistant_message_content):
161 regex = r"```([\s\S]+?)```"
162 matches = re.findall(regex, assistant_message_content)
163
164 if matches:
165 code_str = matches[0]
166 match = re.search(r"(?i)sql\s+(.*)", code_str, re.DOTALL)
167 if match:
168 code_str = match.group(1)
169 else:
170 code_str = assistant_message_content
171
172 return code_str

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected