llmtask

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package llmtask provides one bounded, model-only JSON subtask tool.

Index

Constants

View Source
const DefaultMaxContentChars = defaultLLMTaskMaxContent

DefaultMaxContentChars is the default maximum model response size validated by the portable coordinator.

View Source
const DefaultTimeoutMs = defaultLLMTaskTimeoutMs

DefaultTimeoutMs is the default model call deadline used by NewHandler.

View Source
const Name = "llm_task"

Name is the catalog name of the LLM task tool.

Variables

This section is empty.

Functions

func BuildChatInput

func BuildChatInput(request Request) llm.ChatInput

BuildChatInput builds the model request without executing it.

func DecodeContent

func DecodeContent(content string, maxChars int) (any, string, error)

DecodeContent extracts and decodes one bounded JSON value from model text.

func Definition

func Definition() toolcontract.Definition

Definition returns the stable llm_task schema.

func Invoke

func Invoke(ctx context.Context, opts Options, request Request) (*llm.ChatResponse, error)

Invoke calls the explicit Host model adapter with the normalized request.

func NewHandler

func NewHandler(opts Options) toolcontract.Handler

NewHandler returns the portable model-facing handler.

func NormalizeSchema

func NormalizeSchema(raw any) (map[string]any, error)

NormalizeSchema accepts an object or JSON object string.

func Register

func Register(reg toolcontract.Registrar, opts Options)

Register adds llm_task when both a registrar and explicit model port exist.

func ValidateSchema

func ValidateSchema(schema map[string]any) error

ValidateSchema validates the supported JSON Schema subset.

func ValidateValue

func ValidateValue(value any, schema map[string]any) error

ValidateValue validates a decoded JSON value against the supported schema.

Types

type ChatWithInputFunc

type ChatWithInputFunc func(ctx context.Context, input llm.ChatInput) (*llm.ChatResponse, error)

ChatWithInputFunc is the narrow Host-owned model invocation port.

type Options

type Options struct {
	ModelConfig        string
	AllowModelOverride bool
	DefaultTimeoutMs   int
	MaxContentChars    int
	ChatWithInput      ChatWithInputFunc
}

Options configures the portable LLM task coordinator.

ChatWithInput is required. The package never discovers a provider, model, credential, endpoint, or global model registry.

type Request

type Request = llmTaskRequest

Request is the normalized advanced-composition contract used by Host Kit adapters that need to persist or route a subtask before model invocation.

func BuildRequest

func BuildRequest(params map[string]any, opts Options, defaultTimeout int) (Request, error)

BuildRequest validates and normalizes already-decoded arguments. It is intended for Host Kits that share llm_task semantics with a durable Session or Task lifecycle.

Jump to

Keyboard shortcuts

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