Documentation ¶
Overview ¶
Package callbacks includes a standard interface for hooking into various stages of your LLM application. The package contains an implementation of this interface that prints to the standard output.
Index ¶
- type Handler
- type HandlerHaver
- type LogHandler
- func (l LogHandler) HandleAgentAction(_ context.Context, action schema.AgentAction)
- func (l LogHandler) HandleChainEnd(_ context.Context, outputs map[string]any)
- func (l LogHandler) HandleChainStart(_ context.Context, inputs map[string]any)
- func (l LogHandler) HandleLLMEnd(_ context.Context, output llms.LLMResult)
- func (l LogHandler) HandleLLMStart(_ context.Context, prompts []string)
- func (l LogHandler) HandleRetrieverEnd(_ context.Context, documents []schema.Document)
- func (l LogHandler) HandleRetrieverStart(_ context.Context, query string)
- func (l LogHandler) HandleText(_ context.Context, text string)
- func (l LogHandler) HandleToolEnd(_ context.Context, output string)
- func (l LogHandler) HandleToolStart(_ context.Context, input string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler interface { HandleText(ctx context.Context, text string) HandleLLMStart(ctx context.Context, prompts []string) HandleLLMEnd(ctx context.Context, output llms.LLMResult) HandleChainStart(ctx context.Context, inputs map[string]any) HandleChainEnd(ctx context.Context, outputs map[string]any) HandleToolStart(ctx context.Context, input string) HandleToolEnd(ctx context.Context, output string) HandleAgentAction(ctx context.Context, action schema.AgentAction) HandleRetrieverStart(ctx context.Context, query string) HandleRetrieverEnd(ctx context.Context, documents []schema.Document) }
Handler is the interface that allows for hooking into specific parts of an LLM application.
type HandlerHaver ¶
type HandlerHaver interface {
GetCallbackHandler() Handler
}
HandlerHaver is an interface used to get callbacks handler.
type LogHandler ¶
type LogHandler struct{}
LogHandler is a callback handler that prints to the standard output.
func (LogHandler) HandleAgentAction ¶
func (l LogHandler) HandleAgentAction(_ context.Context, action schema.AgentAction)
func (LogHandler) HandleChainEnd ¶
func (l LogHandler) HandleChainEnd(_ context.Context, outputs map[string]any)
func (LogHandler) HandleChainStart ¶
func (l LogHandler) HandleChainStart(_ context.Context, inputs map[string]any)
func (LogHandler) HandleLLMEnd ¶
func (l LogHandler) HandleLLMEnd(_ context.Context, output llms.LLMResult)
func (LogHandler) HandleLLMStart ¶
func (l LogHandler) HandleLLMStart(_ context.Context, prompts []string)
func (LogHandler) HandleRetrieverEnd ¶
func (l LogHandler) HandleRetrieverEnd(_ context.Context, documents []schema.Document)
func (LogHandler) HandleRetrieverStart ¶
func (l LogHandler) HandleRetrieverStart(_ context.Context, query string)
func (LogHandler) HandleText ¶
func (l LogHandler) HandleText(_ context.Context, text string)
func (LogHandler) HandleToolEnd ¶
func (l LogHandler) HandleToolEnd(_ context.Context, output string)
func (LogHandler) HandleToolStart ¶
func (l LogHandler) HandleToolStart(_ context.Context, input string)
Click to show internal directories.
Click to hide internal directories.