@@ -219,17 +219,17 @@ def generate_followup_prompt():
219219"""
220220
221221
222- def _create_client (remote_api = False ):
223- if remote_api :
224- return OpenAI (base_url = "https ://api.deepseek.com " ), "deepseek-reasoner"
225- # Otherwise sglang
226- return OpenAI ( api_key = "none" , base_url = "http://0.0.0.0:30000/v1" ), "default"
222+ def _create_client ():
223+ return (
224+ OpenAI (api_key = "none" , base_url = "http ://localhost:30000/v1 " ),
225+ "default" ,
226+ )
227227
228228
229- def datagen_for_one_cwe (cwe_id , markdown , depth , remote_api = False ):
229+ def datagen_for_one_cwe (cwe_id , markdown , depth ):
230230 assert depth > 0
231231
232- client , model = _create_client (remote_api = remote_api )
232+ client , model = _create_client ()
233233 common_args = {"model" : model , "temperature" : 0.6 }
234234
235235 rprint (f"[bold yellow]Processing: CWE ID: { cwe_id } [/bold yellow]" )
@@ -277,10 +277,10 @@ def main(
277277 parallel = 256 ,
278278 output_path = "outputs/rule2code/cwe2code.jsonl" ,
279279 depth = 1 ,
280- remote_api = False ,
281280):
281+ os .makedirs (os .path .dirname (output_path ), exist_ok = True )
282+
282283 collection = create_cwe_information ()
283- # each line: cwe_id, conversation
284284
285285 finished = set ()
286286 if os .path .exists (output_path ):
@@ -294,9 +294,7 @@ def main(
294294 if cwe_id in finished :
295295 continue
296296 futures .append (
297- executor .submit (
298- datagen_for_one_cwe , cwe_id , markdown , depth , remote_api
299- )
297+ executor .submit (datagen_for_one_cwe , cwe_id , markdown , depth )
300298 )
301299
302300 for future in tqdm (as_completed (futures ), total = len (futures )):
0 commit comments