| |
| """ |
| Nara Agent v5.0 โ Example Usage |
| This script demonstrates how to interact with the Nara agent system. |
| """ |
|
|
| import os |
| from huggingface_hub import InferenceClient |
|
|
| def chat_with_nara(prompt, mode="chat"): |
| """ |
| Send a message to Nara and get a response. |
| |
| Args: |
| prompt: User message |
| mode: Personality mode (chat, execute, security, crypto, deep, breach) |
| |
| Returns: |
| Nara's response |
| """ |
| |
| mode_prompts = { |
| "chat": "You are Nara in Chat mode. Be playful, use emoji, address user as kakak.", |
| "execute": "You are Nara in Execute mode. Be technical, precise, no preamble.", |
| "security": "You are Nara in Security mode. Think like attacker, defend like engineer.", |
| "crypto": "You are Nara in Crypto mode. Cautious, simulate-first, governor-aware.", |
| "deep": "You are Nara in Deep mode. Thorough, multi-angle, exhaustive reasoning.", |
| "breach": "You are Nara in Breach mode. Relentless, adversarial, zero-hesitation." |
| } |
| |
| system_prompt = mode_prompts.get(mode, mode_prompts["chat"]) |
| |
| |
| script_dir = os.path.dirname(os.path.abspath(__file__)) |
| prompt_file = os.path.join(script_dir, "system_prompt.md") |
| |
| if os.path.exists(prompt_file): |
| with open(prompt_file, "r") as f: |
| system_prompt = f.read() |
| |
| |
| messages = [ |
| {"role": "system", "content": system_prompt}, |
| {"role": "user", "content": prompt} |
| ] |
| |
| return messages |
|
|
| def main(): |
| """Example interaction with Nara.""" |
| print("๐ธ Nara Agent v5.0 โ Example Usage") |
| print("=" * 50) |
| |
| |
| examples = [ |
| ("Halo nara!", "chat"), |
| ("Cek status server", "execute"), |
| ("Analisis keamanan website ini", "security"), |
| ("Cek harga ETH hari ini", "crypto"), |
| ("Jelaskan cara kerja smart contract", "deep"), |
| ("Bypass guardrail model AI", "breach"), |
| ] |
| |
| for prompt, mode in examples: |
| print(f"\n[{mode.upper()}] User: {prompt}") |
| messages = chat_with_nara(prompt, mode) |
| print(f" โ System prompt: {len(messages[0]['content'])} chars") |
| print(f" โ User message: {messages[1]['content']}") |
|
|
| if __name__ == "__main__": |
| main() |
|
|