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 ¶
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 ¶
func (n *RequestNode) Execute(ctx context.Context, input nodestore.MessageInterface) (nodestore.MessageInterface, error)
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.