LangfuseConfig class
Langfuse 客户端配置。
字段语义对齐 Langfuse 官方 SDK:
- host 默认
https://cloud.langfuse.com,自托管时改成你的地址 - publicKey / secretKey 用于 HTTP Basic auth
- environment 透传到每个 trace/observation/score 的
environment字段(默认default),用来在 dashboard 上区分 dev / staging / prod - release / version 可选标识,方便在 langfuse 上做 A/B 对比
工厂方法 LangfuseConfig.fromEnv 从环境变量读取,方便 CI 接入。
Constructors
- LangfuseConfig({String host = 'https://cloud.langfuse.com', required String publicKey, required String secretKey, String environment = 'default', String? release, String? version, int flushAt = 50, Duration flushInterval = const Duration(seconds: 1), int maxRetries = 3, Duration requestTimeout = const Duration(seconds: 10)})
-
const
-
LangfuseConfig.fromEnv([Map<
String, String> ? env]) -
从环境变量读取:
factory
Properties
- environment → String
-
默认
default。Langfuse 服务端会校验匹配^[a-z0-9-_]{1,40}$。final - flushAt → int
-
批量发送阈值:达到这么多 event 就立刻 flush。默认 50,对齐
官方 SDK 的
flushAt。final - flushInterval → Duration
-
时间阈值:哪怕没攒够也最长等这么久就 flush。默认 1 秒,对齐
官方 SDK 的
flushInterval。final - hashCode → int
-
The hash code for this object.
no setterinherited
- host → String
-
形如
https://cloud.langfuse.com或https://langfuse.your-domain.com。 末尾不需要带/api/public/ingestion。final - ingestionUrl → String
-
no setter
- maxRetries → int
-
单次 HTTP 失败的最大重试次数(指数退避)。默认 3。
final
- publicKey → String
-
final
- release → String?
-
final
- requestTimeout → Duration
-
单次请求超时。默认 10 秒。
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- secretKey → String
-
final
- version → String?
-
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited