ask

package
v0.0.0-beta Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package ask provides a tool for the LLM to ask the user questions mid-execution.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Inputs

type Inputs struct {
	Question    string   `json:"question" jsonschema:"required,description=The question to ask the user"`
	Options     []Option `json:"options,omitempty" jsonschema:"description=Available choices (omit for free-form text input)"`
	MultiSelect bool     `json:"multi_select,omitempty" jsonschema:"description=Allow selecting multiple options (only with options)"`
}

Inputs defines the parameters for the Ask tool.

type Option

type Option struct {
	Label       string `json:"label" jsonschema:"required,description=Short display text for this choice"`
	Description string `json:"description,omitempty" jsonschema:"description=Explanation of what this option means"`
}

Option represents a selectable choice presented to the user.

type Request

type Request struct {
	Question    string
	Options     []Option
	MultiSelect bool
}

Request is the callback payload passed to the UI layer. Decoupled from JSON schema tags.

type Tool

type Tool struct {
	tool.Base
	// contains filtered or unexported fields
}

Tool allows the LLM to ask the user a question and receive a response.

func New

func New(ask func(ctx context.Context, req Request) (string, error)) *Tool

New creates an Ask tool with the given callback.

func (*Tool) Execute

func (t *Tool) Execute(ctx context.Context, args map[string]any) (string, error)

Execute asks the user a question via the callback and returns their response.

func (*Tool) Name

func (t *Tool) Name() string

Name returns the tool's identifier.

func (*Tool) Parallel

func (t *Tool) Parallel() bool

Parallel returns false because Ask blocks on user input; concurrent prompts would confuse the user.

func (*Tool) Sandboxable

func (t *Tool) Sandboxable() bool

Sandboxable returns false as this tool has no filesystem operations.

func (*Tool) Schema

func (t *Tool) Schema() tool.Schema

Schema returns the provider-agnostic tool definition.

Jump to

Keyboard shortcuts

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