Mirrored from https://github.com/Camo67/OCIU-npo.git
Synced Nov 21, 06:00 UTC
feat/music-production-only
| 1 | from backend.agents.base import BaseAgent |
| 2 | from backend.services.model_router import TaskComplexity |
| 3 | from backend.services.ollama_client import ollama_client |
| 4 | import os |
| 5 | |
| 6 | class CodeGeneratorAgent(BaseAgent): |
| 7 | def __init__(self): |
| 8 | super().__init__("CodeGenerator", TaskComplexity.HEAVY) |
| 9 | |
| 10 | async def run(self, prompt: str, context: str = "") -> dict: |
| 11 | full_prompt = f"Context from Obsidian:\n{context}\n\nTask: {prompt}\n\nGenerate the code ONLY." |
| 12 | result = await self.generate_response(full_prompt) |
| 13 | |
| 14 | self.log_to_vault(f"codegen_{hash(prompt) % 10000}", result) |
| 15 | |
| 16 | return { |
| 17 | "model_used": self.get_model(), |
| 18 | "output": result |
| 19 | } |
| 20 | |
| 21 | code_agent = CodeGeneratorAgent() |