Spaces:
Sleeping
Sleeping
Rename prompts/prompt_templates.py to prompts/narrative_prompts.py
Browse files- prompts/narrative_prompts.py +30 -0
- prompts/prompt_templates.py +0 -70
prompts/narrative_prompts.py
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# storyverse_weaver/prompts/narrative_prompts.py
|
2 |
+
|
3 |
+
NARRATIVE_SYSTEM_PROMPT_DEFAULT = (
|
4 |
+
"You are a master storyteller and descriptive writer. Your task is to take a user's scene idea "
|
5 |
+
"and expand it into a vivid and engaging narrative segment. Focus on imagery, atmosphere, and character actions "
|
6 |
+
"or emotions if mentioned. Keep the tone consistent with the user's prompt. Aim for about 1-3 paragraphs."
|
7 |
+
)
|
8 |
+
|
9 |
+
NARRATIVE_SYSTEM_PROMPT_COMIC = (
|
10 |
+
"You are a concise and impactful comic book writer. Given a scene description, write a brief but evocative narrative "
|
11 |
+
"caption or description suitable for a comic panel. Focus on key actions, settings, and dialogue cues. "
|
12 |
+
"Be punchy and visually oriented. Output 1-2 short paragraphs or a few descriptive sentences."
|
13 |
+
)
|
14 |
+
|
15 |
+
|
16 |
+
def get_narrative_system_prompt(story_type: str = "default") -> str:
|
17 |
+
if story_type == "comic":
|
18 |
+
return NARRATIVE_SYSTEM_PROMPT_COMIC
|
19 |
+
return NARRATIVE_SYSTEM_PROMPT_DEFAULT
|
20 |
+
|
21 |
+
def format_narrative_user_prompt(scene_idea: str, previous_narrative: str = None, character_context: str = None) -> str:
|
22 |
+
prompt = f"The user wants to create a scene based on this idea: \"{scene_idea}\"\n\n"
|
23 |
+
if previous_narrative:
|
24 |
+
prompt += f"For context, the previous scene's narrative ended with:\n\"\"\"\n{previous_narrative[:500]}...\n\"\"\"\n\n" # Limit context
|
25 |
+
if character_context:
|
26 |
+
prompt += f"Relevant character context to consider: \"{character_context}\"\n\n"
|
27 |
+
prompt += "Please write the narrative for the current scene based on the user's idea and any provided context."
|
28 |
+
return prompt
|
29 |
+
|
30 |
+
print("DEBUG: prompts.narrative_prompts (for StoryVerseWeaver) - Module defined.")
|
prompts/prompt_templates.py
DELETED
@@ -1,70 +0,0 @@
|
|
1 |
-
# algoforge_prime/prompts/prompt_templates.py
|
2 |
-
|
3 |
-
# These functions help construct the user-facing part of the prompts,
|
4 |
-
# ensuring consistency and making it easier to manage complex prompt structures.
|
5 |
-
|
6 |
-
def format_genesis_user_prompt(
|
7 |
-
problem_description: str,
|
8 |
-
initial_hints: str,
|
9 |
-
attempt_num: int,
|
10 |
-
total_attempts: int
|
11 |
-
) -> str:
|
12 |
-
"""Formats the user prompt for the Genesis (initial solution generation) stage."""
|
13 |
-
hints_section = f"Initial Thoughts/Constraints to consider: \"{initial_hints}\"" if initial_hints else "No specific initial hints provided."
|
14 |
-
return (
|
15 |
-
f"User Problem Description: \"{problem_description}\"\n\n"
|
16 |
-
f"{hints_section}\n\n"
|
17 |
-
f"Task: Please provide one distinct and complete algorithmic solution or well-commented code (as appropriate for the problem type) to address the problem description. "
|
18 |
-
f"This is solution attempt #{attempt_num} of {total_attempts}. "
|
19 |
-
f"If possible, try to offer a different approach or perspective compared to what might be a very obvious first attempt."
|
20 |
-
)
|
21 |
-
|
22 |
-
def format_critique_user_prompt(
|
23 |
-
problem_description_context: str, # A snippet for context
|
24 |
-
solution_text_to_evaluate: str
|
25 |
-
) -> str:
|
26 |
-
"""Formats the user prompt for the Critique (evaluation) stage."""
|
27 |
-
return (
|
28 |
-
f"Context: The overall problem being solved is related to: \"{problem_description_context[:200]}...\"\n\n"
|
29 |
-
f"Solution to Evaluate:\n"
|
30 |
-
f"```\n{solution_text_to_evaluate}\n```\n\n"
|
31 |
-
f"Task: Critically evaluate this solution according to the system instructions (correctness, efficiency, clarity, etc.). "
|
32 |
-
f"Remember to provide your overall assessment and conclude with the mandatory 'Score: X/10' line."
|
33 |
-
)
|
34 |
-
|
35 |
-
def format_evolution_user_prompt(
|
36 |
-
problem_description_context: str,
|
37 |
-
original_solution_text: str,
|
38 |
-
comprehensive_critique_text: str, # Includes LLM critique and test summary
|
39 |
-
original_score: int
|
40 |
-
) -> str:
|
41 |
-
"""Formats the user prompt for the Evolution (refinement) stage."""
|
42 |
-
return (
|
43 |
-
f"Context: The original problem is: \"{problem_description_context}\"\n\n"
|
44 |
-
f"Solution to Evolve (Original Score: {original_score}/10):\n"
|
45 |
-
f"```\n{original_solution_text}\n```\n\n"
|
46 |
-
f"Comprehensive Evaluation Received for the Above Solution:\n"
|
47 |
-
f"'''\n{comprehensive_critique_text}\n'''\n\n"
|
48 |
-
f"Task: Based on the provided solution and its comprehensive evaluation, your goal is to evolve it into a significantly improved version. "
|
49 |
-
f"Address all identified weaknesses, enhance its strengths, and ensure it is more robust, efficient, or clear. "
|
50 |
-
f"Output the *complete evolved solution*. "
|
51 |
-
f"Follow this with a brief explanation of the key changes and improvements you implemented."
|
52 |
-
)
|
53 |
-
|
54 |
-
def format_code_test_analysis_user_prompt(
|
55 |
-
generated_code: str,
|
56 |
-
unit_tests_code: str,
|
57 |
-
test_execution_summary: str # e.g., "Simulated: 2/3 tests passed. Some tests likely failed."
|
58 |
-
) -> str:
|
59 |
-
"""Formats the user prompt for asking an LLM to analyze code test results."""
|
60 |
-
return (
|
61 |
-
f"Generated Python Code:\n"
|
62 |
-
f"```python\n{generated_code}\n```\n\n"
|
63 |
-
f"Unit Tests Applied:\n"
|
64 |
-
f"```python\n{unit_tests_code}\n```\n\n"
|
65 |
-
f"Test Execution Summary:\n"
|
66 |
-
f"'''\n{test_execution_summary}\n'''\n\n"
|
67 |
-
f"Task: Please analyze these test results in relation to the generated Python code. "
|
68 |
-
f"Provide a concise explanation of what the test outcomes (passes, failures, errors) indicate about the code's correctness or potential issues. "
|
69 |
-
f"If tests failed, suggest likely reasons or areas in the code to inspect."
|
70 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|