Documentation
¶
Index ¶
- Variables
- func JSONSchema(value any) json.RawMessage
- func Node[S any](id string, spec NodeSpec[S]) graph.NodeSpec[S]
- func WithAdjuster(ctx context.Context, adjuster Adjuster) context.Context
- func WithRegistry(ctx context.Context, registry *Registry) context.Context
- type Adjuster
- type AfterToolRequest
- type AfterToolResult
- type Call
- type Definition
- func (d *Definition[TIn, TOut]) Description(text string) *Definition[TIn, TOut]
- func (d *Definition[TIn, TOut]) Execute(fn ExecuteFunc[TIn, TOut]) *Definition[TIn, TOut]
- func (d *Definition[TIn, TOut]) ExecuteJSON(ctx context.Context, input json.RawMessage) (Result, error)
- func (d *Definition[TIn, TOut]) InputSchema(schema any) *Definition[TIn, TOut]
- func (d *Definition[TIn, TOut]) Permission(policy PermissionPolicy[TIn]) *Definition[TIn, TOut]
- func (d *Definition[TIn, TOut]) PermissionJSON(ctx context.Context, input json.RawMessage) (hitl.Request, bool, error)
- func (d *Definition[TIn, TOut]) Spec() Spec
- type Executable
- type ExecuteFunc
- type NodeSpec
- type PermissionPolicy
- type Registry
- type Result
- type Spec
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrPermissionDenied = errors.New("tool: permission denied")
Functions ¶
func JSONSchema ¶
func JSONSchema(value any) json.RawMessage
Types ¶
type Adjuster ¶
type Adjuster interface {
AfterTool(context.Context, AfterToolRequest) (AfterToolResult, error)
}
type AfterToolRequest ¶
type AfterToolResult ¶
type AfterToolResult struct {
Result *Result `json:"result,omitempty"`
}
type Call ¶
type Call struct {
ID string `json:"id"`
Name string `json:"name"`
Arguments json.RawMessage `json:"arguments,omitempty"`
}
func FromLLMToolCalls ¶
type Definition ¶
type Definition[TIn, TOut any] struct { // contains filtered or unexported fields }
func Define ¶
func Define[TIn, TOut any](id string) *Definition[TIn, TOut]
func (*Definition[TIn, TOut]) Description ¶
func (d *Definition[TIn, TOut]) Description(text string) *Definition[TIn, TOut]
func (*Definition[TIn, TOut]) Execute ¶
func (d *Definition[TIn, TOut]) Execute(fn ExecuteFunc[TIn, TOut]) *Definition[TIn, TOut]
func (*Definition[TIn, TOut]) ExecuteJSON ¶
func (d *Definition[TIn, TOut]) ExecuteJSON(ctx context.Context, input json.RawMessage) (Result, error)
func (*Definition[TIn, TOut]) InputSchema ¶
func (d *Definition[TIn, TOut]) InputSchema(schema any) *Definition[TIn, TOut]
func (*Definition[TIn, TOut]) Permission ¶
func (d *Definition[TIn, TOut]) Permission(policy PermissionPolicy[TIn]) *Definition[TIn, TOut]
func (*Definition[TIn, TOut]) PermissionJSON ¶
func (d *Definition[TIn, TOut]) PermissionJSON(ctx context.Context, input json.RawMessage) (hitl.Request, bool, error)
func (*Definition[TIn, TOut]) Spec ¶
func (d *Definition[TIn, TOut]) Spec() Spec
type Executable ¶
type NodeSpec ¶
type NodeSpec[S any] struct { Registry *Registry ToolIDs []string Calls func(context.Context, S) ([]Call, error) Output func(context.Context, S, []Result) (graph.Command[S], error) Error func(context.Context, S, Call, error) (graph.Command[S], error) ContinueOnError bool MaxConcurrency int ProgressInterval time.Duration Metadata map[string]string }
type PermissionPolicy ¶
func RequireApproval ¶
func RequireApproval[TIn any](reason string) PermissionPolicy[TIn]
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
func NewRegistry ¶
func NewRegistry() *Registry
func (*Registry) Register ¶
func (r *Registry) Register(item Executable) error
type Result ¶
type Result struct {
CallID string `json:"call_id"`
Name string `json:"name"`
Content string `json:"content,omitempty"`
Raw json.RawMessage `json:"raw,omitempty"`
Error string `json:"error,omitempty"`
}
func ErrorResult ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.