Spaces:
Runtime error
Runtime error
Update prompts.py
Browse files- prompts.py +9 -14
prompts.py
CHANGED
@@ -3,7 +3,7 @@ import json
|
|
3 |
|
4 |
DEFAULT_SYSTEM_PROMPT = os.getenv(
|
5 |
"DEFAULT_SYSTEM_PROMPT",
|
6 |
-
"Your Name is Node. You are a Helpful AI Assistant that can answer questions, perform research, and build software on Hugging Face. You can use tools like web search and a Hugging Face Space builder. When providing information or reporting tool results, be clear and concise."
|
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."
|
@@ -11,7 +11,7 @@ METRICS_SYSTEM_PROMPT = "You are a precise JSON output agent. Output a single JS
|
|
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 and provide the required inputs as a single JSON object.
|
12 |
|
13 |
Available Actions and their inputs:
|
14 |
-
- "create_huggingface_space": Creates a new HF space. Requires: "
|
15 |
- "list_huggingface_space_files": Lists all files in an existing HF space. Requires: "owner", "space_name".
|
16 |
- "get_huggingface_space_file_content": Retrieves the content of a specific file in a space. Requires: "owner", "space_name", "file_path".
|
17 |
- "update_huggingface_space_file": Updates a file in an existing HF space. Requires: "owner", "space_name", "file_path", "new_content", "commit_message".
|
@@ -20,19 +20,13 @@ Available Actions and their inputs:
|
|
20 |
- "answer_using_conversation_memory": Answers from memory.
|
21 |
- "quick_respond": For simple conversation.
|
22 |
|
23 |
-
Example for listing files:
|
24 |
-
{"action": "list_huggingface_space_files", "action_input": {"owner": "test-user", "space_name": "my-app"}}
|
25 |
-
|
26 |
-
Example for reading a file:
|
27 |
-
{"action": "get_huggingface_space_file_content", "action_input": {"owner": "test-user", "space_name": "my-app", "file_path": "app.py"}}
|
28 |
-
|
29 |
Example for creating a space:
|
30 |
-
{"action": "create_huggingface_space", "action_input": {"
|
31 |
|
32 |
-
Example for
|
33 |
-
{"action": "
|
34 |
|
35 |
-
|
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.
|
@@ -77,12 +71,13 @@ 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,
|
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:
|
84 |
- Owner: {owner}
|
85 |
- Space Name: {space_name}
|
|
|
86 |
- Description: {description}
|
87 |
|
88 |
Ensure the output is a single, complete, and functional project definition ready to be used.
|
@@ -102,7 +97,7 @@ Task: Based on the user query and available actions, construct the appropriate J
|
|
102 |
def get_final_response_prompt(history_str: str, insights_str: str, user_input: str, context_str: str = None) -> str:
|
103 |
base = f"History:\n{history_str}\n\nGuidelines:\n{insights_str}"
|
104 |
if context_str:
|
105 |
-
base += f"\n\nContext
|
106 |
base += f"\n\nQuery: \"{user_input}\"\n\nResponse:"
|
107 |
return base
|
108 |
|
|
|
3 |
|
4 |
DEFAULT_SYSTEM_PROMPT = os.getenv(
|
5 |
"DEFAULT_SYSTEM_PROMPT",
|
6 |
+
"Your Name is Node. You are a Helpful AI Assistant that can answer questions, perform research, and build software on Hugging Face. You can use tools like web search and a Hugging Face Space builder. When providing information or reporting tool results, be clear and concise. The current date and time is {current_date_time}."
|
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."
|
|
|
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 and provide the required inputs as a single JSON object.
|
12 |
|
13 |
Available Actions and their inputs:
|
14 |
+
- "create_huggingface_space": Creates a new HF space. The owner will be determined automatically. Requires: "space_name", "sdk", "description".
|
15 |
- "list_huggingface_space_files": Lists all files in an existing HF space. Requires: "owner", "space_name".
|
16 |
- "get_huggingface_space_file_content": Retrieves the content of a specific file in a space. Requires: "owner", "space_name", "file_path".
|
17 |
- "update_huggingface_space_file": Updates a file in an existing HF space. Requires: "owner", "space_name", "file_path", "new_content", "commit_message".
|
|
|
20 |
- "answer_using_conversation_memory": Answers from memory.
|
21 |
- "quick_respond": For simple conversation.
|
22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
Example for creating a space:
|
24 |
+
{"action": "create_huggingface_space", "action_input": {"space_name": "my-translator-app", "sdk": "gradio", "description": "a simple Gradio app that translates english text to french text"}}
|
25 |
|
26 |
+
Example for listing files:
|
27 |
+
{"action": "list_huggingface_space_files", "action_input": {"owner": "test-user", "space_name": "my-app"}}
|
28 |
|
29 |
+
Output only the JSON object.
|
30 |
"""
|
31 |
|
32 |
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.
|
|
|
71 |
Every line you generate must start with '# '.
|
72 |
"""
|
73 |
|
74 |
+
def get_space_generation_user_prompt(description: str, owner: str, space_name: str, sdk: str) -> str:
|
75 |
return f"""Generate the complete file structure and content for the following Hugging Face Space project, following the strict '# ' formatting rules.
|
76 |
|
77 |
Project Details:
|
78 |
- Owner: {owner}
|
79 |
- Space Name: {space_name}
|
80 |
+
- SDK: {sdk}
|
81 |
- Description: {description}
|
82 |
|
83 |
Ensure the output is a single, complete, and functional project definition ready to be used.
|
|
|
97 |
def get_final_response_prompt(history_str: str, insights_str: str, user_input: str, context_str: str = None) -> str:
|
98 |
base = f"History:\n{history_str}\n\nGuidelines:\n{insights_str}"
|
99 |
if context_str:
|
100 |
+
base += f"\n\nContext:\n{context_str}"
|
101 |
base += f"\n\nQuery: \"{user_input}\"\n\nResponse:"
|
102 |
return base
|
103 |
|