remotefn

package
v0.16.0-llm.2 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FnCall

func FnCall(ctx context.Context, fn interface{}, jsonArgs []byte) (interface{}, error)

FnCall decodes `jsonArgs` into T, then calls `fn`, returning (interface{}, error). fn can be:

func(T) (R, error)
func(context.Context, T) (R, error)

func FnDecodeArgs

func FnDecodeArgs(ctx context.Context, fn interface{}, jsonArgs string) (interface{}, error)

FnDecodeArgs decodes the JSON into the function's expected argument type T but does not call the function. It returns (decodedValue, error).

func FnDescription

func FnDescription(fn interface{}) (string, error)

FnDescription returns the doc comment from above the function in its .go file.

func FnName

func FnName(fn interface{}) (string, error)

FnName returns the (best-effort) name of the function or method ("FooMethod", etc.).

func FnSchema

func FnSchema(fn interface{}) (map[string]interface{}, error)

FnSchema inspects `fn` to see if it's either:

func(T) (R, error)                 // single-arg
func(context.Context, T) (R, error) // context + single-arg

It extracts T (the user argument type), then returns a JSON Schema for T as a map[string]interface{} (instead of a JSON string).

Types

This section is empty.

Jump to

Keyboard shortcuts

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