Documentation
¶
Index ¶
- func NewChatHook(dbInstance libdb.DBManager, chatManager *chat.Manager) taskengine.HookRepo
- func NewEchoHook() taskengine.HookRepo
- func NewMux(hooks map[string]taskengine.HookRepo, tracker activitytracker.ActivityTracker) taskengine.HookRepo
- func NewSearch(embedder embedservice.Service, vectorsStore vectors.Store, ...) taskengine.HookRepo
- func NewSimpleProvider(hooks map[string]taskengine.HookRepo) taskengine.HookRepo
- func NewWebCaller(options ...WebhookOption) taskengine.HookRepo
- type BridgeService
- type Chat
- func (h *Chat) AppendOpenAIChatToChathistory(ctx context.Context, startTime time.Time, input any, ...) (any, taskengine.DataType, string, error)
- func (h *Chat) ConvertToOpenAIResponse(ctx context.Context, startTime time.Time, input any, ...) (any, taskengine.DataType, string, error)
- func (h *Chat) Exec(ctx context.Context, startTime time.Time, input any, ...) (any, taskengine.DataType, string, error)
- func (h *Chat) Get(name string) (...)
- func (h *Chat) Supports(ctx context.Context) ([]string, error)
- type EchoHook
- type HookCallRecord
- type HookResponse
- type MockHookRepo
- func (m *MockHookRepo) CallCount() int
- func (m *MockHookRepo) Exec(ctx context.Context, startingTime time.Time, input any, ...) (int, any, taskengine.DataType, string, error)
- func (m *MockHookRepo) LastCall() *HookCallRecord
- func (m *MockHookRepo) Reset()
- func (m *MockHookRepo) Supports(ctx context.Context) ([]string, error)
- func (m *MockHookRepo) WithErrorSequence(errors ...error) *MockHookRepo
- func (m *MockHookRepo) WithResponse(hookType string, response HookResponse) *MockHookRepo
- type Mux
- type Print
- type Search
- type SearchResolve
- type SimpleRepo
- type Transition
- type WebCaller
- type WebhookOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewChatHook ¶
NewChatHook creates a new Chat hook repository instance.
func NewEchoHook ¶
func NewEchoHook() taskengine.HookRepo
NewEchoHook creates a new instance of EchoHook.
func NewMux ¶
func NewMux(hooks map[string]taskengine.HookRepo, tracker activitytracker.ActivityTracker) taskengine.HookRepo
NewMux creates a new Mux hook router with registered sub-hooks.
func NewSearch ¶
func NewSearch( embedder embedservice.Service, vectorsStore vectors.Store, dbInstance libdb.DBManager, ) taskengine.HookRepo
func NewSimpleProvider ¶
func NewSimpleProvider(hooks map[string]taskengine.HookRepo) taskengine.HookRepo
func NewWebCaller ¶
func NewWebCaller(options ...WebhookOption) taskengine.HookRepo
NewWebCaller creates a new webhook caller
Types ¶
type BridgeService ¶
type BridgeService struct {
Hooks map[string]taskengine.HookRepo
Client *runtimesdk.Client
BaseURL string // Gateway's internal URL (e.g., http://gateway:8080)
}
func NewBridgeService ¶
func NewBridgeService(hooks map[string]taskengine.HookRepo, client *runtimesdk.Client, baseURL string) *BridgeService
func (*BridgeService) HandleHook ¶
func (b *BridgeService) HandleHook(w http.ResponseWriter, r *http.Request)
type Chat ¶
type Chat struct {
// contains filtered or unexported fields
}
Chat implements taskengine.HookRepo and manages chat-related hooks. It enables integration of chat-based logic like appending user input, invoking LLMs, and persisting chat messages.
func (*Chat) AppendOpenAIChatToChathistory ¶
func (*Chat) ConvertToOpenAIResponse ¶
func (*Chat) Exec ¶
func (h *Chat) Exec(ctx context.Context, startTime time.Time, input any, dataType taskengine.DataType, transition string, hookCall *taskengine.HookCall) (any, taskengine.DataType, string, error)
Exec resolves and runs the hook function based on the provided hook call.
type EchoHook ¶
type EchoHook struct{}
EchoHook is a simple hook that echoes back the input arguments.
func (*EchoHook) Exec ¶
func (e *EchoHook) Exec(ctx context.Context, startTime time.Time, input any, dataType taskengine.DataType, transition string, hookCall *taskengine.HookCall) (any, taskengine.DataType, string, error)
Exec handles execution by echoing the input arguments.
type HookCallRecord ¶
type HookCallRecord struct {
Args taskengine.HookCall
Input any
InputType taskengine.DataType
Transition string
}
type HookResponse ¶
type HookResponse struct {
Status int
Output any
OutputType taskengine.DataType
Transition string
}
type MockHookRepo ¶
type MockHookRepo struct {
Calls []HookCallRecord
ResponseMap map[string]HookResponse
DefaultResponse HookResponse
ErrorSequence []error
// contains filtered or unexported fields
}
MockHookRepo is a mock implementation of the HookProvider interface.
func NewMockHookRegistry ¶
func NewMockHookRegistry() *MockHookRepo
NewMockHookRegistry returns a new instance of MockHookProvider.
func (*MockHookRepo) CallCount ¶
func (m *MockHookRepo) CallCount() int
CallCount returns number of times Exec was called
func (*MockHookRepo) Exec ¶
func (m *MockHookRepo) Exec( ctx context.Context, startingTime time.Time, input any, inputType taskengine.DataType, transition string, args *taskengine.HookCall, ) (int, any, taskengine.DataType, string, error)
Exec simulates execution of a hook call.
func (*MockHookRepo) LastCall ¶
func (m *MockHookRepo) LastCall() *HookCallRecord
LastCall returns the most recent hook call
func (*MockHookRepo) Reset ¶
func (m *MockHookRepo) Reset()
Reset clears all recorded calls and resets counters
func (*MockHookRepo) Supports ¶
func (m *MockHookRepo) Supports(ctx context.Context) ([]string, error)
func (*MockHookRepo) WithErrorSequence ¶
func (m *MockHookRepo) WithErrorSequence(errors ...error) *MockHookRepo
WithErrorSequence sets a sequence of errors to return
func (*MockHookRepo) WithResponse ¶
func (m *MockHookRepo) WithResponse(hookType string, response HookResponse) *MockHookRepo
WithResponse configures a response for a specific hook type
type Mux ¶
type Mux struct {
// contains filtered or unexported fields
}
Mux implements a hook router that dispatches to sub-hooks based on command prefixes. It supports command parsing in the format: /<command> [arguments]
func (*Mux) Exec ¶
func (m *Mux) Exec(ctx context.Context, startTime time.Time, input any, dataType taskengine.DataType, transition string, hookCall *taskengine.HookCall) (any, taskengine.DataType, string, error)
Exec processes input by either routing to a sub-hook or returning unaltered input.
type Print ¶
type Print struct {
// contains filtered or unexported fields
}
Print implements a simple hook that returns predefined messages
func NewPrint ¶
func NewPrint(tracker activitytracker.ActivityTracker) *Print
NewPrint creates a new Print instance
type Search ¶
type Search struct {
// contains filtered or unexported fields
}
func (*Search) Exec ¶
func (h *Search) Exec( ctx context.Context, startTime time.Time, input any, dataType taskengine.DataType, transition string, hook *taskengine.HookCall, ) (any, taskengine.DataType, string, error)
Exec executes the "search" hook by performing a vector search based on the input string.
type SearchResolve ¶
type SearchResolve struct {
// contains filtered or unexported fields
}
func NewSearchResolveHook ¶
func NewSearchResolveHook(dbInstance libdb.DBManager) *SearchResolve
func (*SearchResolve) Exec ¶
func (s *SearchResolve) Exec(ctx context.Context, startTime time.Time, input any, dataType taskengine.DataType, transition string, args *taskengine.HookCall) (any, taskengine.DataType, string, error)
Exec implements taskengine.HookRepo.
type SimpleRepo ¶
type SimpleRepo struct {
// contains filtered or unexported fields
}
func (*SimpleRepo) Exec ¶
func (m *SimpleRepo) Exec(ctx context.Context, startingTime time.Time, input any, dataType taskengine.DataType, transition string, args *taskengine.HookCall) (any, taskengine.DataType, string, error)
type Transition ¶
type Transition struct {
// contains filtered or unexported fields
}
Transition simply returns a transition value without modifying input
func NewTransition ¶
func NewTransition(transition string, tracker activitytracker.ActivityTracker) *Transition
func (*Transition) Exec ¶
func (h *Transition) Exec(ctx context.Context, startTime time.Time, input any, dataType taskengine.DataType, transition string, hookCall *taskengine.HookCall) (any, taskengine.DataType, string, error)
type WebCaller ¶
type WebCaller struct {
// contains filtered or unexported fields
}
WebCaller makes HTTP requests to external services
type WebhookOption ¶
type WebhookOption func(*WebCaller)
WebhookOption configures the WebhookCaller
func WithDefaultHeader ¶
func WithDefaultHeader(key, value string) WebhookOption
WithDefaultHeader sets a default header
func WithHTTPClient ¶
func WithHTTPClient(client *http.Client) WebhookOption
WithHTTPClient sets a custom HTTP client