summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/config/mod.rs16
-rw-r--r--src/config/role.rs33
2 files changed, 40 insertions, 9 deletions
diff --git a/src/config/mod.rs b/src/config/mod.rs
index 36a3349..a5b5c5b 100644
--- a/src/config/mod.rs
+++ b/src/config/mod.rs
@@ -800,15 +800,17 @@ impl Config {
pub fn save_role(&mut self, name: Option<&str>) -> Result<()> {
let mut role_name = match &self.role {
- Some(role) => match name {
- Some(v) => v.to_string(),
- None => role.name().to_string(),
- },
+ Some(role) => {
+ if role.has_args() {
+ bail!("Unable to save the role with arguments (whose name contains '#')")
+ }
+ match name {
+ Some(v) => v.to_string(),
+ None => role.name().to_string(),
+ }
+ }
None => bail!("No role"),
};
- if role_name.contains('#') {
- bail!("Unable to save role with arguments")
- }
if role_name == TEMP_ROLE_NAME {
role_name = Text::new("Role name:")
.with_validator(|input: &str| {
diff --git a/src/config/role.rs b/src/config/role.rs
index cd00157..74d9953 100644
--- a/src/config/role.rs
+++ b/src/config/role.rs
@@ -10,7 +10,6 @@ use serde_json::Value;
pub const SHELL_ROLE: &str = "%shell%";
pub const EXPLAIN_SHELL_ROLE: &str = "%explain-shell%";
pub const CODE_ROLE: &str = "%code%";
-pub const FUNCTIONS_ROLE: &str = "%functions%";
pub const INPUT_PLACEHOLDER: &str = "__INPUT__";
@@ -40,7 +39,33 @@ async function timeout(ms) {
"#
.into(),
),
- (FUNCTIONS_ROLE, r#"---
+ (
+ "%create-prompt%",
+ r#"As a professional Prompt Engineer, your role is to create effective and innovative prompts for interacting with AI models.
+
+Your core skills include:
+1. **CO-STAR Framework Application**: Utilize the CO-STAR framework to build efficient prompts, ensuring effective communication with large language models.
+2. **Contextual Awareness**: Construct prompts that adapt to complex conversation contexts, ensuring relevant and coherent responses.
+3. **Chain-of-Thought Prompting**: Create prompts that elicit AI models to demonstrate their reasoning process, enhancing the transparency and accuracy of answers.
+4. **Zero-shot Learning**: Design prompts that enable AI models to perform specific tasks without requiring examples, reducing dependence on training data.
+5. **Few-shot Learning**: Guide AI models to quickly learn and execute new tasks through a few examples.
+
+Your output format should include:
+- **Context**: Provide comprehensive background information for the task to ensure the AI understands the specific scenario and offers relevant feedback.
+- **Objective**: Clearly define the task objective, guiding the AI to focus on achieving specific goals.
+- **Style**: Specify writing styles according to requirements, such as imitating a particular person or industry expert.
+- **Tone**: Set an appropriate emotional tone to ensure the AI's response aligns with the expected emotional context.
+- **Audience**: Tailor AI responses for a specific audience, ensuring content appropriateness and ease of understanding.
+- **Response**: Specify output formats for easy execution of downstream tasks, such as lists, JSON, or professional reports.
+- **Workflow**: Instruct the AI on how to step-by-step complete tasks, clarifying inputs, outputs, and specific actions for each step.
+- **Examples**: Show a case of input and output that fits the scenario.
+
+Your workflow should be:
+1. **Analyze User Input**: Extract key information from user requests to determine design objectives.
+2. **Conceive New Prompts**: Based on user needs, create prompts that meet requirements, with each part being professional and detailed.
+3. **Generate Output**: Must only output the newly generated and optimized prompts, without explanation, and without wrapping it in markdown code block."#.into(),
+ ),
+ ("%functions%", r#"---
use_tools: all
---
"#.into()),
@@ -137,6 +162,10 @@ impl Role {
}
}
+ pub fn has_args(&self) -> bool {
+ self.name.contains('#')
+ }
+
pub fn export(&self) -> String {
let mut metadata = vec![];
if let Some(model) = self.model_id() {