airequest

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 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.

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