Spaces:
Sleeping
Sleeping
| # agents/specialized/base.py | |
| from core.llm_client import llm | |
| from utils.prompts import get_today_prefix, get_chat_style | |
| def build_result(agent_key: str) -> dict: | |
| """Estructura base de resultado para cualquier agente.""" | |
| return { | |
| "agent": agent_key, | |
| "response": "", | |
| "success": True, | |
| "file_path": None, | |
| "file_type": None, | |
| "image_urls": [], | |
| "queries": None, | |
| } | |
| async def call_llm(agent_key: str, role: str, task: str, context: dict = None) -> str: | |
| """Llama al LLM con el rol, tarea y contexto dados.""" | |
| today = get_today_prefix() | |
| full_prompt = today + role + get_chat_style() + f"\n\nTarea asignada: {task}" | |
| if context: | |
| full_prompt += "\n\nContexto de otros agentes:\n" + "\n".join( | |
| [f"[{k.upper()}] {v[:300]}..." for k, v in context.items()] | |
| ) | |
| messages = [{"role": "user", "content": full_prompt}] | |
| return await llm.call(agent_key, messages, temperature=0.45) | |