ana-35's picture
incorporated code reviewer
b4f20f1
raw
history blame contribute delete
426 Bytes
from langchain.tools import Tool
import ast
def code_review_tool(code: str) -> str:
try:
tree = ast.parse(code)
return " Code parsed successfully. No syntax errors detected."
except SyntaxError as e:
return f"SyntaxError: {e}"
code_reviewer = Tool.from_function(
name="code_reviewer",
description="Reviews Python code for syntax errors and basic issues.",
func=code_review_tool
)