Rahul-8799 commited on
Commit
ca93e90
·
verified ·
1 Parent(s): 6e4b85e

Create qa.py

Browse files
Files changed (1) hide show
  1. agents/qa.py +27 -0
agents/qa.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from langchain_core.messages import AIMessage
2
+ from utils.inference import call_model
3
+
4
+ def run(state):
5
+ html = state["html_output"]
6
+ iteration = state["iteration"]
7
+
8
+ prompt = f"""You are a QA engineer. Review the following HTML code:
9
+
10
+ {html}
11
+
12
+ Evaluate the UI for:
13
+ 1. Visual quality
14
+ 2. Responsiveness
15
+ 3. Code correctness
16
+ 4. Functional completeness
17
+
18
+ If it is perfect, reply only with 'APPROVED'.
19
+ If not, list clear improvements required."""
20
+ output = call_model(prompt)
21
+ done = "APPROVED" in output.upper()
22
+ return {
23
+ "messages": state["messages"] + [AIMessage(content=output)],
24
+ "qa_feedback": output,
25
+ "iteration": iteration + 1,
26
+ "done": done
27
+ }