Documentation
¶
Index ¶
- func GetBase64ThoughtSignatureFromExtra(extra map[string]any) string
- func GetSpanContext(ctx context.Context) cozeloop.SpanContext
- func GetThoughtSignatureFromExtra(extra map[string]any) ([]byte, bool)
- func NewLoopHandler(client cozeloop.Client, opts ...Option) callbacks.Handler
- func WithSpanContext(ctx context.Context) context.Context
- type AggrMessageOutput
- type CallbackDataParser
- type EinoVersionFn
- type Handler
- func (h *Handler) OnEnd(ctx context.Context, info *callbacks.RunInfo, output callbacks.CallbackOutput) context.Context
- func (h *Handler) OnEndWithStreamOutput(ctx context.Context, info *callbacks.RunInfo, ...) context.Context
- func (h *Handler) OnError(ctx context.Context, info *callbacks.RunInfo, err error) context.Context
- func (h *Handler) OnStart(ctx context.Context, info *callbacks.RunInfo, input callbacks.CallbackInput) context.Context
- func (h *Handler) OnStartWithStreamInput(ctx context.Context, info *callbacks.RunInfo, ...) context.Context
- type Option
- func WithAggrMessageOutput(enable bool) Option
- func WithCallbackDataParser(parser CallbackDataParser) Option
- func WithConcatFunction[T any](fn func([]T) (T, error)) Option
- func WithEinoVersionFn(fn EinoVersionFn) Option
- func WithEnableTracing(enable bool) Option
- func WithLogger(logger cozeloop.Logger) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetSpanContext ¶
func GetSpanContext(ctx context.Context) cozeloop.SpanContext
func GetThoughtSignatureFromExtra ¶
GetThoughtSignatureFromExtra copy from github.com/cloudwego/eino-ext/components/model/gemini, because it's go version is 1.24. we can't depend on it.
tries to read thought_signature from an Extra map.
thought_signature should be read from:
- message.AssistantGenMultiContent[i].Extra: thought_signature on each generated output part
- toolCall.Extra: thought_signature on toolCall
- message.Extra: thought_signature on generated content (legacy, only used when message.AssistantGenMultiContent are absent)
The returned bool indicates whether thought_signature key exists in Extra. The returned []byte is the thought signature if available
Types ¶
type AggrMessageOutput ¶
type AggrMessageOutput struct {
Messages []*tracespec.ModelMessage `json:"messages"`
// contains filtered or unexported fields
}
type CallbackDataParser ¶
type CallbackDataParser interface {
ParseInput(ctx context.Context, info *callbacks.RunInfo, input callbacks.CallbackInput) map[string]any
ParseOutput(ctx context.Context, info *callbacks.RunInfo, output callbacks.CallbackOutput) map[string]any
ParseStreamInput(ctx context.Context, info *callbacks.RunInfo, input *schema.StreamReader[callbacks.CallbackInput]) map[string]any
ParseStreamOutput(ctx context.Context, info *callbacks.RunInfo, output *schema.StreamReader[callbacks.CallbackOutput]) map[string]any
}
CallbackDataParser tag parser for trace Implement CallbackDataParser and replace defaultDataParser by WithCallbackDataParser if needed
func NewDefaultDataParser ¶
func NewDefaultDataParser(enableAggrMessageOutput bool) CallbackDataParser
type EinoVersionFn ¶
type EinoVersionFn func() string
type Handler ¶
func (*Handler) OnEndWithStreamOutput ¶
func (*Handler) OnStartWithStreamInput ¶
type Option ¶
type Option func(o *options)
func WithAggrMessageOutput ¶
func WithCallbackDataParser ¶
func WithCallbackDataParser(parser CallbackDataParser) Option
func WithConcatFunction ¶
func WithEinoVersionFn ¶
func WithEinoVersionFn(fn EinoVersionFn) Option
func WithEnableTracing ¶
func WithLogger ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.