@@ -281,14 +281,16 @@ def _container_tool_reaction(self, cur_round: int,
281281 results .append (result )
282282 return DefaultTemplateBuilder (self .llm , initial = results ).build ([])
283283
284- def _initialize_chat_session (self , tools : list [ BaseTool ] ) -> ChatSession :
284+ def _initialize_chat_session (self ) -> ChatSession :
285285 """Initializes the LLM chat session with |tools|"""
286286 functions = [
287287 FunctionDeclaration (
288288 name = 'inspect_code_or_conclude_fuzz_target' ,
289289 description =
290- ('Inspect source code and environment variables with parameters `reason` and `command` or conclude the revised fuzz target generation result with parameters `summary`, `fuzz_target`, and `build_script`. '
291- ),
290+ ('Inspect source code and environment variables with parameters '
291+ '`reason` and `command` or conclude the revised fuzz target '
292+ 'generation result with parameters `summary`, `fuzz_target`, and '
293+ '`build_script`.' ),
292294 parameters = {
293295 'type' : 'object' ,
294296 'properties' : {
@@ -299,17 +301,17 @@ def _initialize_chat_session(self, tools: list[BaseTool]) -> ChatSession:
299301 'type' :
300302 'string' ,
301303 'description' : (
302- 'The reason to execute the command. E.g., Inspect and '
303- 'learn from all existing human written fuzz targets as '
304- 'examples.' )
304+ 'The reason to execute the command. E.g., '
305+ 'Inspect and learn from all existing human '
306+ 'written fuzz targets as examples.' )
305307 },
306308 'command' : {
307309 'type' :
308310 'string' ,
309311 'description' : (
310- 'The bash command to execute. E.g., grep -rlZ '
311- '"LLVMFuzzerTestOneInput(" "$(dirname {FUZZ_TARGET_PATH})" '
312- ' | xargs -0 cat' )
312+ 'The bash command to execute. E.g., grep '
313+ '-rlZ "LLVMFuzzerTestOneInput(" "$(dirname '
314+ '{FUZZ_TARGET_PATH})" | xargs -0 cat' )
313315 }
314316 },
315317 'required' : ['reason' , 'command' ]
@@ -321,25 +323,28 @@ def _initialize_chat_session(self, tools: list[BaseTool]) -> ChatSession:
321323 'type' :
322324 'string' ,
323325 'description' : (
324- 'The reason to execute the command. E.g., Inspect and '
325- 'learn from all existing human written fuzz targets as '
326- 'examples .' )
326+ 'The important notes, insights, and lessons '
327+ 'learnt above when generating the fuzz '
328+ 'target and the build script .' )
327329 },
328330 'fuzz_target' : {
329331 'type' :
330332 'string' ,
331333 'description' : (
332- 'The revised fuzz target in full. Do not omit any '
333- 'code even if it is the same as the previous one.'
334- )
334+ 'The **entire** revised fuzz target. Ensure'
335+ ' the modified code is correctly integrated'
336+ ' into the full code context, do not omit '
337+ 'any unchanged part of the original code.' )
335338 },
336339 'build_script' : {
337340 'type' :
338341 'string' ,
339342 'description' : (
340- 'The full build script if different from the '
341- 'existing one. Do not omit any code even if it is '
342- 'the same as the previous one.' )
343+ 'The **entire** revised build script. '
344+ 'Ensure the modified code is correctly '
345+ 'integrated into the full code context, do '
346+ 'not omit any unchanged part of the '
347+ 'original code.' )
343348 }
344349 },
345350 'required' : ['summary' , 'fuzz_target' , 'build_script' ]
@@ -353,7 +358,6 @@ def _initialize_chat_session(self, tools: list[BaseTool]) -> ChatSession:
353358 function_calling_config = ToolConfig .FunctionCallingConfig (
354359 mode = ToolConfig .FunctionCallingConfig .Mode .ANY ))
355360 model = self .llm .get_model ()
356- logger .info ('Tools: %s' , model ._tools )
357361 return self .llm .get_chat_client (model = model )
358362
359363 def execute (self , result_history : list [Result ]) -> BuildResult :
@@ -368,7 +372,7 @@ def execute(self, result_history: list[Result]) -> BuildResult:
368372 assert isinstance (build_result , BuildResult )
369373 prompt = self ._initial_prompt (result_history )
370374 try :
371- client = self ._initialize_chat_session ([ self . inspect_tool ] )
375+ client = self ._initialize_chat_session ()
372376 while prompt and cur_round < MAX_ROUND :
373377 response = self .chat_llm (cur_round , client = client , prompt = prompt )
374378 prompt = self ._container_tool_reaction (cur_round , response ,
0 commit comments