Documentation
¶
Overview ¶
Package webhook is the namespace of the webhooks' tools, of a webhook server, whose URLs external services call, and which is watched for their calls
Index ¶
- Constants
- type Calls
- type HandleFunc
- type Namespace
- func (*Namespace) Description() string
- func (ns *Namespace) Handle(fn HandleFunc)
- func (*Namespace) Name() string
- func (ns *Namespace) Run(parent context.Context, logger *slog.Logger) error
- func (*Namespace) SystemPrompt() string
- func (ns *Namespace) Tools() []llm.Tool
- func (*Namespace) Type() string
- func (ns *Namespace) Watch(ctx context.Context, ch chan<- eventschema.Change) error
Constants ¶
const (
// Agent is the name of the built-in agent which handles calls
Agent = "webhook"
)
const Name = "webhook"
Name is the name of the namespace of the webhooks' tools
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Calls ¶ added in v1.7.7
Calls are the calls of a session's webhooks, which were accepted, and weren't seen, oldest first, and the webhooks they're of
func (*Calls) Detail ¶ added in v1.7.7
Detail returns what the system says of the calls, to the session's model, which is their serial numbers, such as It's of webhook calls 12 and 13. It has nothing which was sent.
type HandleFunc ¶ added in v1.7.7
HandleFunc handles the calls of a session's webhooks, such as by running an agent with them, and returns nil once they're handled
type Namespace ¶
type Namespace struct {
// contains filtered or unexported fields
}
Namespace is the namespace of the webhooks' tools, of a webhook server
func New ¶
New returns the namespace of the webhook server's API, at the endpoint, such as http://localhost:8087/api, with the client options. The server isn't called until the namespace is run, or a tool is called.
func (*Namespace) Description ¶
Description returns what the namespace's tools are for
func (*Namespace) Handle ¶ added in v1.7.7
func (ns *Namespace) Handle(fn HandleFunc)
Handle sets the function which handles the calls of a session's webhooks, such as by running an agent with them. It's set before the namespace runs.
func (*Namespace) Run ¶
Run watches the webhook server for the calls of its webhooks, and, with Handle, handles those which were accepted, and weren't seen, which include those received while it wasn't running, until the context is cancelled, when it returns nil. Those received within half a minute of the first are handled together, those of each session at once. They're marked as seen once they're handled, so they're not handled again, unless it stops before they're marked.
When the server can't be reached, or stops, it tries again, waiting longer each time. Calls which can't be handled are tried again, up to a few times, waiting longer each time, and then marked as seen, so they don't stop those after them. What was sent isn't logged. Returns ErrConflict when it's running already.
func (*Namespace) SystemPrompt ¶
SystemPrompt returns no system prompt, as the tools' descriptions say how to use them