MCPcopy Create free account
hub / github.com/FareedKhan-dev/ai-long-task / log_prompt

Method log_prompt

data/database.py:2537–2567  ·  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

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

Callers 2

run_evolutionMethod · 0.80
_llm_evaluateMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected