mirror of
https://github.com/vxcontrol/langchaingo.git
synced 2026-08-24 21:31:28 -04:00
6317685b67
- Updated LLMs and callback interfaces to utilize a new streaming package for handling content chunks. - Changed function signatures to accept streaming.Chunk instead of byte slices for better type safety and clarity. - Enhanced examples and tests to demonstrate the new streaming capabilities, ensuring compatibility with existing functionality. - Added reasoning and tool call handling in streaming responses for improved processing of LLM outputs.
32 lines
1.7 KiB
Go
32 lines
1.7 KiB
Go
//nolint:forbidigo
|
|
package callbacks
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/vxcontrol/langchaingo/llms"
|
|
"github.com/vxcontrol/langchaingo/llms/streaming"
|
|
"github.com/vxcontrol/langchaingo/schema"
|
|
)
|
|
|
|
type SimpleHandler struct{}
|
|
|
|
var _ Handler = SimpleHandler{}
|
|
|
|
func (SimpleHandler) HandleText(context.Context, string) {}
|
|
func (SimpleHandler) HandleLLMStart(context.Context, []string) {}
|
|
func (SimpleHandler) HandleLLMGenerateContentStart(context.Context, []llms.MessageContent) {}
|
|
func (SimpleHandler) HandleLLMGenerateContentEnd(context.Context, *llms.ContentResponse) {}
|
|
func (SimpleHandler) HandleLLMError(context.Context, error) {}
|
|
func (SimpleHandler) HandleChainStart(context.Context, map[string]any) {}
|
|
func (SimpleHandler) HandleChainEnd(context.Context, map[string]any) {}
|
|
func (SimpleHandler) HandleChainError(context.Context, error) {}
|
|
func (SimpleHandler) HandleToolStart(context.Context, string) {}
|
|
func (SimpleHandler) HandleToolEnd(context.Context, string) {}
|
|
func (SimpleHandler) HandleToolError(context.Context, error) {}
|
|
func (SimpleHandler) HandleAgentAction(context.Context, schema.AgentAction) {}
|
|
func (SimpleHandler) HandleAgentFinish(context.Context, schema.AgentFinish) {}
|
|
func (SimpleHandler) HandleRetrieverStart(context.Context, string) {}
|
|
func (SimpleHandler) HandleRetrieverEnd(context.Context, string, []schema.Document) {}
|
|
func (SimpleHandler) HandleStreamingFunc(context.Context, streaming.Chunk) {}
|