| async function generateExpertCode(userProblem) { |
| const response = await fetch( |
| "https://api-inference.huggingface.co/models/deepseek-ai/deepseek-coder-1.3b-instruct", |
| { |
| headers: { |
| "Authorization": "Bearer YOUR_HUGGINGFACE_API_TOKEN", |
| "Content-Type": "application/json" |
| }, |
| method: "POST", |
| body: JSON.stringify({ |
| inputs: `System: You are an elite Senior Software Engineer. Follow the 5-step analysis/code protocol.\nUser: ${userProblem}\nAssistant:`, |
| parameters: { |
| max_new_tokens: 1024, |
| temperature: 0.2 |
| } |
| }), |
| } |
| ); |
| const result = await response.json(); |
| return result; |
| } |