pub struct ObservableChatClient<C>where
C: ChatClient,{ /* private fields */ }Expand description
A ChatClient decorator that emits a chat span per request following the
OpenTelemetry GenAI semantic conventions.
Message-content capture (gen_ai.input.messages / gen_ai.output.messages,
plus gen_ai.system_instructions / gen_ai.tool.definitions) is off by
default; enable it with ObservableChatClient::with_content_capture,
mirroring Python’s enable_sensitive_data flag — or construct via
ObservableChatClient::from_env to read that flag from
ENABLE_SENSITIVE_DATA.
Implementations§
Source§impl<C> ObservableChatClient<C>where
C: ChatClient,
impl<C> ObservableChatClient<C>where
C: ChatClient,
Sourcepub fn new(inner: C, system: impl Into<String>) -> ObservableChatClient<C>
pub fn new(inner: C, system: impl Into<String>) -> ObservableChatClient<C>
Wrap inner, tagging spans with the given provider/system name (the
gen_ai.system / gen_ai.provider.name attributes), e.g. "openai"
or "anthropic".
Sourcepub fn from_env(inner: C, system: impl Into<String>) -> ObservableChatClient<C>
pub fn from_env(inner: C, system: impl Into<String>) -> ObservableChatClient<C>
Wrap inner using ObservabilityConfig::from_env to decide whether
content capture is enabled (ENABLE_SENSITIVE_DATA). Equivalent to:
ObservableChatClient::new(inner, system)
.with_content_capture(ObservabilityConfig::from_env().enable_sensitive_data)Sourcepub fn with_content_capture(self, capture: bool) -> ObservableChatClient<C>
pub fn with_content_capture(self, capture: bool) -> ObservableChatClient<C>
Enable or disable capturing message content on spans (default: off).