callback

package
v0.0.45 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2023 License: MIT Imports: 9 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 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 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 {
	// 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) OnAgentAction added in v0.0.23

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

func (*OpenAIHandler) OnAgentFinish added in v0.0.23

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

func (*OpenAIHandler) OnChainEnd added in v0.0.7

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

func (*OpenAIHandler) OnChainError added in v0.0.7

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

func (*OpenAIHandler) OnChainStart added in v0.0.7

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

func (*OpenAIHandler) OnChatModelStart added in v0.0.26

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

func (*OpenAIHandler) OnLLMStart added in v0.0.5

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

func (*OpenAIHandler) OnModelEnd added in v0.0.26

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

func (*OpenAIHandler) OnModelError added in v0.0.26

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

func (*OpenAIHandler) OnModelNewToken added in v0.0.26

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

func (*OpenAIHandler) OnText added in v0.0.23

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

func (*OpenAIHandler) OnToolEnd added in v0.0.23

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

func (*OpenAIHandler) OnToolError added in v0.0.23

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

func (*OpenAIHandler) OnToolStart added in v0.0.23

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

func (*OpenAIHandler) RaiseError added in v0.0.7

func (h *OpenAIHandler) RaiseError() bool

func (*OpenAIHandler) String added in v0.0.5

func (cb *OpenAIHandler) String() string

type PromptLayerHandler added in v0.0.27

type PromptLayerHandler struct {
	// 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) OnAgentAction added in v0.0.27

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

func (*PromptLayerHandler) OnAgentFinish added in v0.0.27

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

func (*PromptLayerHandler) OnChainEnd added in v0.0.27

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

func (*PromptLayerHandler) OnChainError added in v0.0.27

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

func (*PromptLayerHandler) OnChainStart added in v0.0.27

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

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

func (*PromptLayerHandler) OnModelError added in v0.0.27

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

func (*PromptLayerHandler) OnModelNewToken added in v0.0.27

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

func (*PromptLayerHandler) OnText added in v0.0.27

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

func (*PromptLayerHandler) OnToolEnd added in v0.0.27

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

func (*PromptLayerHandler) OnToolError added in v0.0.27

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

func (*PromptLayerHandler) OnToolStart added in v0.0.27

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

func (*PromptLayerHandler) RaiseError added in v0.0.27

func (h *PromptLayerHandler) RaiseError() bool

type PromptLayerHandlerOptions added in v0.0.27

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

type StdOutHandler added in v0.0.7

type StdOutHandler struct {
	// contains filtered or unexported fields
}

func NewStdOutHandler added in v0.0.7

func NewStdOutHandler() *StdOutHandler

func (*StdOutHandler) AlwaysVerbose added in v0.0.7

func (h *StdOutHandler) AlwaysVerbose() bool

func (*StdOutHandler) OnAgentAction added in v0.0.23

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

func (*StdOutHandler) OnAgentFinish added in v0.0.23

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

func (*StdOutHandler) OnChainEnd added in v0.0.7

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

func (*StdOutHandler) OnChainError added in v0.0.7

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

func (*StdOutHandler) OnChainStart added in v0.0.7

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

func (*StdOutHandler) OnChatModelStart added in v0.0.26

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

func (*StdOutHandler) OnLLMStart added in v0.0.7

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

func (*StdOutHandler) OnModelEnd added in v0.0.26

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

func (*StdOutHandler) OnModelError added in v0.0.26

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

func (*StdOutHandler) OnModelNewToken added in v0.0.26

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

func (*StdOutHandler) OnText added in v0.0.23

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

func (*StdOutHandler) OnToolEnd added in v0.0.23

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

func (*StdOutHandler) OnToolError added in v0.0.23

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

func (*StdOutHandler) OnToolStart added in v0.0.23

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

func (*StdOutHandler) RaiseError added in v0.0.7

func (h *StdOutHandler) RaiseError() bool

Jump to

Keyboard shortcuts

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