Code Generation
Category: AI & ML
Node id: code-generation
AI-powered code generation with multi-language and framework support
What it does
- Multi-language code generation (auto-detect or specified)
- Configurable code style (clean, functional, OOP, minimal)
- Optional unit test generation
- Documentation and inline comment generation
- Framework-specific code generation
- Structured JSON output with code, explanation, and dependencies
- Design pattern and constraint-aware generation
Use cases
- Generating boilerplate code from requirements
- Creating FHIR integration code with test coverage
- Scaffolding microservice endpoints with documentation
- Prototyping data transformation pipelines
Runtime
- Performance tier:
variable
Input ports
| Name | Type | Required | Description |
|---|---|---|---|
requirement | text | Yes | Code requirement description |
context | json | No | Additional context (sub-keys: context, constraints, examples, existing_code, api_docs, design_pattern) |
Output ports
| Name | Type | Required | Description |
|---|---|---|---|
result | json | No | Main result containing code, language, explanation, tests, dependencies, and design_pattern |
metadata | json | No | Execution metadata including tokens, line_count, and char_count |
success | boolean | No | Whether code generation succeeded |
Settings
Basic
| Setting | Name | Type | Required | Default | Allowed values | Description |
|---|---|---|---|---|---|---|
| Provider | provider | enum | No | openai | openai, anthropic | LLM provider |
| Model | model | string | No | "" | Model name (auto-selected if empty) | |
| Language | language | string | No | auto | Target programming language (auto for auto-detect) | |
| Style | style | enum | No | clean | clean, functional, oop, minimal | Code style |
| Framework | framework | string | No | "" | Target framework or library | |
| Include Tests | include_tests | boolean | No | false | Generate unit tests | |
| Include Docs | include_docs | boolean | No | true | Include documentation | |
| Include Comments | include_comments | boolean | No | true | Add inline comments |
Auth
| Setting | Name | Type | Required | Default | Allowed values | Description |
|---|---|---|---|---|---|---|
| API Key | api_key | secret | No | API key for the LLM provider | ||
| Base URL | base_url | string | No | "" | Custom API base URL |
Advanced
| Setting | Name | Type | Required | Default | Allowed values | Description |
|---|---|---|---|---|---|---|
| Temperature | temperature | number | No | 0.2 | min 0; max 1 | Sampling temperature |
| Max Tokens | max_tokens | number | No | 4000 | min 1 | Maximum tokens for response |
Errors
| Code | Description |
|---|---|
REQUIREMENT_REQUIRED | No requirement input was provided |
LLM_REQUEST_FAILED | LLM API call failed during code generation |
UNSUPPORTED_PROVIDER | Provider must be openai or anthropic |
Runtime notes
- result.tests is empty unless include_tests=true in config — always check before wiring to a test runner node
- result.code may contain the raw LLM response if JSON parsing fails — the fallback note appears in result.explanation
- The context input supports sub-keys (context, constraints, examples, existing_code, api_docs, design_pattern) — pass as a flat JSON object
- Temperature defaults to 0.2 for deterministic output; increase for more creative/varied code generation
See Build any workflow for how to put nodes together and Ports, types and data flow for how port types connect.
¿Algo no está claro? Envíe sus comentarios sobre la documentación por correo electrónico..