The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix posthog.py
Ishaan Jaffer2a0088261aff
diff --git a/litellm/integrations/posthog.py b/litellm/integrations/posthog.pyindex dfa180642c8..c609d30ccff 100644--- a/litellm/integrations/posthog.py+++ b/litellm/integrations/posthog.py@@ -11,11 +11,10 @@ For batching specific details see CustomBatchLogger classimport asyncioimport os-from litellm._uuid import uuid-from typing import Any, Dict, Optional-+from typing import Any, Dict, Optional, Tuplefrom litellm._logging import verbose_logger+from litellm._uuid import uuidfrom litellm.integrations.custom_batch_logger import CustomBatchLoggerfrom litellm.llms.custom_httpx.http_handler import (_get_httpx_client,@@ -74,6 +73,8 @@ class PostHogLogger(CustomBatchLogger):)api_key, api_url = self._get_credentials_for_request(kwargs)+ if api_key is None or api_url is None:+ raise Exception("PostHog credentials not found in kwargs")event_payload = self.create_posthog_event_payload(kwargs)headers = {@@ -275,7 +276,7 @@ class PostHogLogger(CustomBatchLogger):return self._safe_uuid()- def _get_credentials_for_request(self, kwargs: Dict[str, Any]) -> tuple[str, str]:+ def _get_credentials_for_request(self, kwargs: Dict[str, Any]) -> Tuple[Optional[str], Optional[str]]:"""Get PostHog credentials for this request.