Skip to content

Commit e61c0ca

Browse files
authored
Merge pull request #692 from brochure/main
Update base.py
2 parents 457b296 + 008a1a3 commit e61c0ca

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/vanna/base/base.py

+3
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,9 @@ def generate_question(self, sql: str, **kwargs) -> str:
689689
return response
690690

691691
def _extract_python_code(self, markdown_string: str) -> str:
692+
# Strip whitespace to avoid indentation errors in LLM-generated code
693+
markdown_string = markdown_string.strip()
694+
692695
# Regex pattern to match Python code blocks
693696
pattern = r"```[\w\s]*python\n([\s\S]*?)```|```([\s\S]*?)```"
694697

0 commit comments

Comments
 (0)