Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(replay-vision): report every gemini call to llm analytics in privacy mode (#101862)

Tue Haulunda2de5be9a80a
diff --git a/products/replay_vision/backend/feedback_themes.py b/products/replay_vision/backend/feedback_themes.py
index df6c4ef74e99..4dae06dec6c1 100644
--- a/products/replay_vision/backend/feedback_themes.py
+++ b/products/replay_vision/backend/feedback_themes.py
@@ -97,6 +97,8 @@ def _summarize(*, comments: list[str], team_id: int, distinct_id: str) -> _LlmFe
# Runs inline in a web worker during suggestion generation, so a hung provider call must time out.
client = genai.Client(
api_key=api_key,
+ # Privacy mode keeps customer content out of the internal project, where it could not be deleted on request.
+ posthog_privacy_mode=True,
posthog_client=posthoganalytics.default_client,
http_options={"timeout": _MODEL_CALL_TIMEOUT_MS},
)
diff --git a/products/replay_vision/backend/prompt_suggestions.py b/products/replay_vision/backend/prompt_suggestions.py
index 19a9013605e4..6cddc91afdad 100644
--- a/products/replay_vision/backend/prompt_suggestions.py
+++ b/products/replay_vision/backend/prompt_suggestions.py
@@ -235,6 +235,8 @@ def _gemini_client() -> GeminiClient:
try:
return genai.Client(
api_key=settings.REPLAY_VISION_GEMINI_API_KEY or settings.GEMINI_API_KEY,
+ # Privacy mode keeps customer content out of the internal project, where it could not be deleted on request.
+ posthog_privacy_mode=True,
posthog_client=posthoganalytics.default_client,
http_options={"timeout": _MODEL_CALL_TIMEOUT_MS},
)
diff --git a/products/replay_vision/backend/scanner_draft.py b/products/replay_vision/backend/scanner_draft.py
index 7214abedcdc2..171d4db87f65 100644
--- a/products/replay_vision/backend/scanner_draft.py
+++ b/products/replay_vision/backend/scanner_draft.py
@@ -584,6 +584,8 @@ def _generate(
try:
client = genai.Client(
api_key=api_key,
+ # Privacy mode keeps customer content out of the internal project, where it could not be deleted on request.
+ posthog_privacy_mode=True,
posthog_client=posthoganalytics.default_client,
http_options={"timeout": _MODEL_CALL_TIMEOUT_MS},
)
diff --git a/products/replay_vision/backend/search_suggestions.py b/products/replay_vision/backend/search_suggestions.py
index 0b90440a9188..99ea83752a6c 100644
--- a/products/replay_vision/backend/search_suggestions.py
+++ b/products/replay_vision/backend/search_suggestions.py
@@ -220,6 +220,8 @@ def _generate(*, user_content: str, team_id: int, distinct_id: str) -> _LlmQueri
try:
client = genai.Client(
api_key=api_key,
+ # Privacy mode keeps customer content out of the internal project, where it could not be deleted on request.
+ posthog_privacy_mode=True,
posthog_client=posthoganalytics.default_client,
http_options={"timeout": _MODEL_CALL_TIMEOUT_MS},
)
diff --git a/products/replay_vision/backend/tag_suggestions.py b/products/replay_vision/backend/tag_suggestions.py
index 640ad31204e6..9ce2f32c4927 100644
--- a/products/replay_vision/backend/tag_suggestions.py
+++ b/products/replay_vision/backend/tag_suggestions.py
@@ -311,6 +311,8 @@ def _generate(*, user_content: str, team_id: int, distinct_id: str) -> _LlmSugge
try:
client = genai.Client(
api_key=api_key,
+ # Privacy mode keeps customer content out of the internal project, where it could not be deleted on request.
+ posthog_privacy_mode=True,
posthog_client=posthoganalytics.default_client,
http_options={"timeout": _MODEL_CALL_TIMEOUT_MS},
)