MCPcopy Index your code
hub / github.com/algorithmicsuperintelligence/openevolve / log_prompt

Method log_prompt

openevolve/database.py:2533–2563  ·  view source on GitHub ↗

Log a prompt for a program. Only logs if self.config.log_prompts is True. Args: program_id: ID of the program to log the prompt for template_key: Key for the prompt template prompt: Prompts in the format {template_key: { 'system': str, 'user': str }}

(
        self,
        program_id: str,
        template_key: str,
        prompt: Dict[str, str],
        responses: Optional[List[str]] = None,
    )

Source from the content-addressed store, hash-verified

2531 return artifacts
2532
2533 def log_prompt(
2534 self,
2535 program_id: str,
2536 template_key: str,
2537 prompt: Dict[str, str],
2538 responses: Optional[List[str]] = None,
2539 ) -> None:
2540 """
2541 Log a prompt for a program.
2542 Only logs if self.config.log_prompts is True.
2543
2544 Args:
2545 program_id: ID of the program to log the prompt for
2546 template_key: Key for the prompt template
2547 prompt: Prompts in the format {template_key: { 'system': str, 'user': str }}.
2548 responses: Optional list of responses to the prompt, if available.
2549 """
2550
2551 if not self.config.log_prompts:
2552 return
2553
2554 if responses is None:
2555 responses = []
2556 prompt["responses"] = responses
2557
2558 if self.prompts_by_program is None:
2559 self.prompts_by_program = {}
2560
2561 if program_id not in self.prompts_by_program:
2562 self.prompts_by_program[program_id] = {}
2563 self.prompts_by_program[program_id][template_key] = prompt

Callers 2

_llm_evaluateMethod · 0.80
run_evolutionMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected