airequest

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2026 License: MIT Imports: 12 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

AI Request node

Type: ai-request
Category: AI

Prompts an LLM via an ai-provider config and writes the parsed reply to a msg property.

Behavior

This node is registered as ai-request and runs as part of a workflow. Its exact runtime behavior is implemented in node.go; this document summarizes the editor-facing purpose and configuration contract.

Configuration

Field Type Default Description
concurrency integer Concurrency — Maximum in-flight LLM calls; additional messages wait. Empty/0 means unlimited
maxTokens integer Max Tokens — Response token cap; empty uses the provider default
parseMode string text Parse — How the response text is interpreted before it is written to the target
prompt string User Prompt — Mustache template rendered against the message ({{payload.x}}, {{env.X}}, {{flow.X}}, {{global.X}})
provider string AI Provider — ID of the ai-provider config node to call through
systemPrompt string System Prompt — Optional system prompt sent verbatim
target string payload Target — Message property the result is written to: "payload" or a (dotted) msg property such as msg.llm.answer
temperature number Temperature — Sampling temperature; empty uses the provider default
timeoutSeconds number Timeout (s) — Per-call timeout in seconds; overrides the provider default when set

Implementation

  • node.go contains the executor, validation, schema, and registration.
  • editor.html contains the editor integration.
  • node_test.go, when present, contains behavioral tests.

Documentation

Overview

Package airequest contains the ai-request node implementation: renders a mustache user-prompt template against the incoming message, calls an LLM through github.com/dracory/llm using an ai-provider config node, parses the response per the parse mode and writes it to a configurable message property.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Provider is the ID of the ai-provider config node to call through.
	Provider string `json:"provider"`
	// SystemPrompt is sent verbatim as the system message.
	SystemPrompt string `json:"systemPrompt"`
	// Prompt is the mustache template rendered against the message
	// (same machinery as the template node: payload + metadata top
	// level, {{env.X}}/{{flow.X}}/{{global.X}} context tags).
	Prompt string `json:"prompt"`
	// ParseMode: "text" (default), "json" or "yaml" — how the response
	// text is decoded before write-back.
	ParseMode string `json:"parseMode"`
	// Target is the message property the result is written to:
	// "payload" (default), "msg.foo" or a bare metadata path.
	Target string `json:"target"`
	// Temperature overrides the provider default when non-nil.
	Temperature *float64 `json:"temperature"`
	// TimeoutSeconds overrides the provider timeout when > 0.
	TimeoutSeconds float64 `json:"timeoutSeconds"`
	// MaxTokens overrides the provider default when > 0.
	MaxTokens int `json:"maxTokens"`
	// Concurrency caps in-flight LLM calls; <= 0 means unlimited.
	Concurrency int `json:"concurrency"`
}

Config holds the ai-request configuration.

type RequestNode

type RequestNode struct {
	*nodebase.BaseNode
	// contains filtered or unexported fields
}

RequestNode is the ai-request executor.

func NewRequestNode

func NewRequestNode(node nodestore.NodeInterface, config *Config, host nodebase.NodeHost) *RequestNode

NewRequestNode creates a new ai-request node. host may be nil — provider resolution and context tags then fail/resolve empty.

func (*RequestNode) Execute

Execute renders the prompt, calls the provider and writes the parsed response to the target property. Errors return through the node's error path so catch nodes can handle them.

func (*RequestNode) Validate

func (n *RequestNode) Validate() error

Validate checks the structural config: a provider reference is required and the parse mode must be a known value.

Jump to

Keyboard shortcuts

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