llm

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BuiltinModuleTypes = map[string]string{
	"http.server":               "HTTP server with address config",
	"http.router":               "HTTP router, depends on server",
	"http.handler":              "Generic HTTP handler with contentType",
	"api.handler":               "REST API handler with resourceName",
	"http.middleware.auth":      "Authentication middleware",
	"http.middleware.logging":   "Logging middleware with logLevel",
	"http.middleware.ratelimit": "Rate limiter with requestsPerMinute and burstSize",
	"http.middleware.cors":      "CORS middleware with allowedOrigins and allowedMethods",
	"messaging.broker":          "In-memory message broker",
	"messaging.handler":         "Message subscription handler",
	"statemachine.engine":       "State machine engine",
	"state.tracker":             "State tracker for resources",
	"state.connector":           "Connects state machines to resources",
	"event.processor":           "Complex event pattern processor",
	"scheduler.modular":         "Cron-based scheduler",
	"cache.modular":             "Cache module",
	"messaging.broker.eventbus": "EventBus bridge for pub/sub",
	"reverseproxy":              "Reverse proxy",
	"http.proxy":                "Reverse proxy (alias)",
}

BuiltinModuleTypes returns the list of available module types and their descriptions.

Functions

func ExtractCode

func ExtractCode(text string) string

ExtractCode strips markdown code fences from generated Go code.

func ExtractJSON

func ExtractJSON(text string) string

ExtractJSON finds the first JSON object or array in text.

func HandleToolCall

func HandleToolCall(name string, input json.RawMessage) (string, error)

HandleToolCall executes a tool call and returns the result as a string.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client implements ai.WorkflowGenerator using the Anthropic Claude API.

func NewClient

func NewClient(cfg ClientConfig) (*Client, error)

NewClient creates a new Anthropic LLM client.

func (*Client) GenerateComponent

func (c *Client) GenerateComponent(ctx context.Context, spec ai.ComponentSpec) (string, error)

GenerateComponent generates Go source code for a component specification.

func (*Client) GenerateWorkflow

func (c *Client) GenerateWorkflow(ctx context.Context, req ai.GenerateRequest) (*ai.GenerateResponse, error)

GenerateWorkflow creates a workflow config from a natural language request.

func (*Client) IdentifyMissingComponents

func (c *Client) IdentifyMissingComponents(ctx context.Context, cfg *config.WorkflowConfig) ([]ai.ComponentSpec, error)

IdentifyMissingComponents analyzes a config for non-built-in module types.

func (*Client) SuggestWorkflow

func (c *Client) SuggestWorkflow(ctx context.Context, useCase string) ([]ai.WorkflowSuggestion, error)

SuggestWorkflow returns workflow suggestions for a use case.

type ClientConfig

type ClientConfig struct {
	APIKey  string `json:"-"` //nolint:gosec // G117: config struct field, not a credential
	Model   string // Defaults to claude-sonnet-4-20250514
	BaseURL string // Defaults to https://api.anthropic.com
}

ClientConfig holds configuration for the Anthropic LLM client.

type ToolDefinition

type ToolDefinition struct {
	Name        string         `json:"name"`
	Description string         `json:"description"`
	InputSchema map[string]any `json:"input_schema"`
}

ToolDefinition describes a tool the LLM can call during workflow generation.

func Tools

func Tools() []ToolDefinition

Tools returns the tool definitions for the Claude API.

Jump to

Keyboard shortcuts

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