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.
21 lines
412 B
Go
21 lines
412 B
Go
//nolint:forbidigo
|
|
package callbacks
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"github.com/vxcontrol/langchaingo/llms/streaming"
|
|
)
|
|
|
|
// StreamLogHandler is a callback handler that prints to the standard output streaming.
|
|
type StreamLogHandler struct {
|
|
SimpleHandler
|
|
}
|
|
|
|
var _ Handler = StreamLogHandler{}
|
|
|
|
func (StreamLogHandler) HandleStreamingFunc(_ context.Context, chunk streaming.Chunk) {
|
|
fmt.Println(chunk.String())
|
|
}
|