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 ¶
const Type = "ai-provider"
Type is the registered node type id for the provider config entity.
Variables ¶
This section is empty.
Functions ¶
func ResolveOptions ¶
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 ¶
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 ¶
func (n *ProviderNode) Execute(ctx context.Context, input nodestore.MessageInterface) (nodestore.MessageInterface, error)
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".