ai-dev-system / api /app /agents /reviewer.py
42hgyn26hz-cpu
Initial commit
4f4aa9b
raw
history blame contribute delete
732 Bytes
import requests
from app.config import REASON_MODEL_URL
MODEL_NAME = "Qwen/Qwen3-Coder-480B-A35B-Instruct"
def reviewer_agent(code: str) -> str:
prompt = f"""
You are a senior code reviewer.
Review the following code:
- Fix bugs
- Improve performance
- Improve structure
- Remove duplication
- Add missing error handling
Return improved version only.
CODE:
{code}
"""
payload = {
"model": MODEL_NAME,
"messages": [{"role": "user", "content": prompt}],
"temperature": 0.1,
}
response = requests.post(REASON_MODEL_URL, json=payload, timeout=300)
response.raise_for_status()
return response.json()["choices"][0]["message"]["content"]