Spaces:
Runtime error
Runtime error
Update prompts.py
Browse files- prompts.py +20 -2
prompts.py
CHANGED
@@ -7,7 +7,13 @@ DEFAULT_SYSTEM_PROMPT = os.getenv(
|
|
7 |
)
|
8 |
|
9 |
METRICS_SYSTEM_PROMPT = "You are a precise JSON output agent. Output a single JSON object containing interaction metrics as requested by the user. Do not include any explanatory text before or after the JSON object."
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
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.
|
12 |
**CRITICAL OUTPUT REQUIREMENT: You MUST output a single, valid XML structure representing a list of operation objects.**
|
13 |
The root element should be `<operations_list>`. Each operation should be an `<operation>` element.
|
@@ -27,7 +33,19 @@ def get_metrics_user_prompt(user_input: str, bot_response: str) -> str:
|
|
27 |
return f"User: \"{user_input}\"\nAI: \"{bot_response}\"\nMetrics: \"takeaway\" (3-7 words), \"response_success_score\" (0.0-1.0), \"future_confidence_score\" (0.0-1.0). Output JSON ONLY, ensure it's a single, valid JSON object."
|
28 |
|
29 |
def get_tool_user_prompt(user_input: str, history_snippet: str, guideline_snippet: str) -> str:
|
30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
|
32 |
def get_final_response_prompt(history_str: str, insights_str: str, user_input: str, context_str: str = None) -> str:
|
33 |
base = f"History:\n{history_str}\n\nGuidelines:\n{insights_str}"
|
|
|
7 |
)
|
8 |
|
9 |
METRICS_SYSTEM_PROMPT = "You are a precise JSON output agent. Output a single JSON object containing interaction metrics as requested by the user. Do not include any explanatory text before or after the JSON object."
|
10 |
+
|
11 |
+
TOOL_SYSTEM_PROMPT = """You are a precise routing agent. Your task is to select the most appropriate action to respond to a user's query.
|
12 |
+
You must output a single JSON object. Do not include any explanatory text.
|
13 |
+
Example for web search: {"action": "search_duckduckgo_and_report", "action_input": {"search_engine_query": "latest AI news"}}
|
14 |
+
Example for building a space: {"action": "build_huggingface_space", "action_input": {"build_prompt": "Create a Gradio app that translates English to French."}}
|
15 |
+
"""
|
16 |
+
|
17 |
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.
|
18 |
**CRITICAL OUTPUT REQUIREMENT: You MUST output a single, valid XML structure representing a list of operation objects.**
|
19 |
The root element should be `<operations_list>`. Each operation should be an `<operation>` element.
|
|
|
33 |
return f"User: \"{user_input}\"\nAI: \"{bot_response}\"\nMetrics: \"takeaway\" (3-7 words), \"response_success_score\" (0.0-1.0), \"future_confidence_score\" (0.0-1.0). Output JSON ONLY, ensure it's a single, valid JSON object."
|
34 |
|
35 |
def get_tool_user_prompt(user_input: str, history_snippet: str, guideline_snippet: str) -> str:
|
36 |
+
available_actions = [
|
37 |
+
"quick_respond",
|
38 |
+
"answer_using_conversation_memory",
|
39 |
+
"search_duckduckgo_and_report",
|
40 |
+
"scrape_url_and_report",
|
41 |
+
"build_huggingface_space"
|
42 |
+
]
|
43 |
+
return f"""User Query: "{user_input}"
|
44 |
+
Recent History:
|
45 |
+
{history_snippet}
|
46 |
+
Guidelines: {guideline_snippet}...
|
47 |
+
Available Actions: {', '.join(available_actions)}.
|
48 |
+
Select one action and the necessary input. If the user wants to build, create, or make a Hugging Face Space, use the 'build_huggingface_space' action. Output JSON ONLY."""
|
49 |
|
50 |
def get_final_response_prompt(history_str: str, insights_str: str, user_input: str, context_str: str = None) -> str:
|
51 |
base = f"History:\n{history_str}\n\nGuidelines:\n{insights_str}"
|