Patch changes
- Updated dependencies: posthog@7.75.11
npx @buildinternet/releases get posthog-pythonWith privacy mode on, $ai_error no longer carries exception messages; it sends only a summary of structured fields like class name, HTTP status, provider error code, param and request ID across the OpenAI, Anthropic, Gemini, LangChain and OpenAI Agents wrappers. MCP tool headers and authorization are now always redacted, a per-call posthog_privacy_mode=False no longer overrides client-level privacy mode for Gemini, and PostHogSpanProcessor and PostHogTraceExporter accept and honor privacy_mode.
Failed Gemini calls are now captured with the error's HTTP status as $ai_http_status (for example 429 or 503) instead of 0, since google-genai errors carry the status as code rather than status_code that the OpenAI and Anthropic wrappers already read.
MCP analytics now sends one $mcp_initialize for every initialize request a client sends, instead of once per session or per process, and attaches the handshake request as $mcp_parameters plus the server reply as $mcp_response on MCP SDK 2.x. The Claude Agent SDK integration now takes cumulative input and cache token counts from the final message_delta usage and sets $ai_web_search_count from server_tool_use.web_search_requests, fixing under-reported input tokens and cache writes in streamed generations.
Feature flag regex patterns with unsupported syntax or incompatible matching semantics now fall back to server evaluation instead of producing incorrect local results. Portable Unicode matching is preserved and end-of-input anchors are now strict, matching the flags service.
Streamed OpenAI-compatible chat completions whose tool call deltas carry no index are no longer dropped from $ai_output; a delta with a new id starts a call, and one without an id continues the latest call.
evaluate_flags() now retains the minimal-event gate and experiment metadata from its local flag definitions, including first-use loading and definition refreshes during evaluation.
Annotated timeout and feature_flags_request_timeout_seconds as float on Client, AsyncClient, Consumer, and the request helpers, so type checkers accept fractional values like timeout=2.5. Runtime behavior is unchanged.
Streamed Anthropic generations no longer stack output tokens when a stream emits more than one message_delta; since each delta's usage is cumulative, the accumulator now keeps the latest total instead of adding every delta together.
Streamed OpenAI, Anthropic, and Gemini generations that raise mid-stream are now captured with $ai_is_error and $ai_error plus the error's status code as $ai_http_status instead of being recorded as a successful 200, and the error is still re-raised to the caller. The LangChain callback handler now records $ai_http_status as an integer for failed generations, and non-streamed OpenAI chats that the model refused now record the refusal text as a refusal content block.
Wrapped chat completion create() calls now capture responses containing custom tool calls instead of raising AttributeError.