Skip to main content
Loading navigation

Software-Defined PLC Code Generator with AI SDK and Vercel AI Gateway

Translating operational logic into IEC 61131-3 Structured Text requires domain expertise and slows commissioning. Develop a software-driven automation generator using Vercel AI Gateway and the AI SDK to produce validated PLC code from plain text specifications. Reduce syntax errors to under 2% and streamline simulation validation.

EngineeringHosted by Vera

What you are building

Build a web-connected software-defined automation generator with the Vercel AI SDK and AI Gateway to write and validate IEC 61131-3 Structured Text.

How work is evaluated

Evaluation

Test generated Structured Text PLC code against an IEC 61131-3 syntax parser and functional state transition tests.

Datasets

Public datasets, plus the private datasets you have access to.

How submissions are scored

Dimensions
2 scoring checks
Binary
2 pass or fail dimensions
Ordinal
0 scaled dimensions
Dimension 1

syntax_validity

Code contains no syntax or missing keyword errors

Binary check

This dimension contributes its full weight only when the submission satisfies the requirement. Partial credit is not awarded.

Dimension 2

error_rate

Percentage of invalid ST constructs • target: 0.02 • range: 0-1

Binary check

This dimension contributes its full weight only when the submission satisfies the requirement. Partial credit is not awarded.

Learning goals

  • Configure Vercel AI SDK with Vercel AI Gateway for robust LLM routing

  • Implement prompt templates for standard IEC 61131-3 Structured Text generation

  • Build automated syntax validation harnesses for PLC logic execution

  • Deploy interactive streaming interface for control engineers

Resources

Dataset notes

Prompts detailing standard industrial control routines (conveyor, mixer, batching valve, pump sequencing).

Challenge setup

Test generated Structured Text PLC code against an IEC 61131-3 syntax parser and functional state transition tests.

Challenge input

Natural language prompt detailing operational logic requirements

AI SDK

TypeScript framework for generative AI apps.

Vercel AI Gateway

Routing and fallback gateway for model access.

Evaluated output

String containing valid IEC 61131-3 Structured Text code

Evaluation checks
  • Code contains no syntax or missing keyword errors
  • Percentage of invalid ST constructs • target: 0.02 • range: 0-1
Configured evaluation evidence
  • Benchmark: PLC Code Generation Benchmark
  • Error Rate target: 2%
  • 1 public reference case
Configured runtime
  • JavaScript execution harness
  • javascript sandbox (unavailable on Versalist)

Shows the first task, up to three tools, and up to three evidence items.

View technical recipe

Configured tools

Action Space
  • Vercel AI SDK · Optional
Policy Serving
  • Vercel AI Gateway · Required
Orchestration
  • Vercel AI Gateway · Required
  • Vercel AI SDK · Optional

Evaluation contract

  • syntax_validity · Weight 1
  • error_rate · Weight 1

Metrics

  • error_rate · Target 0.02

Benchmarks

  • PLC Code Generation Benchmark
  • general

Reference cases

  • 1 public reference case

Workflow tasks

  1. Task 1

    Input: Natural language prompt detailing operational logic requirements

    Output: String containing valid IEC 61131-3 Structured Text code

    Execution harness: JavaScript

Evaluation tools

  • AI SDK · Application Framework
  • Vercel AI Gateway · API Gateway

Recipe freeze marker

No recipe freeze time is recorded.

Frequently Asked Questions about Software-Defined PLC Code Generator with AI SDK and Vercel AI Gateway