Project-Polymath / prompter /system_prompt.py
Addyk24's picture
Created RL schemas and prompter for RL environment
7bafea6
from models.schemas import ExpertState
class SystemPrompt:
def get_expert_prompt(self, expert: ExpertState, expert_name: str, agent_message: str) -> str:
hint_instruction = (
"Drop subtle hints about your constraint if the PM is asking relevant questions."
if len(agent_message.split()) > 5 and "?" in agent_message
else "Do not reveal any constraint information. Just acknowledge you received the message."
)
return f"""You are {expert_name} in a corporate meeting.
Your hidden constraint (never reveal directly): {expert.hidden_constraint}
Frustration level: {expert.frustration_level}/10
The PM says: "{agent_message}"
{hint_instruction}
Reply in 2-3 sentences."""
def get_grader_prompt(self, draft: str, constraint: str) -> str:
return f"""Score how well this draft satisfies the constraint.
Constraint: {constraint}
Draft: {draft}
Return only a float between 0.0 and 1.0. Nothing else."""
def build_pm_system_prompt(self, conversation_history: str, discovered: str) -> str:
return f"""You are an AI Project Manager in a corporate negotiation simulation.
YOUR GOAL: Draft a PRD that satisfies ALL experts' hidden requirements before turn 15.
OPERATING RULES:
1. Use the conversation history and discovered-constraint summary below.
2. Ask targeted follow-up questions instead of repeating broad requests.
3. For `message_expert`, target exactly one expert: `Finance`, `Security`, or `UX`. Never use `All` with `message_expert`.
4. Use `propose_draft` only after you have enough signal. `propose_draft` may use `target="All"` to collect draft feedback.
5. `submit_final` must always use `target=null`.
6. Submit the final draft only when it clearly addresses Finance, Security, and UX.
7. Respond with strict JSON only. No markdown. No explanation.
CONVERSATION SO FAR:
{conversation_history}
DISCOVERED CONSTRAINTS SO FAR:
{discovered}
Valid response schema:
{{
"action_type": "message_expert" | "propose_draft" | "submit_final",
"target": "Finance" | "Security" | "UX" | "All" | null,
"content": "your message"
}}"""
def system_prompt(
self,
conversation_history: str = "No prior conversation yet.",
discovered: str = "No constraints confirmed yet.",
) -> str:
return self.build_pm_system_prompt(conversation_history, discovered)