: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(aio): enable multimodal for PostHog Desktop (#74135)
Carlos Marchal9d7f07d94ec5
diff --git a/services/llm-gateway/pyproject.toml b/services/llm-gateway/pyproject.tomlindex 01bea7a4f7a9..8d0208aacf56 100644--- a/services/llm-gateway/pyproject.toml+++ b/services/llm-gateway/pyproject.toml@@ -21,7 +21,7 @@ dependencies = ["prometheus-fastapi-instrumentator>=7.0.0","structlog>=24.4.0","httpx>=0.28.0",- "posthoganalytics>=3.0.0",+ "posthoganalytics>=7.30.1","cachetools>=5.5.0","python-multipart>=0.0.9","boto3>=1.42.65",@@ -110,3 +110,4 @@ warn_unused_ignores = true[tool.uv]managed = trueexclude-newer = "7 days"+exclude-newer-package = { posthoganalytics = false }diff --git a/services/llm-gateway/src/llm_gateway/callbacks/posthog.py b/services/llm-gateway/src/llm_gateway/callbacks/posthog.pyindex ed5c46eca2cd..94f2b66e592a 100644--- a/services/llm-gateway/src/llm_gateway/callbacks/posthog.py+++ b/services/llm-gateway/src/llm_gateway/callbacks/posthog.py@@ -7,6 +7,7 @@ from uuid import UUID, uuid4, uuid5import structlogfrom posthoganalytics import Posthog+from posthoganalytics.ai.utils import _capture_ai_eventfrom llm_gateway.auth.models import resolve_distinct_idfrom llm_gateway.callbacks.base import InstrumentedCallback@@ -419,9 +420,11 @@ class PostHogCallback(InstrumentedCallback):host=host,sync_mode=True,enable_local_evaluation=False,+ _use_ai_lane=True,+ _enable_multimodal_capture=True,)try:- client.capture(**capture_kwargs)+ _capture_ai_event(client, **capture_kwargs)except Exception as e:client.capture_exception(e, **capture_kwargs)logger.exception("posthog_capture_failed", host=host, error=str(e))diff --git a/services/llm-gateway/tests/callbacks/test_posthog.py b/services/llm-gateway/tests/callbacks/test_posthog.pyindex ecc4a3cc906d..27fc2ef7f193 100644--- a/services/llm-gateway/tests/callbacks/test_posthog.py+++ b/services/llm-gateway/tests/callbacks/test_posthog.py@@ -90,7 +90,12 @@ class TestPostHogCallback:await callback._on_success(kwargs, None, 0.0, 1.0, end_user_id=None)mock_cls.assert_called_once_with(- "test-key", host="https://test.posthog.com", sync_mode=True, enable_local_evaluation=False+ "test-key",+ host="https://test.posthog.com",+ sync_mode=True,+ enable_local_evaluation=False,+ _use_ai_lane=True,+ _enable_multimodal_capture=True,)mock_client.capture.assert_called_once()call_kwargs = mock_client.capture.call_args.kwargsdiff --git a/services/llm-gateway/uv.lock b/services/llm-gateway/uv.lockindex d4e70cb0be0c..0a4c2395c6e7 100644--- a/services/llm-gateway/uv.lock+++ b/services/llm-gateway/uv.lock@@ -6,6 +6,9 @@ requires-python = ">=3.13"exclude-newer = "0001-01-01T00:00:00Z" # This has no effect and is included for backwards compatibility when using relative exclude-newer values.exclude-newer-span = "P7D"+[options.exclude-newer-package]+posthoganalytics = false+[[package]]name = "aiohappyeyeballs"version = "2.6.1"@@ -908,7 +911,7 @@ requires-dist = [{ name = "httpx", specifier = ">=0.28.0" },{ name = "litellm", specifier = "==1.92.0" },{ name = "orjson", specifier = ">=3.10.0" },- { name = "posthoganalytics", specifier = ">=3.0.0" },+ { name = "posthoganalytics", specifier = ">=7.30.1" },{ name = "prometheus-client", specifier = ">=0.21.0" },{ name = "prometheus-fastapi-instrumentator", specifier = ">=7.0.0" },{ name = "pydantic", specifier = ">=2.5.0" },@@ -1190,19 +1193,17 @@ wheels = [[[package]]name = "posthoganalytics"-version = "7.4.2"+version = "7.30.1"source = { registry = "https://pypi.org/simple" }dependencies = [{ name = "backoff" },{ name = "distro" },- { name = "python-dateutil" },{ name = "requests" },- { name = "six" },{ name = "typing-extensions" },]-sdist = { url = "https://files.pythonhosted.org/packages/d0/5c/22671e2ec3e2dbf0d1c5f03266306df8c858a37993f670626e075066581c/posthoganalytics-7.4.2.tar.gz", hash = "sha256:4ca71ab40d89331552be1627e923343e8bc78b82e321c594986a83db8663ca76", size = 144644, upload-time = "2025-12-22T11:03:19.25Z" }+sdist = { url = "https://files.pythonhosted.org/packages/ad/c5/01c59158b02c5d645bb3e351b82fc948174c05a1cd0cb21162f4d88fa28f/posthoganalytics-7.30.1.tar.gz", hash = "sha256:17ebed83ba253d5f92baba153b720642a00fdf6fee8bda95957c054c4ea98145", size = 386791, upload-time = "2026-07-27T14:19:39.927Z" }wheels = [- { url = "https://files.pythonhosted.org/packages/48/19/b6e727b2a641d8e35c79bedb39c5fcfb0300711f6a5276c6c13a4efa7b85/posthoganalytics-7.4.2-py3-none-any.whl", hash = "sha256:5d909624e81dfbd9bfb72d0af34758c2542da76cfb56eed0b2e36038d67a9247", size = 167902, upload-time = "2025-12-22T11:03:17.91Z" },+ { url = "https://files.pythonhosted.org/packages/78/f3/a424e140dde29f3737ecd09d3f97d98a1888c05cf18cb918c9191e8f36e1/posthoganalytics-7.30.1-py3-none-any.whl", hash = "sha256:5a3517d204aebfd02c9af8e010c093f2461bce88ea1299b8cdc9419e3405112b", size = 462838, upload-time = "2026-07-27T14:19:38.143Z" },][[package]]