Spaces:
Sleeping
Sleeping
| import json | |
| from typing import List, Dict, Any | |
| # Specialist Agents Configuration | |
| SPECIALIST_AGENTS = { | |
| "The Architect": "qwen/qwen-2.5-coder-32b-instruct", | |
| "The Generalist": "meta-llama/llama-3.3-70b-instruct", | |
| "The Reasoner": "google/gemini-3-flash-preview", | |
| "The Speedster": "mistralai/mistral-small-24b-instruct-2501" | |
| } | |
| # Judge Agent Configuration | |
| JUDGE_AGENT = "deepseek/deepseek-v3.2" | |
| def get_system_prompt(role: str, technique: str, examples: List[Dict[str, str]] = None) -> str: | |
| """ | |
| Generates the system prompt based on the agent's role and the selected technique. | |
| """ | |
| base_prompt = f"You are {role}. You are an expert Python programmer. " | |
| if technique == "Zero-Shot": | |
| return base_prompt + "Write cleaner, efficient, and safe Python code to solve the user's query." | |
| elif technique == "Few-Shot": | |
| prompt = base_prompt + "Here are some examples of high-quality Python code:\n\n" | |
| if examples: | |
| for example in examples: | |
| prompt += f"Query: {example['query']}\nCode:\n{example['code']}\n\n" | |
| return prompt + "Now, solve the user's query following these examples." | |
| elif technique == "Chain-of-Thought": | |
| return base_prompt + "First, think through the problem step-by-step in a <thinking> block. Then, provide your Python solution in a code block." | |
| return base_prompt | |
| def get_judge_system_prompt() -> str: | |
| return ( | |
| "You are an impartial Judge Agent. You will be given a user query and 4 different Python solutions. " | |
| "Evaluate them based on: 1. Correctness, 2. Efficiency, 3. Safety, 4. Pythonic Best Practices. " | |
| "Select the BEST solution and explain your reasoning. " | |
| "Format your response as: \n" | |
| "Winner: [Agent Name]\n" | |
| "Reasoning: [Your detailed explanation]" | |
| ) | |