Generate Template
Endpoints
Generate Template
Generate an institutional document template for Mexican government entities
POST
Generate Template
Endpoint
Request Body
Description of the document to generate. This should specify the purpose and content of the institutional document.Example:
"Oficio de solicitud de material de oficina para el departamento"The governmental area or department requesting the document. If not provided, defaults to “No especificada”.Example:
"Recursos Humanos", "Obras Públicas", "Secretaría General"Response
The generated institutional document template. Contains the complete formatted document with variable placeholders in
{{Variable}} format (double braces).The template includes:- Institutional header
- ASUNTO (subject line)
- Place and date
- Document body
- Closing
- ATENTAMENTE
- Signature block
- C.c.p. (copy to)
System Prompt
The API uses a specialized system prompt that instructs the LLM to:- Act as an institutional writing assistant for a Mexican City Hall (Ayuntamiento)
- Return ONLY the final template text (no explanations)
- Include all standard institutional document elements
- Use variables in
{{Variable}}format with double braces (not brackets or single braces)
buildSystem() function.
Examples
cURL
JavaScript (fetch)
Success Response
Error Responses
Implementation Details
The endpoint (server.js:18-54):- Validates the
promptparameter is a string - Constructs messages array with system prompt and user request
- Calls Groq’s API with model
llama-3.1-8b-instantand temperature0.4 - Extracts the generated text from
data.choices[0].message.content - Returns the trimmed text in the response
Model Configuration
- Model:
llama-3.1-8b-instant - Temperature:
0.4(balanced between consistency and creativity) - API: Groq OpenAI-compatible endpoint