callback

package
v0.0.84 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2023 License: MIT Imports: 12 Imported by: 1

Documentation

Overview

Package callback provides utilities for implementing callbacks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewManager

func NewManager(inheritableCallbacks, localCallbacks []schema.Callback, verbose bool, optFns ...func(*ManagerOptions)) schema.CallbackManager

func NewManagerForChainRun added in v0.0.22

func NewManagerForChainRun(runID string, inheritableCallbacks, localCallbacks []schema.Callback, verbose bool, optFns ...func(*ManagerOptions)) schema.CallbackManagerForChainRun

func NewManagerForModelRun added in v0.0.26

func NewManagerForModelRun(runID string, inheritableCallbacks, localCallbacks []schema.Callback, verbose bool, optFns ...func(*ManagerOptions)) schema.CallbackManagerForModelRun

func NewManagerForRetrieverRun added in v0.0.52

func NewManagerForRetrieverRun(runID string, inheritableCallbacks, localCallbacks []schema.Callback, verbose bool, optFns ...func(*ManagerOptions)) schema.CallbackManagerForRetrieverRun

func NewManagerForToolRun added in v0.0.23

func NewManagerForToolRun(runID string, inheritableCallbacks, localCallbacks []schema.Callback, verbose bool, optFns ...func(*ManagerOptions)) schema.CallbackManagerForToolRun

Types

type ManagerOptions added in v0.0.22

type ManagerOptions struct {
	ParentRunID string
}

type NoopHandler added in v0.0.52

type NoopHandler struct{}

func (*NoopHandler) AlwaysVerbose added in v0.0.52

func (h *NoopHandler) AlwaysVerbose() bool

func (*NoopHandler) OnAgentAction added in v0.0.52

func (h *NoopHandler) OnAgentAction(ctx context.Context, input *schema.AgentActionInput) error

func (*NoopHandler) OnAgentFinish added in v0.0.52

func (h *NoopHandler) OnAgentFinish(ctx context.Context, input *schema.AgentFinishInput) error

func (*NoopHandler) OnChainEnd added in v0.0.52

func (h *NoopHandler) OnChainEnd(ctx context.Context, input *schema.ChainEndInput) error

func (*NoopHandler) OnChainError added in v0.0.52

func (h *NoopHandler) OnChainError(ctx context.Context, input *schema.ChainErrorInput) error

func (*NoopHandler) OnChainStart added in v0.0.52

func (h *NoopHandler) OnChainStart(ctx context.Context, input *schema.ChainStartInput) error

func (*NoopHandler) OnChatModelStart added in v0.0.52

func (h *NoopHandler) OnChatModelStart(ctx context.Context, input *schema.ChatModelStartInput) error

func (*NoopHandler) OnLLMStart added in v0.0.52

func (h *NoopHandler) OnLLMStart(ctx context.Context, input *schema.LLMStartInput) error

func (*NoopHandler) OnModelEnd added in v0.0.52

func (h *NoopHandler) OnModelEnd(ctx context.Context, input *schema.ModelEndInput) error

func (*NoopHandler) OnModelError added in v0.0.52

func (h *NoopHandler) OnModelError(ctx context.Context, input *schema.ModelErrorInput) error

func (*NoopHandler) OnModelNewToken added in v0.0.52

func (h *NoopHandler) OnModelNewToken(ctx context.Context, input *schema.ModelNewTokenInput) error

func (*NoopHandler) OnRetrieverEnd added in v0.0.52

func (h *NoopHandler) OnRetrieverEnd(ctx context.Context, input *schema.RetrieverEndInput) error

func (*NoopHandler) OnRetrieverError added in v0.0.52

func (h *NoopHandler) OnRetrieverError(ctx context.Context, input *schema.RetrieverErrorInput) error

func (*NoopHandler) OnRetrieverStart added in v0.0.52

func (h *NoopHandler) OnRetrieverStart(ctx context.Context, input *schema.RetrieverStartInput) error

func (*NoopHandler) OnText added in v0.0.52

func (h *NoopHandler) OnText(ctx context.Context, input *schema.TextInput) error

func (*NoopHandler) OnToolEnd added in v0.0.52

func (h *NoopHandler) OnToolEnd(ctx context.Context, input *schema.ToolEndInput) error

func (*NoopHandler) OnToolError added in v0.0.52

func (h *NoopHandler) OnToolError(ctx context.Context, input *schema.ToolErrorInput) error

func (*NoopHandler) OnToolStart added in v0.0.52

func (h *NoopHandler) OnToolStart(ctx context.Context, input *schema.ToolStartInput) error

func (*NoopHandler) RaiseError added in v0.0.52

func (h *NoopHandler) RaiseError() bool

type NoopManager added in v0.0.28

type NoopManager struct{}

func (*NoopManager) GetInheritableCallbacks added in v0.0.28

func (m *NoopManager) GetInheritableCallbacks() []schema.Callback

func (*NoopManager) OnAgentAction added in v0.0.28

func (m *NoopManager) OnAgentAction(ctx context.Context, input *schema.AgentActionManagerInput) error

func (*NoopManager) OnAgentFinish added in v0.0.28

func (m *NoopManager) OnAgentFinish(ctx context.Context, input *schema.AgentFinishManagerInput) error

func (*NoopManager) OnChainEnd added in v0.0.28

func (m *NoopManager) OnChainEnd(ctx context.Context, input *schema.ChainEndManagerInput) error

func (*NoopManager) OnChainError added in v0.0.28

func (m *NoopManager) OnChainError(ctx context.Context, input *schema.ChainErrorManagerInput) error

func (*NoopManager) OnModelEnd added in v0.0.28

func (m *NoopManager) OnModelEnd(ctx context.Context, input *schema.ModelEndManagerInput) error

func (*NoopManager) OnModelError added in v0.0.28

func (m *NoopManager) OnModelError(ctx context.Context, input *schema.ModelErrorManagerInput) error

func (*NoopManager) OnModelNewToken added in v0.0.28

func (m *NoopManager) OnModelNewToken(ctx context.Context, input *schema.ModelNewTokenManagerInput) error

func (*NoopManager) OnText added in v0.0.28

func (m *NoopManager) OnText(ctx context.Context, input *schema.TextManagerInput) error

func (*NoopManager) OnToolEnd added in v0.0.28

func (m *NoopManager) OnToolEnd(ctx context.Context, input *schema.ToolEndManagerInput) error

func (*NoopManager) OnToolError added in v0.0.28

func (m *NoopManager) OnToolError(ctx context.Context, input *schema.ToolErrorManagerInput) error

func (*NoopManager) RunID added in v0.0.28

func (m *NoopManager) RunID() string

type OnPromptLayerOutputFunc added in v0.0.27

type OnPromptLayerOutputFunc func(output *promptlayer.TrackRequestOutput) error

type OpenAIHandler added in v0.0.5

type OpenAIHandler struct {
	NoopHandler
	// contains filtered or unexported fields
}

func NewOpenAIHandler added in v0.0.7

func NewOpenAIHandler() *OpenAIHandler

func (*OpenAIHandler) AlwaysVerbose added in v0.0.5

func (cb *OpenAIHandler) AlwaysVerbose() bool

func (*OpenAIHandler) OnModelEnd added in v0.0.26

func (cb *OpenAIHandler) OnModelEnd(ctx context.Context, input *schema.ModelEndInput) error

func (*OpenAIHandler) String added in v0.0.5

func (cb *OpenAIHandler) String() string

type PromptLayerHandler added in v0.0.27

type PromptLayerHandler struct {
	NoopHandler
	// contains filtered or unexported fields
}

func NewPromptLayerHandler added in v0.0.27

func NewPromptLayerHandler(apiKey string, optFns ...func(o *PromptLayerHandlerOptions)) *PromptLayerHandler

func (PromptLayerHandler) AlwaysVerbose added in v0.0.27

func (cb PromptLayerHandler) AlwaysVerbose() bool

func (PromptLayerHandler) OnChatModelStart added in v0.0.27

func (cb PromptLayerHandler) OnChatModelStart(ctx context.Context, input *schema.ChatModelStartInput) error

func (PromptLayerHandler) OnLLMStart added in v0.0.27

func (cb PromptLayerHandler) OnLLMStart(ctx context.Context, input *schema.LLMStartInput) error

func (PromptLayerHandler) OnModelEnd added in v0.0.27

func (cb PromptLayerHandler) OnModelEnd(ctx context.Context, input *schema.ModelEndInput) error

type PromptLayerHandlerOptions added in v0.0.27

type PromptLayerHandlerOptions struct {
	PromptID                string
	OnPromptLayerOutputFunc OnPromptLayerOutputFunc
	Tags                    []string
}

type StreamWriterHandler added in v0.0.52

type StreamWriterHandler struct {
	NoopHandler
	// contains filtered or unexported fields
}

func NewStreamWriterHandler added in v0.0.52

func NewStreamWriterHandler(optFns ...func(o *StreamWriterHandlerOptions)) *StreamWriterHandler

func (*StreamWriterHandler) AlwaysVerbose added in v0.0.52

func (cb *StreamWriterHandler) AlwaysVerbose() bool

func (*StreamWriterHandler) OnModelNewToken added in v0.0.52

func (cb *StreamWriterHandler) OnModelNewToken(ctx context.Context, input *schema.ModelNewTokenInput) error

type StreamWriterHandlerOptions added in v0.0.52

type StreamWriterHandlerOptions struct {
	Writer io.Writer
}

type WriterHandler added in v0.0.52

type WriterHandler struct {
	NoopHandler
	// contains filtered or unexported fields
}

func NewWriterHandler added in v0.0.52

func NewWriterHandler(optFns ...func(o *WriterHandlerOptions)) *WriterHandler

func (*WriterHandler) OnAgentAction added in v0.0.52

func (cb *WriterHandler) OnAgentAction(ctx context.Context, input *schema.AgentActionInput) error

func (*WriterHandler) OnAgentFinish added in v0.0.52

func (cb *WriterHandler) OnAgentFinish(ctx context.Context, input *schema.AgentFinishInput) error

func (*WriterHandler) OnChainEnd added in v0.0.52

func (cb *WriterHandler) OnChainEnd(ctx context.Context, input *schema.ChainEndInput) error

func (*WriterHandler) OnChainStart added in v0.0.52

func (cb *WriterHandler) OnChainStart(ctx context.Context, input *schema.ChainStartInput) error

func (*WriterHandler) OnText added in v0.0.52

func (cb *WriterHandler) OnText(ctx context.Context, input *schema.TextInput) error

func (*WriterHandler) OnToolEnd added in v0.0.52

func (cb *WriterHandler) OnToolEnd(ctx context.Context, input *schema.ToolEndInput) error

type WriterHandlerOptions added in v0.0.52

type WriterHandlerOptions struct {
	Writer io.Writer
}

Jump to

Keyboard shortcuts

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