Make generated code block extractor less strict to improve code tool

This commit is contained in:
Debanjum
2025-04-03 14:07:15 +05:30
parent 66e9ddb6be
commit 17997d26c5

View File

@@ -161,7 +161,7 @@ async def generate_python_code(
)
# Extract python code wrapped in markdown code blocks from the response
code_blocks = re.findall(r"```(?:python)?\n(.*?)\n```", response, re.DOTALL)
code_blocks = re.findall(r"```(?:python)?\n(.*?)```", response, re.DOTALL)
if not code_blocks:
raise ValueError("No Python code blocks found in response")