MAC_UI / agents /qa.py
Rahul-8799's picture
Create qa.py
ca93e90 verified
raw
history blame contribute delete
694 Bytes
from langchain_core.messages import AIMessage
from utils.inference import call_model
def run(state):
html = state["html_output"]
iteration = state["iteration"]
prompt = f"""You are a QA engineer. Review the following HTML code:
{html}
Evaluate the UI for:
1. Visual quality
2. Responsiveness
3. Code correctness
4. Functional completeness
If it is perfect, reply only with 'APPROVED'.
If not, list clear improvements required."""
output = call_model(prompt)
done = "APPROVED" in output.upper()
return {
"messages": state["messages"] + [AIMessage(content=output)],
"qa_feedback": output,
"iteration": iteration + 1,
"done": done
}