Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: cloudwego/eino-ext
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: ff5c12c1b61d27dbf8fbfd55ffed657b4b43caed
Choose a base ref
..
head repository: cloudwego/eino-ext
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 4228a484766e330b2d01123fc22c48ec6ef79097
Choose a head ref
Showing with 83 additions and 86 deletions.
  1. +81 −16 callbacks/langfuse/langfuse.go
  2. +0 −70 callbacks/langfuse/option.go
  3. +2 −0 devops/model/canvas.go
97 changes: 81 additions & 16 deletions callbacks/langfuse/langfuse.go
Original file line number Diff line number Diff line change
@@ -32,30 +32,95 @@ import (
)

type Config struct {
Host string
// Host is the Langfuse server URL (Required)
// Example: "https://cloud.langfuse.com"
Host string

// PublicKey is the public key for authentication (Required)
// Example: "pk-lf-..."
PublicKey string

// SecretKey is the secret key for authentication (Required)
// Example: "sk-lf-..."
SecretKey string

Threads int
Timeout time.Duration
// Threads is the number of concurrent workers for processing events (Optional)
// Default: 1
// Example: 5
Threads int

// Timeout is the HTTP request timeout (Optional)
// Default: no timeout
// Example: 30 * time.Second
Timeout time.Duration

// MaxTaskQueueSize is the maximum number of events to buffer (Optional)
// Default: 100
// Example: 1000
MaxTaskQueueSize int
FlushAt int
FlushInterval time.Duration
SampleRate float64
LogMessage string
MaskFunc func(string) string
MaxRetry uint64

Name string
UserID string

// FlushAt is the number of events to batch before sending (Optional)
// Default: 15
// Example: 50
FlushAt int

// FlushInterval is how often to flush events automatically (Optional)
// Default: 500 * time.MilliSecond
// Example: 10 * time.Second
FlushInterval time.Duration

// SampleRate is the percentage of events to send (Optional)
// Default: 1.0 (100%)
// Example: 0.5 (50%)
SampleRate float64

// LogMessage is the message to log when events exceed the limit length(1 000 000) (Optional)
// Default: ""
// Example: "langfuse event:"
LogMessage string

// MaskFunc is a function to mask sensitive data before sending (Optional)
// Default: nil
// Example: func(s string) string { return strings.ReplaceAll(s, "secret", "***") }
MaskFunc func(string) string

// MaxRetry is the maximum number of retry attempts for failed requests (Optional)
// Default: 3
// Example: 5
MaxRetry uint64

// Name is the trace name (Optional)
// Default: ""
// Example: "my-app-trace"
Name string

// UserID is the user identifier for the trace (Optional)
// Default: ""
// Example: "user-123"
UserID string

// SessionID is the session identifier for the trace (Optional)
// Default: ""
// Example: "session-456"
SessionID string
Release string
Tags []string
Public bool

// Release is the version or release identifier (Optional)
// Default: ""
// Example: "v1.2.3"
Release string

// Tags are labels attached to the trace (Optional)
// Default: nil
// Example: []string{"production", "feature-x"}
Tags []string

// Public determines if the trace is publicly accessible (Optional)
// Default: false
// Example: true
Public bool
}

func NewLangfuseHandler(cfg *Config) (handler callbacks.Handler, flusher func()) {

var langfuseOpts []langfuse.Option
if cfg.Threads > 0 {
langfuseOpts = append(langfuseOpts, langfuse.WithThreads(cfg.Threads))
70 changes: 0 additions & 70 deletions callbacks/langfuse/option.go

This file was deleted.

2 changes: 2 additions & 0 deletions devops/model/canvas.go
Original file line number Diff line number Diff line change
@@ -195,6 +195,8 @@ type ComponentSchema struct {
Config *ConfigSchema `json:"config,omitempty"`
ExtraProperty *ExtraPropertySchema `json:"extra_property,omitempty"`
IsIOTypeMutable bool `json:"is_io_type_mutable"`

Version string `json:"version"`
}

type ConfigSchema struct {