Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetImplSpecificOptions ¶
GetImplSpecificOptions provides tool author the ability to extract their own custom options from the unified Option type. T: the type of the impl specific options struct. This function should be used within the tool implementation's InvokableRun or StreamableRun functions. It is recommended to provide a base T as the first argument, within which the tool author can provide default values for the impl specific options. eg.
type customOptions struct { conf string } defaultOptions := &customOptions{} customOptions := tool.GetImplSpecificOptions(defaultOptions, opts...)
Types ¶
type CallbackInput ¶
type CallbackInput struct { // ArgumentsInJSON is the arguments in json format for the tool. ArgumentsInJSON string // Extra is the extra information for the tool. Extra map[string]any }
CallbackInput is the input for the tool callback.
func ConvCallbackInput ¶
func ConvCallbackInput(src callbacks.CallbackInput) *CallbackInput
ConvCallbackInput converts the callback input to the tool callback input.
type CallbackOutput ¶
type CallbackOutput struct { // Response is the response for the tool. Response string // Extra is the extra information for the tool. Extra map[string]any }
CallbackOutput is the output for the tool callback.
func ConvCallbackOutput ¶
func ConvCallbackOutput(src callbacks.CallbackOutput) *CallbackOutput
ConvCallbackOutput converts the callback output to the tool callback output.
type InvokableTool ¶
type InvokableTool interface { BaseTool // InvokableRun call function with arguments in JSON format InvokableRun(ctx context.Context, argumentsInJSON string, opts ...Option) (string, error) }
InvokableTool the tool for ChatModel intent recognition and ToolsNode execution. nolint: byted_s_interface_name
type Option ¶
type Option struct {
// contains filtered or unexported fields
}
Option defines call option for InvokableTool or StreamableTool component, which is part of component interface signature. Each tool implementation could define its own options struct and option funcs within its own package, then wrap the impl specific option funcs into this type, before passing to InvokableRun or StreamableRun.
func WrapImplSpecificOptFn ¶
WrapImplSpecificOptFn wraps the impl specific option functions into Option type. T: the type of the impl specific options struct. Tool implementations are required to use this function to convert its own option functions into the unified Option type. For example, if the tool defines its own options struct:
type customOptions struct { conf string }
Then the tool needs to provide an option function as such:
func WithConf(conf string) Option { return WrapImplSpecificOptFn(func(o *customOptions) { o.conf = conf } }
.