aiprovider

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: 8 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 aiprovider contains the ai-provider config node implementation: a shared LLM provider definition (provider, base URL, API key credential, default model and timeout) referenced by the ai-request node. The client layer is github.com/dracory/llm.

Index

Constants

View Source
const Type = "ai-provider"

Type is the registered node type id for the provider config entity.

Variables

This section is empty.

Functions

func ResolveOptions

func ResolveOptions(host nodebase.NodeHost, workflowID, ref string) (llm.LlmOptions, error)

ResolveOptions looks up an ai-provider config node reference inside the workflow and returns the llm.LlmOptions it implies — the shared first step for every node that calls a provider (ai-request, ai-agent). Per-call overrides are applied by the caller.

Types

type Config

type Config struct {
	// Provider is the dracory/llm provider id: openai, anthropic,
	// gemini, vertex, openrouter, custom or mock.
	Provider string `json:"provider"`
	// BaseURL is the endpoint URL — required for provider "custom"
	// (any OpenAI-compatible server); ignored by hosted providers.
	BaseURL string `json:"baseURL"`
	// APIKey is the provider credential (masked in the editor,
	// stripped from exports). Optional for endpoints needing no auth.
	APIKey string `json:"apiKey"`
	// Model is the default model for referencing nodes.
	Model string `json:"model"`
	// TimeoutSeconds is the default per-call timeout; zero uses the
	// provider default.
	TimeoutSeconds float64 `json:"timeoutSeconds"`
	// ProviderOptions carries provider-specific options merged into
	// llm.LlmOptions.ProviderOptions. For provider "mock" the keys
	// "mock_response" (string) and "mock_error" (string) map onto
	// LlmOptions.MockResponse/MockError — the deterministic test seam.
	ProviderOptions map[string]interface{} `json:"providerOptions"`
}

Config holds the ai-provider configuration.

func ConfigForNode

func ConfigForNode(node nodestore.NodeInterface) (*Config, error)

ConfigForNode decodes the ai-provider config off a stored node definition — the path ai-request takes after LookupNode.

func (*Config) Options

func (c *Config) Options() llm.LlmOptions

Options builds the llm.LlmOptions this provider implies — the base the referencing node merges its per-call overrides onto. The credential sentinel resolves to an empty key so a stored sentinel never reaches the wire.

type ProviderNode

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

ProviderNode is a config entity; its Execute is never invoked (no ports), existing only to satisfy the NodeExecutor contract.

func NewProviderNode

func NewProviderNode(node nodestore.NodeInterface, config *Config) *ProviderNode

NewProviderNode creates a new ai-provider node.

func (*ProviderNode) Execute

Execute passes the payload through — unreachable in practice since an ai-provider node has no inputs.

func (*ProviderNode) Validate

func (n *ProviderNode) Validate() error

Validate checks the structural config: a known provider id, and a base URL when provider is "custom".

Jump to

Keyboard shortcuts

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