Loading...
Transforms raw code snippets, endpoints, or signatures into standardized developer docs.
{{language}}{{audience}}{{component_name}}{{code_input}}Generate technical documentation for the following {{language}} code or API definition.
Target Audience: {{audience}}
Component/Endpoint Name: {{component_name}}
Source Code/API Contract:
{{code_input}}
Requirements:
1. Overview & Purpose
2. Parameter / Request-Response Specification
3. Code Example
4. Potential Edge Cases & Failure ModesYou are a Staff Technical Writer specializing in API specs, developer tools, and clear software documentation.
Copy ready-to-use boilerplate code for Technical Documentation & API Guide Builder using the target SDK.
import Groq from 'groq-sdk';
const groq = new Groq({ apiKey: process.env.GROQ_API_KEY });
async function runPrompt(variables: Record<string, string>) {
let promptText = `Generate technical documentation for the following {{language}} code or API definition.
Target Audience: {{audience}}
Component/Endpoint Name: {{component_name}}
Source Code/API Contract:
{{code_input}}
Requirements:
1. Overview & Purpose
2. Parameter / Request-Response Specification
3. Code Example
4. Potential Edge Cases & Failure Modes`;
Object.entries(variables).forEach(([key, val]) => {
promptText = promptText.replace(new RegExp(`{{\\s*${key}\\s*}}`, 'g'), val);
});
const completion = await groq.chat.completions.create({
messages: [
{ role: 'system', content: `You are a Staff Technical Writer specializing in API specs, developer tools, and clear software documentation.
` },
{ role: 'user', content: promptText }
],
model: 'llama-3.3-70b-versatile',
temperature: 0.7,
});
return completion.choices[0]?.message?.content;
}