-
Notifications
You must be signed in to change notification settings - Fork 57
Expand file tree
/
Copy pathtest_lovable_clone.py
More file actions
55 lines (44 loc) · 1.89 KB
/
test_lovable_clone.py
File metadata and controls
55 lines (44 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import pytest
from examples.lovable_clone.lovable_agent import LovableAgent
import scenario
scenario.configure(
default_model="openai/gpt-4.1-mini",
)
class LovableAgentAdapter(scenario.AgentAdapter):
def __init__(self, template_path: str):
self.lovable_agent = LovableAgent(template_path)
async def call(self, input: scenario.AgentInput) -> scenario.AgentReturnTypes:
_, messages = await self.lovable_agent.process_user_message(
input.last_new_user_message_str()
)
return messages
@pytest.mark.agent_test
@pytest.mark.flaky(reruns=2)
@pytest.mark.asyncio
async def test_lovable_clone():
template_path = LovableAgent.clone_template()
print(f"\n-> Lovable clone template path: {template_path}\n")
result = await scenario.run(
name="dog walking startup landing page",
description="""
the user wants to create a new landing page for their dog walking startup
send the first message to generate the landing page, then a single follow up request to extend it, then give your final verdict
""",
agents=[
LovableAgentAdapter(template_path=template_path),
scenario.UserSimulatorAgent(),
scenario.JudgeAgent(
criteria=[
"agent reads the files before go and making changes",
"agent modified the index.css file, not only the Index.tsx file",
"agent created a comprehensive landing page",
"agent made multiple changes or iterations on the landing page",
"agent should NOT say it can't read the file",
"agent should NOT produce incomplete code or be too lazy to finish",
],
),
],
max_turns=5, # optional
set_id="python-examples", # Add set_id parameter
)
assert result.success