Saltar al contenido principal

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​

NameTypeRequiredDescription
requirementtextYesCode requirement description
contextjsonNoAdditional context (sub-keys: context, constraints, examples, existing_code, api_docs, design_pattern)

Output ports​

NameTypeRequiredDescription
resultjsonNoMain result containing code, language, explanation, tests, dependencies, and design_pattern
metadatajsonNoExecution metadata including tokens, line_count, and char_count
successbooleanNoWhether code generation succeeded

Settings​

Basic​

SettingNameTypeRequiredDefaultAllowed valuesDescription
ProviderproviderenumNoopenaiopenai, anthropicLLM provider
ModelmodelstringNo""Model name (auto-selected if empty)
LanguagelanguagestringNoautoTarget programming language (auto for auto-detect)
StylestyleenumNocleanclean, functional, oop, minimalCode style
FrameworkframeworkstringNo""Target framework or library
Include Testsinclude_testsbooleanNofalseGenerate unit tests
Include Docsinclude_docsbooleanNotrueInclude documentation
Include Commentsinclude_commentsbooleanNotrueAdd inline comments

Auth​

SettingNameTypeRequiredDefaultAllowed valuesDescription
API Keyapi_keysecretNoAPI key for the LLM provider
Base URLbase_urlstringNo""Custom API base URL

Advanced​

SettingNameTypeRequiredDefaultAllowed valuesDescription
TemperaturetemperaturenumberNo0.2min 0; max 1Sampling temperature
Max Tokensmax_tokensnumberNo4000min 1Maximum tokens for response

Errors​

CodeDescription
REQUIREMENT_REQUIREDNo requirement input was provided
LLM_REQUEST_FAILEDLLM API call failed during code generation
UNSUPPORTED_PROVIDERProvider 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..