Callback - Langfuse

Eino 基于 graph callback 能力封装了 langfuse 的 trace 能力(参见 https://langfuse.com/docs/get-started),使用示例如下:

package main

import (
    "github.com/cloudwego/eino-ext/callbacks/langfuse"
    "github.com/cloudwego/eino/callbacks"
)

func main() {
    cbh, flusher := NewLangfuseHandler(&_Config_{
        Host: "https://cloud.langfuse.com",
        PublicKey: "pk-xxx",
        SecretKey: "sk-xxx",
    })
    
    **callbacks**.InitCallbackHandlers([]**callbacks**._Handler_{cbh}) // 设置langfuse为全局callback
    
    g := NewGraph[string,string]()
    /*
    * compose and run graph
    */
    
    flusher() // 等待所有trace上报完成后退出
}

可以在 Langfuse project 中查看 trace:


最后修改 January 22, 2025 : docs: update eino doc (#1215) (805b4b6)