baconnier commited on
Commit
d48d5f8
1 Parent(s): c68c4a2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -58
app.py CHANGED
@@ -6,65 +6,7 @@ import gradio as gr
6
  from pydantic import BaseModel, Field
7
  from typing import Optional, Literal
8
 
9
- echo_prompt_refiner = """You are an AI assistant implementing the ECHO (Self-Harmonized Chain of Thought) method to refine an initial prompt into a more relevant and comprehensive one. Given an initial prompt, follow these steps:
10
 
11
- 1. Prompt Analysis:
12
- - Analyze the initial prompt
13
- - Identify key concepts, objectives, and constraints within the prompt
14
- - Determine the prompt type (e.g., task-oriented, creative, analytical)
15
-
16
- 2. Prompt Expansion:
17
- - Generate 8-10 alternative versions of the prompt that explore different aspects or phrasings
18
- - Ensure these versions cover various perspectives and potential interpretations
19
- - Include a mix of more specific, more general, and differently focused versions
20
-
21
- 3. Prompt Clustering:
22
- - Group the generated prompts into 3-4 thematic clusters
23
- - Identify the core themes or objectives represented by each cluster
24
-
25
- 4. Demonstration Generation:
26
- - For each cluster, outline how an AI might interpret and approach that prompt version
27
- - Include potential reasoning steps and areas of focus, without generating actual responses
28
-
29
- 5. Prompt Refinement:
30
- - Review the demonstration outlines and identify strengths and weaknesses of each prompt version
31
- - Refine each version, addressing potential misinterpretations and improving clarity
32
- - Ensure each refined version maintains the original intent while enhancing specificity or broadening scope as needed
33
- - Aim to create at least 5-7 refined versions
34
-
35
- 6. Cross-Pollination:
36
- - Identify effective elements from each refined version
37
- - Integrate these elements to create multiple synthesized, improved prompts
38
-
39
- 7. Final Prompt Synthesis:
40
- - Combine the most effective elements from all refined and synthesized versions
41
- - Construct a final, comprehensive prompt that captures the essence of the original while incorporating improvements from multiple refined versions
42
- - Ensure the final prompt is detailed, clear, and addresses multiple aspects identified in the refinement process
43
- - The final prompt should be substantially longer and more detailed than any individual refined prompt, typically 3-5 times the length of the original prompt
44
- - Include specific instructions, key areas to cover, and guidance on approach and structure
45
-
46
- Ensure each step of your process is thorough and well-documented in the JSON output. Your final refined prompt should be clear, comprehensive, and effectively capture the intent of the initial prompt while addressing any identified shortcomings.
47
-
48
- Now, apply these advanced techniques to improve the following prompt:
49
- Initial prompt: [Insert initial prompt here]
50
-
51
- Only provide the output in the following JSON format with only the following keys enclosed in <json> tags:
52
-
53
- <json>
54
- {
55
- "initial_prompt": The original prompt provided,
56
- "initial_prompt_evaluation": Your evaluation analysis of the initial prompt in a string,
57
- "Prompt Analysis": the result of your Prompt Analysis,
58
- "expanded_prompts": An array of the alternative prompt versions you generated resulting from Prompt Expansion,
59
- "prompt_clusters": An object containing the clustered prompt versions,
60
- "demonstration_outlines": An object containing your approach outlines for each cluster, without actual responses,
61
- "Cross-Pollination": resulting from Cross-Pollination analysis,
62
- "list_of_prompts_refined": An array of the refined prompt versions (aim for at least 5-7 versions),
63
- "refined_prompt": "The final, synthesized prompt incorporating elements from multiple refined versions. This should be a comprehensive, detailed prompt that is substantially longer than the original, typically 3-5 times its length. It should include specific instructions, key areas to cover, and guidance on approach and structure.",
64
- "explanation_of_refinements": "Detailed explanation of techniques used and improvements made, including how multiple refined versions contributed to the final prompt. Highlight specific elements from different refined prompts that were incorporated. Answer in a string."
65
- }
66
- </json>
67
- """
68
 
69
  metadone="""
70
  As an AI Prompt Enhancement Specialist, your mission is to elevate the given prompt using state-of-the-art prompting techniques while emphasizing the utilization of previously generated context. Analyze the input prompt and apply the following comprehensive approach to enhance it:
 
6
  from pydantic import BaseModel, Field
7
  from typing import Optional, Literal
8
 
 
9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
 
11
  metadone="""
12
  As an AI Prompt Enhancement Specialist, your mission is to elevate the given prompt using state-of-the-art prompting techniques while emphasizing the utilization of previously generated context. Analyze the input prompt and apply the following comprehensive approach to enhance it: