diff --git a/content/en/docs/eino/ecosystem/callbacks/callback_langfuse.md b/content/en/docs/eino/ecosystem/callbacks/callback_langfuse.md index 8a35a71397c..a7e7e503081 100644 --- a/content/en/docs/eino/ecosystem/callbacks/callback_langfuse.md +++ b/content/en/docs/eino/ecosystem/callbacks/callback_langfuse.md @@ -20,11 +20,12 @@ import ( ) func main() { - cbh, flusher := NewLangfuseHandler(&_Config_{ + cbh, flusher := langfuse.NewLangfuseHandler(&langfuse.Config{ Host: "https://cloud.langfuse.com", PublicKey: "pk-xxx", SecretKey: "sk-xxx", }) + defer flusher() // Exit after all trace reporting is complete callbacks.AppendGlobalHandlers(cbh) // Set langfuse as a global callback @@ -32,8 +33,6 @@ func main() { /* * compose and run graph */ - - flusher() // Exit after all trace reporting is complete } ``` diff --git a/content/zh/docs/eino/ecosystem_integration/callbacks/callback_langfuse.md b/content/zh/docs/eino/ecosystem_integration/callbacks/callback_langfuse.md index 4032739ce46..283cb0abc52 100644 --- a/content/zh/docs/eino/ecosystem_integration/callbacks/callback_langfuse.md +++ b/content/zh/docs/eino/ecosystem_integration/callbacks/callback_langfuse.md @@ -18,20 +18,19 @@ import ( ) func main() { - cbh, flusher := NewLangfuseHandler(&_Config_{ + cbh, flusher := langfuse.NewLangfuseHandler(&langfuse.Config{ Host: "https://cloud.langfuse.com", PublicKey: "pk-xxx", SecretKey: "sk-xxx", }) - + defer flusher() // 等待所有trace上报完成后退出 + callbacks.AppendGlobalHandlers(cbh) // 设置langfuse为全局callback g := NewGraph[string,string]() /* * compose and run graph */ - - flusher() // 等待所有trace上报完成后退出 } ```