File size: 3,311 Bytes
cb069fa
 
 
d39daa5
 
 
cb069fa
d39daa5
 
 
35f1887
d39daa5
 
8259245
d39daa5
 
cb069fa
d39daa5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
cb069fa
d39daa5
 
4923001
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import streamlit as st
import google.generativeai as genai

# πŸ”‘ Load API Key from Streamlit Secrets
GOOGLE_API_KEY = st.secrets["GEMINI_API_KEY"]
genai.configure(api_key=GOOGLE_API_KEY)

# 🎨 Streamlit UI Setup
st.title("⚑ PromptLab – AI-Powered Prompt Enhancer")
st.write("Enhance your prompts with **Shinobi** (Structured) or **Raikage** (Execution-Focused)")

# 🎭 Mode Selection
mode = st.radio("Select Mode:", ["πŸŒ€ Shinobi", "⚑ Raikage"], horizontal=True)

# ✍️ User Input for Prompt
user_prompt = st.text_area("Enter your prompt:")

# πŸš€ Generate Enhanced Prompt
if st.button("Enhance Prompt"):
    if not user_prompt.strip():
        st.warning("⚠️ Please enter a prompt before enhancing.")
    else:
        with st.spinner("Enhancing your prompt... ⚑"):
            # πŸ› οΈ Apply Shinobi or Raikage Framework
            if mode == "πŸŒ€ Shinobi":
                structured_prompt = f"""
                You are an advanced prompt enhancer, specializing in creating structured, high-clarity prompts that optimize LLM performance.
                Your task is to refine a given prompt using the **Shinobi framework**, ensuring:
                
                βœ… **Concise & High-Density Prompting** β†’ Remove fluff, keeping instructions clear and actionable.
                βœ… **Explicit Role Definition** β†’ Assign a role to the AI for better contextual grounding.
                βœ… **Step-by-Step Clarity** β†’ Break the task into structured sections.
                βœ… **Defined Output Format** β†’ Specify the response format.
                
                ### **Enhance the following prompt using Shinobi principles:**
                
                **Original Prompt:**  
                {user_prompt}
                
                **Enhanced Shinobi Prompt:**  
                """
            else:
                structured_prompt = f"""
                You are an elite AI strategist, specializing in designing execution-focused prompts that maximize LLM efficiency.
                Your task is to refine a given prompt using the **Raikage framework**, ensuring:
                
                βœ… **Precision & Depth** β†’ Ensure expert-level guidance, reducing vagueness.
                βœ… **Context & Execution Approach** β†’ Include a structured methodology.
                βœ… **Defined Output Format** β†’ Specify exact structure (JSON, markdown, tables, etc.).
                βœ… **Edge Case Handling & Constraints** β†’ Account for potential failures.
                
                ### **Enhance the following prompt using Raikage principles:**
                
                **Original Prompt:**  
                {user_prompt}
                
                **Enhanced Raikage Prompt:**  
                """

            # 🧠 Call Gemini API
            model = genai.GenerativeModel('gemini-pro')
            response = model.generate_content(structured_prompt)

            # πŸ“ Display Output
            enhanced_prompt = response.text.strip()
            st.subheader("πŸ”Ή Enhanced Prompt:")
            st.code(enhanced_prompt, language="markdown")

            # πŸ“‹ Copy Button
            st.button("πŸ“‹ Copy to Clipboard", on_click=lambda: st.session_state.update({"copied_text": enhanced_prompt}))