@@ -32,20 +32,20 @@ def run_model_and_get_history(model_path: str, url: str, steps: int) -> tuple[st
3232 source = Path (model_path ).read_text ()
3333
3434 # Dynamically load the model module
35- spec = importlib .util .spec_from_file_location (" generated_model" , model_path )
35+ spec = importlib .util .spec_from_file_location (' generated_model' , model_path )
3636 module = importlib .util .module_from_spec (spec )
3737 spec .loader .exec_module (module )
3838
3939 # Find the model class (first class with step_* methods)
4040 model_class = None
4141 for attr_name in dir (module ):
4242 attr = getattr (module , attr_name )
43- if isinstance (attr , type ) and any (m .startswith (" step_" ) for m in dir (attr )):
43+ if isinstance (attr , type ) and any (m .startswith (' step_' ) for m in dir (attr )):
4444 model_class = attr
4545 break
4646
4747 if model_class is None :
48- print (" Error: No PyOsmo model class found in the file" )
48+ print (' Error: No PyOsmo model class found in the file' )
4949 sys .exit (1 )
5050
5151 with sync_playwright () as p :
@@ -70,18 +70,18 @@ async def refine_model(model_path: str, url: str, steps: int) -> None:
7070 try :
7171 from claude_agent_sdk import Agent , AgentConfig
7272 except ImportError :
73- print (" Error: claude-agent-sdk is required. Install with: pip install claude-agent-sdk" )
73+ print (' Error: claude-agent-sdk is required. Install with: pip install claude-agent-sdk' )
7474 sys .exit (1 )
7575
7676 from prompt_template import REFINEMENT_PROMPT
7777
78- print (f" Running model { model_path } ..." )
78+ print (f' Running model { model_path } ...' )
7979 source , history_json = run_model_and_get_history (model_path , url , steps )
8080
81- print (" Analyzing results and refining model..." )
81+ print (' Analyzing results and refining model...' )
8282
8383 agent = Agent (
84- model = " claude-sonnet-4-5-20250929" ,
84+ model = ' claude-sonnet-4-5-20250929' ,
8585 config = AgentConfig (system_prompt = REFINEMENT_PROMPT ),
8686 )
8787
@@ -107,22 +107,22 @@ async def refine_model(model_path: str, url: str, steps: int) -> None:
107107
108108 # Write refined model back
109109 Path (model_path ).write_text (result )
110- print (f" Refined model written to { model_path } " )
110+ print (f' Refined model written to { model_path } ' )
111111
112112
113113def main () -> None :
114- parser = argparse .ArgumentParser (description = " Refine a PyOsmo model based on test results" )
115- parser .add_argument (" model_file" , help = " Path to the PyOsmo model file" )
116- parser .add_argument (" --url" , required = True , help = " URL of the web application" )
117- parser .add_argument (" --steps" , type = int , default = 20 , help = " Steps per test (default: 20)" )
118- parser .add_argument (" --iterations" , type = int , default = 1 , help = " Refinement iterations (default: 1)" )
114+ parser = argparse .ArgumentParser (description = ' Refine a PyOsmo model based on test results' )
115+ parser .add_argument (' model_file' , help = ' Path to the PyOsmo model file' )
116+ parser .add_argument (' --url' , required = True , help = ' URL of the web application' )
117+ parser .add_argument (' --steps' , type = int , default = 20 , help = ' Steps per test (default: 20)' )
118+ parser .add_argument (' --iterations' , type = int , default = 1 , help = ' Refinement iterations (default: 1)' )
119119 args = parser .parse_args ()
120120
121121 for i in range (args .iterations ):
122122 if args .iterations > 1 :
123- print (f" \n --- Refinement iteration { i + 1 } /{ args .iterations } ---" )
123+ print (f' \n --- Refinement iteration { i + 1 } /{ args .iterations } ---' )
124124 asyncio .run (refine_model (args .model_file , args .url , args .steps ))
125125
126126
127- if __name__ == " __main__" :
127+ if __name__ == ' __main__' :
128128 main ()
0 commit comments