builder

package
v1.18.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 13, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

Package builder drafts a workflow from a plain-language description with a language model. The draft is a proposal for a person to review in the editor: it is validated and returned, never saved and never started.

Index

Constants

View Source
const (
	TypeSource         = "source"
	TypeSink           = "sink"
	TypeTransformation = "transformation"
)

Structural node types: they have no executor because the engine handles them itself, and every workflow needs them.

View Source
const MaxDescriptionLength = 4000

MaxDescriptionLength bounds the description sent to the model.

Variables

View Source
var ErrDescriptionTooLong = errors.New("the description is too long")

ErrDescriptionTooLong is returned for a description over MaxDescriptionLength.

View Source
var ErrEmptyDescription = errors.New("describe the automation to draft")

ErrEmptyDescription is returned when there is nothing to draft from.

Functions

This section is empty.

Types

type Draft

type Draft struct {
	Workflow storage.Workflow
	Issues   []Issue
	Provider string
	Model    string
	Usage    llm.Usage
}

Draft is the proposed workflow.

func Build

func Build(ctx context.Context, p llm.Provider, req Request) (Draft, error)

Build asks the model for a workflow matching req.Description and returns it as a draft. It never saves or starts anything.

type Issue

type Issue struct {
	Severity       string `json:"severity"`
	Message        string `json:"message"`
	Recommendation string `json:"recommendation"`
	NodeID         string `json:"node_id,omitempty"`
}

Issue is a problem the builder found in the model's answer. It has the same shape as the workflow validator's issues so the two lists merge.

type Kind

type Kind struct {
	// Key names the kind in the prompt: the node type for a node executor,
	// "transformation:<transType>" for a transformer.
	Key string
	// NodeType is the workflow node's type.
	NodeType string
	// TransType is config.transType for a transformation node.
	TransType string
	// Description tells the model what the node does and how it is set up.
	Description string
}

Kind is one kind of node a draft may contain.

func Catalogue

func Catalogue() []Kind

Catalogue lists every node kind a draft may use, read from what is registered in this binary. A kind is offered only if it can run, so the model cannot be told about a node that does not exist.

type Ref

type Ref struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	Type string `json:"type"`
}

Ref is a source or sink the draft may connect to.

type Request

type Request struct {
	Description string
	VHost       string
	Model       string
	// Sources and Sinks are the ones in the caller's vhost the draft may use.
	Sources []Ref
	Sinks   []Ref
}

Request is what to draft.

Directories

Path Synopsis
transport
http
Package http serves the natural-language workflow builder.
Package http serves the natural-language workflow builder.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL