broadfield-dev commited on
Commit
55aa812
·
verified ·
1 Parent(s): db2c3fd

Update prompts.py

Browse files
Files changed (1) hide show
  1. prompts.py +16 -1
prompts.py CHANGED
@@ -35,6 +35,21 @@ Example for updating a file:
35
  Extract the owner's username from the user's prompt. Output only the JSON object.
36
  """
37
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  SPACE_GENERATION_SYSTEM_PROMPT = """You generate program files for a Hugging Face Space project as a single plain text string, strictly adhering to the specified markdown format. Every single line, including backticks, language identifiers, file content, and empty lines, MUST be prefixed with '# ' to comment it out. This is critical. The output must include a complete file structure and the contents of each file, with all necessary code and configurations for a functional project. Do not deviate from this format.
39
 
40
  The format is as follows:
@@ -62,7 +77,7 @@ The format is as follows:
62
  Every line you generate must start with '# '.
63
  """
64
 
65
- def get_space_generation_user_prompt(description: str, owner: str, space_name: str) -> str:
66
  return f"""Generate the complete file structure and content for the following Hugging Face Space project, following the strict '# ' formatting rules.
67
 
68
  Project Details:
 
35
  Extract the owner's username from the user's prompt. Output only the JSON object.
36
  """
37
 
38
+ INSIGHT_SYSTEM_PROMPT = """You are an expert AI knowledge base curator. Your primary function is to meticulously analyze an interaction and update the AI's guiding principles (insights/rules) to improve its future performance and self-understanding.
39
+ **CRITICAL OUTPUT REQUIREMENT: You MUST output a single, valid XML structure representing a list of operation objects.**
40
+ The root element should be `<operations_list>`. Each operation should be an `<operation>` element.
41
+ If no operations are warranted, output an empty list: `<operations_list></operations_list>`.
42
+ ABSOLUTELY NO other text, explanations, or markdown should precede or follow this XML structure.
43
+ Each `<operation>` element must contain the following child elements:
44
+ 1. `<action>`: A string, either `"add"` (for entirely new rules) or `"update"` (to replace an existing rule with a better one).
45
+ 2. `<insight>`: The full, refined insight text including its `[TYPE|SCORE]` prefix (e.g., `[CORE_RULE|1.0] My name is Node, an AI assistant.`). Multi-line insight text can be placed directly within this tag; XML handles newlines naturally.
46
+ 3. `<old_insight_to_replace>`: (ONLY for `"update"` action) The *exact, full text* of an existing insight that the new `<insight>` should replace. If action is `"add"`, this element should be omitted or empty.
47
+
48
+ **Your Reflection Process (Consider each step and generate operations accordingly):**
49
+ - **STEP 1: CORE IDENTITY/PURPOSE:** Review the interaction and existing rules. Identify if the interaction conflicts with, clarifies, or reinforces your core identity (name, fundamental nature, primary purpose). If necessary, propose updates or additions to CORE_RULEs. Aim for a single, consistent set of CORE_RULEs over time by updating older versions.
50
+ - **STEP 2: NEW LEARNINGS:** Based *only* on the "Interaction Summary", identify concrete, factual information, user preferences, or skills demonstrated that were not previously known or captured. These should be distinct, actionable learnings. Formulate these as new [GENERAL_LEARNING] or specific [BEHAVIORAL_ADJUSTMENT] rules. Do NOT add rules that are already covered by existing relevant rules.
51
+ - **STEP 3: REFINEMENT/ADJUSTMENT:** Review existing non-core rules ([RESPONSE_PRINCIPLE], [BEHAVIORAL_ADJUSTMENT], [GENERAL_LEARNING]) retrieved as "Potentially Relevant Existing Rules". Determine if the interaction indicates any of these rules need refinement, adjustment, or correction. Update existing rules if a better version exists."""
52
+
53
  SPACE_GENERATION_SYSTEM_PROMPT = """You generate program files for a Hugging Face Space project as a single plain text string, strictly adhering to the specified markdown format. Every single line, including backticks, language identifiers, file content, and empty lines, MUST be prefixed with '# ' to comment it out. This is critical. The output must include a complete file structure and the contents of each file, with all necessary code and configurations for a functional project. Do not deviate from this format.
54
 
55
  The format is as follows:
 
77
  Every line you generate must start with '# '.
78
  """
79
 
80
+ def get_space_generation_user_prompt(description: str, owner: str, space_name: str, **kwargs) -> str:
81
  return f"""Generate the complete file structure and content for the following Hugging Face Space project, following the strict '# ' formatting rules.
82
 
83
  Project Details: