diff --git a/.github/scripts/check_public_api.py b/.github/scripts/check_public_api.py new file mode 100644 index 00000000..7b276890 --- /dev/null +++ b/.github/scripts/check_public_api.py @@ -0,0 +1,268 @@ +#!/usr/bin/env python3 +"""Generate and check the Python SDK public API snapshot.""" + +from __future__ import annotations + +import argparse +import difflib +import sys +from pathlib import Path +from typing import Iterable + +try: + import griffe +except ImportError: # pragma: no cover - exercised only when dependencies are missing. + print("griffe is required; install dev dependencies first.", file=sys.stderr) + raise + +ROOT = Path(__file__).resolve().parents[2] +SNAPSHOT_PATH = ROOT / "references" / "public_api_snapshot.txt" +PUBLIC_SPECIAL_NAMES = {"__version__"} +EXCLUDED_MODULE_PREFIXES = ("posthog.test",) + +HEADER = """# This file is generated by .github/scripts/check_public_api.py. +# Run `make public_api_snapshot` after an intentional public API change. +# Public API scope: public posthog modules (excluding tests) and their exported +# members. Modules with __all__ use it; other modules include non-underscore +# names. External imports are excluded. +""" + + +def _path_parts(path: str) -> list[str]: + return path.split(".") + + +def _is_excluded_path(path: str) -> bool: + return any( + path == prefix or path.startswith(f"{prefix}.") + for prefix in EXCLUDED_MODULE_PREFIXES + ) + + +def _is_public_name(name: str) -> bool: + return not name.startswith("_") or name in PUBLIC_SPECIAL_NAMES + + +def _is_public_posthog_path(path: str) -> bool: + if not (path == "posthog" or path.startswith("posthog.")): + return False + if _is_excluded_path(path): + return False + return all(_is_public_name(part) for part in _path_parts(path)[1:]) + + +def _object_path(obj: object) -> str: + return str(getattr(obj, "path", "")) + + +def _alias_target_path(obj: object) -> str: + return str(getattr(obj, "target_path", "")) + + +def _is_public_alias(obj: object) -> bool: + target_path = _alias_target_path(obj) + return _is_public_posthog_path(target_path) + + +def _module_exports(module: object) -> set[str] | None: + exports = getattr(module, "exports", None) + if exports is None: + return None + return {str(name) for name in exports} + + +def _is_module(obj: object) -> bool: + return bool(getattr(obj, "is_module", False)) + + +def _is_class(obj: object) -> bool: + return bool(getattr(obj, "is_class", False)) + + +def _is_function(obj: object) -> bool: + return bool(getattr(obj, "is_function", False)) + + +def _is_attribute(obj: object) -> bool: + return bool(getattr(obj, "is_attribute", False)) + + +def _is_alias(obj: object) -> bool: + return bool(getattr(obj, "is_alias", False)) + + +def _is_public_member(parent: object, name: str, member: object) -> bool: + if name == "__all__": + return False + + exports = _module_exports(parent) + if exports is not None: + if name not in exports: + return False + elif not _is_public_name(name): + return False + + if _is_alias(member): + return _is_public_alias(member) + + if _is_module(member): + return _is_public_posthog_path(_object_path(member)) + + return True + + +def _signature(obj: object) -> str | None: + signature = getattr(obj, "signature", None) + if signature is None: + return None + + try: + return str(signature()) + except Exception: # noqa: BLE001 - keep snapshot generation best-effort. + return None + + +def _signature_for_path(obj: object) -> str | None: + signature = _signature(obj) + if signature is None: + return None + + name = str(getattr(obj, "name", "")) + if name and signature.startswith(name): + return f"{_object_path(obj)}{signature[len(name) :]}" + return f"{_object_path(obj)} {signature}" + + +def _attribute_details(obj: object) -> str: + parts = [_object_path(obj)] + + annotation = getattr(obj, "annotation", None) + if annotation is not None: + parts.append(f": {annotation}") + + value = getattr(obj, "value", None) + if value is not None: + parts.append(f" = {value}") + + return "".join(parts) + + +def _record(obj: object) -> str: + if _is_alias(obj): + return f"alias {_object_path(obj)} -> {_alias_target_path(obj)}" + + if _is_module(obj): + return f"module {_object_path(obj)}" + + if _is_class(obj): + signature = _signature_for_path(obj) + if signature is not None: + return f"class {signature}" + return f"class {_object_path(obj)}" + + if _is_function(obj): + signature = _signature_for_path(obj) + prefix = "method" if _is_class(getattr(obj, "parent", None)) else "function" + if signature is not None: + return f"{prefix} {signature}" + return f"{prefix} {_object_path(obj)}" + + if _is_attribute(obj): + return f"attribute {_attribute_details(obj)}" + + return f"{getattr(obj, 'kind', 'object')} {_object_path(obj)}" + + +def _iter_class_members(cls: object) -> Iterable[object]: + members = getattr(cls, "members", {}) + for name, member in sorted(members.items()): + if not _is_public_member(cls, str(name), member): + continue + + yield member + if not _is_alias(member) and _is_class(member): + yield from _iter_class_members(member) + + +def _iter_module_members(module: object) -> Iterable[object]: + yield module + + members = getattr(module, "members", {}) + for name, member in sorted(members.items()): + if _is_alias(member): + if _is_public_member(module, str(name), member): + yield member + continue + + if _is_module(member): + if _is_public_posthog_path(_object_path(member)): + yield from _iter_module_members(member) + continue + + if not _is_public_member(module, str(name), member): + continue + + yield member + if _is_class(member): + yield from _iter_class_members(member) + + +def generate_snapshot() -> str: + package = griffe.load( + "posthog", + allow_inspection=False, + search_paths=[ROOT], + submodules=True, + ) + records = sorted(_record(obj) for obj in _iter_module_members(package)) + return HEADER + "\n".join(records) + "\n" + + +def check_snapshot(snapshot: str) -> int: + try: + existing = SNAPSHOT_PATH.read_text() + except FileNotFoundError: + print( + f"Missing public API snapshot: {SNAPSHOT_PATH.relative_to(ROOT)}", + file=sys.stderr, + ) + return 1 + + if existing == snapshot: + print("Public API snapshot is up to date.") + return 0 + + diff = difflib.unified_diff( + existing.splitlines(keepends=True), + snapshot.splitlines(keepends=True), + fromfile=str(SNAPSHOT_PATH.relative_to(ROOT)), + tofile="generated public API", + ) + print( + "Public API snapshot is out of date. Run `make public_api_snapshot`.", + file=sys.stderr, + ) + print("".join(diff), file=sys.stderr) + return 1 + + +def main() -> int: + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument( + "--write", + action="store_true", + help="write the generated public API snapshot (default: check)", + ) + args = parser.parse_args() + + snapshot = generate_snapshot() + if args.write: + SNAPSHOT_PATH.write_text(snapshot) + print(f"Wrote {SNAPSHOT_PATH.relative_to(ROOT)}") + return 0 + + return check_snapshot(snapshot) + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c0cf09bc..5fccec51 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -62,6 +62,20 @@ jobs: run: | mypy --no-site-packages --config-file mypy.ini . | mypy-baseline filter + public-api: + name: Public API snapshot + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@85e6279cec87321a52edac9c87bce653a07cf6c2 + + - name: Set up Python dev environment + uses: ./.github/actions/setup-python-dev + + - name: Check public API snapshot + run: | + make public_api_check + package-build: name: Package build runs-on: ubuntu-latest diff --git a/Makefile b/Makefile index 51fc5a71..53cc8bb0 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,12 @@ test: coverage run -m pytest coverage report +public_api_snapshot: + python .github/scripts/check_public_api.py --write + +public_api_check: + python .github/scripts/check_public_api.py + build_release: rm -rf dist/* python setup.py sdist bdist_wheel @@ -67,4 +73,4 @@ prep_local: @echo "Local copy created at ../posthog-python-local" @echo "Install with: pip install -e ../posthog-python-local" -.PHONY: test lint build_release build_release_analytics e2e_test prep_local +.PHONY: test lint public_api_snapshot public_api_check build_release build_release_analytics e2e_test prep_local diff --git a/pyproject.toml b/pyproject.toml index 2a46eba0..5775b899 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,6 +42,7 @@ otel = [ ] dev = [ "django-stubs", + "griffe", "lxml", "mypy", "mypy-baseline", diff --git a/references/public_api_snapshot.txt b/references/public_api_snapshot.txt new file mode 100644 index 00000000..cab2d743 --- /dev/null +++ b/references/public_api_snapshot.txt @@ -0,0 +1,1193 @@ +# This file is generated by .github/scripts/check_public_api.py. +# Run `make public_api_snapshot` after an intentional public API change. +# Public API scope: public posthog modules (excluding tests) and their exported +# members. Modules with __all__ use it; other modules include non-underscore +# names. External imports are excluded. +alias posthog.BeforeSendCallback -> posthog.types.BeforeSendCallback +alias posthog.Client -> posthog.client.Client +alias posthog.DEFAULT_CODE_VARIABLES_IGNORE_PATTERNS -> posthog.exception_utils.DEFAULT_CODE_VARIABLES_IGNORE_PATTERNS +alias posthog.DEFAULT_CODE_VARIABLES_MASK_PATTERNS -> posthog.exception_utils.DEFAULT_CODE_VARIABLES_MASK_PATTERNS +alias posthog.ExceptionArg -> posthog.args.ExceptionArg +alias posthog.ExceptionCapture -> posthog.exception_capture.ExceptionCapture +alias posthog.FeatureFlag -> posthog.types.FeatureFlag +alias posthog.FeatureFlagEvaluations -> posthog.feature_flag_evaluations.FeatureFlagEvaluations +alias posthog.FeatureFlagResult -> posthog.types.FeatureFlagResult +alias posthog.FlagDefinitionCacheData -> posthog.flag_definition_cache.FlagDefinitionCacheData +alias posthog.FlagDefinitionCacheProvider -> posthog.flag_definition_cache.FlagDefinitionCacheProvider +alias posthog.FlagsAndPayloads -> posthog.types.FlagsAndPayloads +alias posthog.InconclusiveMatchError -> posthog.feature_flags.InconclusiveMatchError +alias posthog.OptionalCaptureArgs -> posthog.args.OptionalCaptureArgs +alias posthog.OptionalSetArgs -> posthog.args.OptionalSetArgs +alias posthog.RequiresServerEvaluation -> posthog.feature_flags.RequiresServerEvaluation +alias posthog.SocketOptions -> posthog.request.SocketOptions +alias posthog.VERSION -> posthog.version.VERSION +alias posthog.ai.PromptResult -> posthog.ai.prompts.PromptResult +alias posthog.ai.PromptSource -> posthog.ai.prompts.PromptSource +alias posthog.ai.Prompts -> posthog.ai.prompts.Prompts +alias posthog.ai.anthropic.Anthropic -> posthog.ai.anthropic.anthropic.Anthropic +alias posthog.ai.anthropic.AnthropicBedrock -> posthog.ai.anthropic.anthropic_providers.AnthropicBedrock +alias posthog.ai.anthropic.AnthropicVertex -> posthog.ai.anthropic.anthropic_providers.AnthropicVertex +alias posthog.ai.anthropic.AsyncAnthropic -> posthog.ai.anthropic.anthropic_async.AsyncAnthropic +alias posthog.ai.anthropic.AsyncAnthropicBedrock -> posthog.ai.anthropic.anthropic_providers.AsyncAnthropicBedrock +alias posthog.ai.anthropic.AsyncAnthropicVertex -> posthog.ai.anthropic.anthropic_providers.AsyncAnthropicVertex +alias posthog.ai.anthropic.anthropic.PostHogClient -> posthog.client.Client +alias posthog.ai.anthropic.anthropic.StreamingContentBlock -> posthog.ai.types.StreamingContentBlock +alias posthog.ai.anthropic.anthropic.TokenUsage -> posthog.ai.types.TokenUsage +alias posthog.ai.anthropic.anthropic.ToolInProgress -> posthog.ai.types.ToolInProgress +alias posthog.ai.anthropic.anthropic.call_llm_and_track_usage -> posthog.ai.utils.call_llm_and_track_usage +alias posthog.ai.anthropic.anthropic.extract_anthropic_usage_from_event -> posthog.ai.anthropic.anthropic_converter.extract_anthropic_usage_from_event +alias posthog.ai.anthropic.anthropic.finalize_anthropic_tool_input -> posthog.ai.anthropic.anthropic_converter.finalize_anthropic_tool_input +alias posthog.ai.anthropic.anthropic.handle_anthropic_content_block_start -> posthog.ai.anthropic.anthropic_converter.handle_anthropic_content_block_start +alias posthog.ai.anthropic.anthropic.handle_anthropic_text_delta -> posthog.ai.anthropic.anthropic_converter.handle_anthropic_text_delta +alias posthog.ai.anthropic.anthropic.handle_anthropic_tool_delta -> posthog.ai.anthropic.anthropic_converter.handle_anthropic_tool_delta +alias posthog.ai.anthropic.anthropic.merge_usage_stats -> posthog.ai.utils.merge_usage_stats +alias posthog.ai.anthropic.anthropic.sanitize_anthropic -> posthog.ai.sanitization.sanitize_anthropic +alias posthog.ai.anthropic.anthropic.setup -> posthog.setup +alias posthog.ai.anthropic.anthropic_async.AsyncStreamWrapper -> posthog.ai.stream.AsyncStreamWrapper +alias posthog.ai.anthropic.anthropic_async.PostHogClient -> posthog.client.Client +alias posthog.ai.anthropic.anthropic_async.StreamingContentBlock -> posthog.ai.types.StreamingContentBlock +alias posthog.ai.anthropic.anthropic_async.TokenUsage -> posthog.ai.types.TokenUsage +alias posthog.ai.anthropic.anthropic_async.ToolInProgress -> posthog.ai.types.ToolInProgress +alias posthog.ai.anthropic.anthropic_async.call_llm_and_track_usage_async -> posthog.ai.utils.call_llm_and_track_usage_async +alias posthog.ai.anthropic.anthropic_async.extract_anthropic_usage_from_event -> posthog.ai.anthropic.anthropic_converter.extract_anthropic_usage_from_event +alias posthog.ai.anthropic.anthropic_async.finalize_anthropic_tool_input -> posthog.ai.anthropic.anthropic_converter.finalize_anthropic_tool_input +alias posthog.ai.anthropic.anthropic_async.handle_anthropic_content_block_start -> posthog.ai.anthropic.anthropic_converter.handle_anthropic_content_block_start +alias posthog.ai.anthropic.anthropic_async.handle_anthropic_text_delta -> posthog.ai.anthropic.anthropic_converter.handle_anthropic_text_delta +alias posthog.ai.anthropic.anthropic_async.handle_anthropic_tool_delta -> posthog.ai.anthropic.anthropic_converter.handle_anthropic_tool_delta +alias posthog.ai.anthropic.anthropic_async.merge_usage_stats -> posthog.ai.utils.merge_usage_stats +alias posthog.ai.anthropic.anthropic_async.sanitize_anthropic -> posthog.ai.sanitization.sanitize_anthropic +alias posthog.ai.anthropic.anthropic_async.setup -> posthog.setup +alias posthog.ai.anthropic.anthropic_converter.FormattedContentItem -> posthog.ai.types.FormattedContentItem +alias posthog.ai.anthropic.anthropic_converter.FormattedFunctionCall -> posthog.ai.types.FormattedFunctionCall +alias posthog.ai.anthropic.anthropic_converter.FormattedMessage -> posthog.ai.types.FormattedMessage +alias posthog.ai.anthropic.anthropic_converter.FormattedTextContent -> posthog.ai.types.FormattedTextContent +alias posthog.ai.anthropic.anthropic_converter.StreamingContentBlock -> posthog.ai.types.StreamingContentBlock +alias posthog.ai.anthropic.anthropic_converter.TokenUsage -> posthog.ai.types.TokenUsage +alias posthog.ai.anthropic.anthropic_converter.ToolInProgress -> posthog.ai.types.ToolInProgress +alias posthog.ai.anthropic.anthropic_converter.serialize_raw_usage -> posthog.ai.utils.serialize_raw_usage +alias posthog.ai.anthropic.anthropic_providers.AsyncWrappedMessages -> posthog.ai.anthropic.anthropic_async.AsyncWrappedMessages +alias posthog.ai.anthropic.anthropic_providers.PostHogClient -> posthog.client.Client +alias posthog.ai.anthropic.anthropic_providers.WrappedMessages -> posthog.ai.anthropic.anthropic.WrappedMessages +alias posthog.ai.anthropic.anthropic_providers.setup -> posthog.setup +alias posthog.ai.anthropic.extract_anthropic_tools -> posthog.ai.anthropic.anthropic_converter.extract_anthropic_tools +alias posthog.ai.anthropic.format_anthropic_input -> posthog.ai.anthropic.anthropic_converter.format_anthropic_input +alias posthog.ai.anthropic.format_anthropic_response -> posthog.ai.anthropic.anthropic_converter.format_anthropic_response +alias posthog.ai.anthropic.format_anthropic_streaming_content -> posthog.ai.anthropic.anthropic_converter.format_anthropic_streaming_content +alias posthog.ai.claude_agent_sdk.PostHogClaudeAgentProcessor -> posthog.ai.claude_agent_sdk.processor.PostHogClaudeAgentProcessor +alias posthog.ai.claude_agent_sdk.PostHogClaudeSDKClient -> posthog.ai.claude_agent_sdk.client.PostHogClaudeSDKClient +alias posthog.ai.claude_agent_sdk.client.Client -> posthog.client.Client +alias posthog.ai.claude_agent_sdk.client.PostHogClaudeAgentProcessor -> posthog.ai.claude_agent_sdk.processor.PostHogClaudeAgentProcessor +alias posthog.ai.claude_agent_sdk.processor.Client -> posthog.client.Client +alias posthog.ai.claude_agent_sdk.processor.setup -> posthog.setup +alias posthog.ai.gemini.AsyncClient -> posthog.ai.gemini.gemini_async.AsyncClient +alias posthog.ai.gemini.Client -> posthog.ai.gemini.gemini.Client +alias posthog.ai.gemini.extract_gemini_tools -> posthog.ai.gemini.gemini_converter.extract_gemini_tools +alias posthog.ai.gemini.format_gemini_input -> posthog.ai.gemini.gemini_converter.format_gemini_input +alias posthog.ai.gemini.format_gemini_response -> posthog.ai.gemini.gemini_converter.format_gemini_response +alias posthog.ai.gemini.gemini.PostHogClient -> posthog.client.Client +alias posthog.ai.gemini.gemini.StreamingEventData -> posthog.ai.types.StreamingEventData +alias posthog.ai.gemini.gemini.TokenUsage -> posthog.ai.types.TokenUsage +alias posthog.ai.gemini.gemini.call_llm_and_track_usage -> posthog.ai.utils.call_llm_and_track_usage +alias posthog.ai.gemini.gemini.capture_streaming_event -> posthog.ai.utils.capture_streaming_event +alias posthog.ai.gemini.gemini.extract_gemini_content_from_chunk -> posthog.ai.gemini.gemini_converter.extract_gemini_content_from_chunk +alias posthog.ai.gemini.gemini.extract_gemini_embedding_token_count -> posthog.ai.gemini.gemini_converter.extract_gemini_embedding_token_count +alias posthog.ai.gemini.gemini.extract_gemini_stop_reason_from_chunk -> posthog.ai.gemini.gemini_converter.extract_gemini_stop_reason_from_chunk +alias posthog.ai.gemini.gemini.extract_gemini_usage_from_chunk -> posthog.ai.gemini.gemini_converter.extract_gemini_usage_from_chunk +alias posthog.ai.gemini.gemini.format_gemini_streaming_output -> posthog.ai.gemini.gemini_converter.format_gemini_streaming_output +alias posthog.ai.gemini.gemini.merge_system_prompt -> posthog.ai.utils.merge_system_prompt +alias posthog.ai.gemini.gemini.merge_usage_stats -> posthog.ai.utils.merge_usage_stats +alias posthog.ai.gemini.gemini.sanitize_gemini -> posthog.ai.sanitization.sanitize_gemini +alias posthog.ai.gemini.gemini.setup -> posthog.setup +alias posthog.ai.gemini.gemini.with_privacy_mode -> posthog.ai.utils.with_privacy_mode +alias posthog.ai.gemini.gemini_async.AsyncStreamWrapper -> posthog.ai.stream.AsyncStreamWrapper +alias posthog.ai.gemini.gemini_async.PostHogClient -> posthog.client.Client +alias posthog.ai.gemini.gemini_async.StreamingEventData -> posthog.ai.types.StreamingEventData +alias posthog.ai.gemini.gemini_async.TokenUsage -> posthog.ai.types.TokenUsage +alias posthog.ai.gemini.gemini_async.call_llm_and_track_usage_async -> posthog.ai.utils.call_llm_and_track_usage_async +alias posthog.ai.gemini.gemini_async.capture_streaming_event -> posthog.ai.utils.capture_streaming_event +alias posthog.ai.gemini.gemini_async.extract_gemini_content_from_chunk -> posthog.ai.gemini.gemini_converter.extract_gemini_content_from_chunk +alias posthog.ai.gemini.gemini_async.extract_gemini_embedding_token_count -> posthog.ai.gemini.gemini_converter.extract_gemini_embedding_token_count +alias posthog.ai.gemini.gemini_async.extract_gemini_stop_reason_from_chunk -> posthog.ai.gemini.gemini_converter.extract_gemini_stop_reason_from_chunk +alias posthog.ai.gemini.gemini_async.extract_gemini_usage_from_chunk -> posthog.ai.gemini.gemini_converter.extract_gemini_usage_from_chunk +alias posthog.ai.gemini.gemini_async.format_gemini_streaming_output -> posthog.ai.gemini.gemini_converter.format_gemini_streaming_output +alias posthog.ai.gemini.gemini_async.merge_system_prompt -> posthog.ai.utils.merge_system_prompt +alias posthog.ai.gemini.gemini_async.merge_usage_stats -> posthog.ai.utils.merge_usage_stats +alias posthog.ai.gemini.gemini_async.sanitize_gemini -> posthog.ai.sanitization.sanitize_gemini +alias posthog.ai.gemini.gemini_async.setup -> posthog.setup +alias posthog.ai.gemini.gemini_async.with_privacy_mode -> posthog.ai.utils.with_privacy_mode +alias posthog.ai.gemini.gemini_converter.FormattedContentItem -> posthog.ai.types.FormattedContentItem +alias posthog.ai.gemini.gemini_converter.FormattedMessage -> posthog.ai.types.FormattedMessage +alias posthog.ai.gemini.gemini_converter.TokenUsage -> posthog.ai.types.TokenUsage +alias posthog.ai.gemini.gemini_converter.serialize_raw_usage -> posthog.ai.utils.serialize_raw_usage +alias posthog.ai.langchain.CallbackHandler -> posthog.ai.langchain.callbacks.CallbackHandler +alias posthog.ai.langchain.callbacks.Client -> posthog.client.Client +alias posthog.ai.langchain.callbacks.get_model_params -> posthog.ai.utils.get_model_params +alias posthog.ai.langchain.callbacks.sanitize_langchain -> posthog.ai.sanitization.sanitize_langchain +alias posthog.ai.langchain.callbacks.setup -> posthog.setup +alias posthog.ai.langchain.callbacks.warn_if_posthog_ai_gateway -> posthog.ai.gateway.warn_if_posthog_ai_gateway +alias posthog.ai.langchain.callbacks.with_privacy_mode -> posthog.ai.utils.with_privacy_mode +alias posthog.ai.openai.AsyncAzureOpenAI -> posthog.ai.openai.openai_providers.AsyncAzureOpenAI +alias posthog.ai.openai.AsyncOpenAI -> posthog.ai.openai.openai_async.AsyncOpenAI +alias posthog.ai.openai.AzureOpenAI -> posthog.ai.openai.openai_providers.AzureOpenAI +alias posthog.ai.openai.OpenAI -> posthog.ai.openai.openai.OpenAI +alias posthog.ai.openai.extract_openai_tools -> posthog.ai.openai.openai_converter.extract_openai_tools +alias posthog.ai.openai.format_openai_input -> posthog.ai.openai.openai_converter.format_openai_input +alias posthog.ai.openai.format_openai_response -> posthog.ai.openai.openai_converter.format_openai_response +alias posthog.ai.openai.format_openai_streaming_content -> posthog.ai.openai.openai_converter.format_openai_streaming_content +alias posthog.ai.openai.openai.PostHogClient -> posthog.client.Client +alias posthog.ai.openai.openai.TokenUsage -> posthog.ai.types.TokenUsage +alias posthog.ai.openai.openai.accumulate_openai_tool_calls -> posthog.ai.openai.openai_converter.accumulate_openai_tool_calls +alias posthog.ai.openai.openai.call_llm_and_track_usage -> posthog.ai.utils.call_llm_and_track_usage +alias posthog.ai.openai.openai.extract_available_tool_calls -> posthog.ai.utils.extract_available_tool_calls +alias posthog.ai.openai.openai.extract_openai_content_from_chunk -> posthog.ai.openai.openai_converter.extract_openai_content_from_chunk +alias posthog.ai.openai.openai.extract_openai_tool_calls_from_chunk -> posthog.ai.openai.openai_converter.extract_openai_tool_calls_from_chunk +alias posthog.ai.openai.openai.extract_openai_usage_from_chunk -> posthog.ai.openai.openai_converter.extract_openai_usage_from_chunk +alias posthog.ai.openai.openai.merge_usage_stats -> posthog.ai.utils.merge_usage_stats +alias posthog.ai.openai.openai.sanitize_openai -> posthog.ai.sanitization.sanitize_openai +alias posthog.ai.openai.openai.sanitize_openai_response -> posthog.ai.sanitization.sanitize_openai_response +alias posthog.ai.openai.openai.setup -> posthog.setup +alias posthog.ai.openai.openai.with_privacy_mode -> posthog.ai.utils.with_privacy_mode +alias posthog.ai.openai.openai_async.AsyncStreamWrapper -> posthog.ai.stream.AsyncStreamWrapper +alias posthog.ai.openai.openai_async.PostHogClient -> posthog.client.Client +alias posthog.ai.openai.openai_async.TokenUsage -> posthog.ai.types.TokenUsage +alias posthog.ai.openai.openai_async.accumulate_openai_tool_calls -> posthog.ai.openai.openai_converter.accumulate_openai_tool_calls +alias posthog.ai.openai.openai_async.call_llm_and_track_usage_async -> posthog.ai.utils.call_llm_and_track_usage_async +alias posthog.ai.openai.openai_async.extract_available_tool_calls -> posthog.ai.utils.extract_available_tool_calls +alias posthog.ai.openai.openai_async.extract_openai_content_from_chunk -> posthog.ai.openai.openai_converter.extract_openai_content_from_chunk +alias posthog.ai.openai.openai_async.extract_openai_tool_calls_from_chunk -> posthog.ai.openai.openai_converter.extract_openai_tool_calls_from_chunk +alias posthog.ai.openai.openai_async.extract_openai_usage_from_chunk -> posthog.ai.openai.openai_converter.extract_openai_usage_from_chunk +alias posthog.ai.openai.openai_async.format_openai_streaming_output -> posthog.ai.openai.openai_converter.format_openai_streaming_output +alias posthog.ai.openai.openai_async.get_model_params -> posthog.ai.utils.get_model_params +alias posthog.ai.openai.openai_async.merge_usage_stats -> posthog.ai.utils.merge_usage_stats +alias posthog.ai.openai.openai_async.sanitize_openai -> posthog.ai.sanitization.sanitize_openai +alias posthog.ai.openai.openai_async.sanitize_openai_response -> posthog.ai.sanitization.sanitize_openai_response +alias posthog.ai.openai.openai_async.setup -> posthog.setup +alias posthog.ai.openai.openai_async.with_privacy_mode -> posthog.ai.utils.with_privacy_mode +alias posthog.ai.openai.openai_converter.FormattedContentItem -> posthog.ai.types.FormattedContentItem +alias posthog.ai.openai.openai_converter.FormattedFunctionCall -> posthog.ai.types.FormattedFunctionCall +alias posthog.ai.openai.openai_converter.FormattedImageContent -> posthog.ai.types.FormattedImageContent +alias posthog.ai.openai.openai_converter.FormattedMessage -> posthog.ai.types.FormattedMessage +alias posthog.ai.openai.openai_converter.FormattedTextContent -> posthog.ai.types.FormattedTextContent +alias posthog.ai.openai.openai_converter.TokenUsage -> posthog.ai.types.TokenUsage +alias posthog.ai.openai.openai_converter.serialize_raw_usage -> posthog.ai.utils.serialize_raw_usage +alias posthog.ai.openai.openai_providers.AsyncWrappedBeta -> posthog.ai.openai.openai_async.WrappedBeta +alias posthog.ai.openai.openai_providers.AsyncWrappedChat -> posthog.ai.openai.openai_async.WrappedChat +alias posthog.ai.openai.openai_providers.AsyncWrappedEmbeddings -> posthog.ai.openai.openai_async.WrappedEmbeddings +alias posthog.ai.openai.openai_providers.AsyncWrappedResponses -> posthog.ai.openai.openai_async.WrappedResponses +alias posthog.ai.openai.openai_providers.PostHogClient -> posthog.client.Client +alias posthog.ai.openai.openai_providers.WrappedBeta -> posthog.ai.openai.openai.WrappedBeta +alias posthog.ai.openai.openai_providers.WrappedChat -> posthog.ai.openai.openai.WrappedChat +alias posthog.ai.openai.openai_providers.WrappedEmbeddings -> posthog.ai.openai.openai.WrappedEmbeddings +alias posthog.ai.openai.openai_providers.WrappedResponses -> posthog.ai.openai.openai.WrappedResponses +alias posthog.ai.openai.openai_providers.setup -> posthog.setup +alias posthog.ai.openai_agents.PostHogTracingProcessor -> posthog.ai.openai_agents.processor.PostHogTracingProcessor +alias posthog.ai.openai_agents.processor.Client -> posthog.client.Client +alias posthog.ai.openai_agents.processor.setup -> posthog.setup +alias posthog.ai.otel.PostHogSpanProcessor -> posthog.ai.otel.processor.PostHogSpanProcessor +alias posthog.ai.otel.PostHogTraceExporter -> posthog.ai.otel.exporter.PostHogTraceExporter +alias posthog.ai.otel.exporter.DEFAULT_HOST -> posthog.ai.otel.spans.DEFAULT_HOST +alias posthog.ai.otel.exporter.is_ai_span -> posthog.ai.otel.spans.is_ai_span +alias posthog.ai.otel.exporter.warn_if_posthog_ai_gateway_otel_attributes -> posthog.ai.gateway.warn_if_posthog_ai_gateway_otel_attributes +alias posthog.ai.otel.is_ai_span -> posthog.ai.otel.spans.is_ai_span +alias posthog.ai.otel.processor.DEFAULT_HOST -> posthog.ai.otel.spans.DEFAULT_HOST +alias posthog.ai.otel.processor.is_ai_span -> posthog.ai.otel.spans.is_ai_span +alias posthog.ai.otel.processor.warn_if_posthog_ai_gateway_otel_attributes -> posthog.ai.gateway.warn_if_posthog_ai_gateway_otel_attributes +alias posthog.ai.prompts.USER_AGENT -> posthog.request.USER_AGENT +alias posthog.ai.prompts.remove_trailing_slash -> posthog.utils.remove_trailing_slash +alias posthog.ai.utils.FormattedMessage -> posthog.ai.types.FormattedMessage +alias posthog.ai.utils.PostHogClient -> posthog.client.Client +alias posthog.ai.utils.StreamingEventData -> posthog.ai.types.StreamingEventData +alias posthog.ai.utils.TokenUsage -> posthog.ai.types.TokenUsage +alias posthog.ai.utils.contexts -> posthog.contexts +alias posthog.ai.utils.get_tags -> posthog.get_tags +alias posthog.ai.utils.identify_context -> posthog.identify_context +alias posthog.ai.utils.new_context -> posthog.new_context +alias posthog.ai.utils.sanitize_anthropic -> posthog.ai.sanitization.sanitize_anthropic +alias posthog.ai.utils.sanitize_gemini -> posthog.ai.sanitization.sanitize_gemini +alias posthog.ai.utils.sanitize_langchain -> posthog.ai.sanitization.sanitize_langchain +alias posthog.ai.utils.sanitize_openai -> posthog.ai.sanitization.sanitize_openai +alias posthog.ai.utils.tag -> posthog.tag +alias posthog.ai.utils.warn_if_posthog_ai_gateway -> posthog.ai.gateway.warn_if_posthog_ai_gateway +alias posthog.args.FeatureFlagEvaluations -> posthog.feature_flag_evaluations.FeatureFlagEvaluations +alias posthog.args.SendFeatureFlagsOptions -> posthog.types.SendFeatureFlagsOptions +alias posthog.client.AI_EVENTS_ENDPOINT -> posthog.request.AI_EVENTS_ENDPOINT +alias posthog.client.APIError -> posthog.request.APIError +alias posthog.client.Consumer -> posthog.consumer.Consumer +alias posthog.client.DEFAULT_CODE_VARIABLES_IGNORE_PATTERNS -> posthog.exception_utils.DEFAULT_CODE_VARIABLES_IGNORE_PATTERNS +alias posthog.client.DEFAULT_CODE_VARIABLES_MASK_PATTERNS -> posthog.exception_utils.DEFAULT_CODE_VARIABLES_MASK_PATTERNS +alias posthog.client.EVENTS_ENDPOINT -> posthog.request.EVENTS_ENDPOINT +alias posthog.client.ExceptionArg -> posthog.args.ExceptionArg +alias posthog.client.ExceptionCapture -> posthog.exception_capture.ExceptionCapture +alias posthog.client.FeatureFlag -> posthog.types.FeatureFlag +alias posthog.client.FeatureFlagError -> posthog.types.FeatureFlagError +alias posthog.client.FeatureFlagEvaluations -> posthog.feature_flag_evaluations.FeatureFlagEvaluations +alias posthog.client.FeatureFlagResult -> posthog.types.FeatureFlagResult +alias posthog.client.FlagCache -> posthog.utils.FlagCache +alias posthog.client.FlagDefinitionCacheData -> posthog.flag_definition_cache.FlagDefinitionCacheData +alias posthog.client.FlagDefinitionCacheProvider -> posthog.flag_definition_cache.FlagDefinitionCacheProvider +alias posthog.client.FlagMetadata -> posthog.types.FlagMetadata +alias posthog.client.FlagValue -> posthog.types.FlagValue +alias posthog.client.FlagsAndPayloads -> posthog.types.FlagsAndPayloads +alias posthog.client.FlagsResponse -> posthog.types.FlagsResponse +alias posthog.client.ID_TYPES -> posthog.args.ID_TYPES +alias posthog.client.InconclusiveMatchError -> posthog.feature_flags.InconclusiveMatchError +alias posthog.client.OptionalCaptureArgs -> posthog.args.OptionalCaptureArgs +alias posthog.client.OptionalSetArgs -> posthog.args.OptionalSetArgs +alias posthog.client.Poller -> posthog.poller.Poller +alias posthog.client.QuotaLimitError -> posthog.request.QuotaLimitError +alias posthog.client.RedisFlagCache -> posthog.utils.RedisFlagCache +alias posthog.client.RequestsConnectionError -> posthog.request.RequestsConnectionError +alias posthog.client.RequestsTimeout -> posthog.request.RequestsTimeout +alias posthog.client.RequiresServerEvaluation -> posthog.feature_flags.RequiresServerEvaluation +alias posthog.client.SendFeatureFlagsOptions -> posthog.types.SendFeatureFlagsOptions +alias posthog.client.SizeLimitedDict -> posthog.utils.SizeLimitedDict +alias posthog.client.VERSION -> posthog.version.VERSION +alias posthog.client.batch_post -> posthog.request.batch_post +alias posthog.client.clean -> posthog.utils.clean +alias posthog.client.determine_server_host -> posthog.request.determine_server_host +alias posthog.client.exc_info_from_error -> posthog.exception_utils.exc_info_from_error +alias posthog.client.exception_is_already_captured -> posthog.exception_utils.exception_is_already_captured +alias posthog.client.exceptions_from_error_tuple -> posthog.exception_utils.exceptions_from_error_tuple +alias posthog.client.flags -> posthog.request.flags +alias posthog.client.get -> posthog.request.get +alias posthog.client.get_capture_exception_code_variables_context -> posthog.contexts.get_capture_exception_code_variables_context +alias posthog.client.get_code_variables_ignore_patterns_context -> posthog.contexts.get_code_variables_ignore_patterns_context +alias posthog.client.get_code_variables_mask_patterns_context -> posthog.contexts.get_code_variables_mask_patterns_context +alias posthog.client.get_context_device_id -> posthog.contexts.get_context_device_id +alias posthog.client.get_context_distinct_id -> posthog.contexts.get_context_distinct_id +alias posthog.client.get_context_session_id -> posthog.contexts.get_context_session_id +alias posthog.client.guess_timezone -> posthog.utils.guess_timezone +alias posthog.client.handle_in_app -> posthog.exception_utils.handle_in_app +alias posthog.client.is_ai_event -> posthog.request.is_ai_event +alias posthog.client.mark_exception_as_captured -> posthog.exception_utils.mark_exception_as_captured +alias posthog.client.match_feature_flag_properties -> posthog.feature_flags.match_feature_flag_properties +alias posthog.client.new_context -> posthog.contexts.new_context +alias posthog.client.normalize_flags_response -> posthog.types.normalize_flags_response +alias posthog.client.normalize_host -> posthog.request.normalize_host +alias posthog.client.remote_config -> posthog.request.remote_config +alias posthog.client.reset_sessions -> posthog.request.reset_sessions +alias posthog.client.resolve_bucketing_value -> posthog.feature_flags.resolve_bucketing_value +alias posthog.client.system_context -> posthog.utils.system_context +alias posthog.client.to_flags_and_payloads -> posthog.types.to_flags_and_payloads +alias posthog.client.to_payloads -> posthog.types.to_payloads +alias posthog.client.to_values -> posthog.types.to_values +alias posthog.client.try_attach_code_variables_to_frames -> posthog.exception_utils.try_attach_code_variables_to_frames +alias posthog.consumer.AI_EVENTS_ENDPOINT -> posthog.request.AI_EVENTS_ENDPOINT +alias posthog.consumer.APIError -> posthog.request.APIError +alias posthog.consumer.DatetimeSerializer -> posthog.request.DatetimeSerializer +alias posthog.consumer.EVENTS_ENDPOINT -> posthog.request.EVENTS_ENDPOINT +alias posthog.consumer.batch_post -> posthog.request.batch_post +alias posthog.consumer.is_ai_event -> posthog.request.is_ai_event +alias posthog.contexts.Client -> posthog.client.Client +alias posthog.disable_connection_reuse -> posthog.request.disable_connection_reuse +alias posthog.enable_keep_alive -> posthog.request.enable_keep_alive +alias posthog.exception_capture.BucketedRateLimiter -> posthog.bucketed_rate_limiter.BucketedRateLimiter +alias posthog.exception_capture.Client -> posthog.client.Client +alias posthog.exception_capture.walk_exception_chain -> posthog.exception_utils.walk_exception_chain +alias posthog.exception_utils.ExcInfo -> posthog.args.ExcInfo +alias posthog.exception_utils.ExceptionArg -> posthog.args.ExceptionArg +alias posthog.feature_flag_evaluations.FlagValue -> posthog.types.FlagValue +alias posthog.feature_flags.FlagValue -> posthog.types.FlagValue +alias posthog.feature_flags.convert_to_datetime_aware -> posthog.utils.convert_to_datetime_aware +alias posthog.feature_flags.is_valid_regex -> posthog.utils.is_valid_regex +alias posthog.feature_flags.utils -> posthog.utils +alias posthog.inner_get_tags -> posthog.contexts.get_tags +alias posthog.inner_identify_context -> posthog.contexts.identify_context +alias posthog.inner_new_context -> posthog.contexts.new_context +alias posthog.inner_scoped -> posthog.contexts.scoped +alias posthog.inner_set_capture_exception_code_variables_context -> posthog.contexts.set_capture_exception_code_variables_context +alias posthog.inner_set_code_variables_ignore_patterns_context -> posthog.contexts.set_code_variables_ignore_patterns_context +alias posthog.inner_set_code_variables_mask_patterns_context -> posthog.contexts.set_code_variables_mask_patterns_context +alias posthog.inner_set_context_device_id -> posthog.contexts.set_context_device_id +alias posthog.inner_set_context_session -> posthog.contexts.set_context_session +alias posthog.inner_tag -> posthog.contexts.tag +alias posthog.integrations.django.Client -> posthog.client.Client +alias posthog.integrations.django.contexts -> posthog.contexts +alias posthog.request.VERSION -> posthog.version.VERSION +alias posthog.request.remove_trailing_slash -> posthog.utils.remove_trailing_slash +alias posthog.set_socket_options -> posthog.request.set_socket_options +attribute posthog.__version__ = VERSION +attribute posthog.ai.anthropic.anthropic.Anthropic.messages = WrappedMessages(self) +attribute posthog.ai.anthropic.anthropic_async.AsyncAnthropic.messages = AsyncWrappedMessages(self) +attribute posthog.ai.anthropic.anthropic_providers.AnthropicBedrock.messages = WrappedMessages(self) +attribute posthog.ai.anthropic.anthropic_providers.AnthropicVertex.messages = WrappedMessages(self) +attribute posthog.ai.anthropic.anthropic_providers.AsyncAnthropicBedrock.messages = AsyncWrappedMessages(self) +attribute posthog.ai.anthropic.anthropic_providers.AsyncAnthropicVertex.messages = AsyncWrappedMessages(self) +attribute posthog.ai.claude_agent_sdk.client.log = logging.getLogger('posthog') +attribute posthog.ai.claude_agent_sdk.processor.log = logging.getLogger('posthog') +attribute posthog.ai.gateway.POSTHOG_AI_GATEWAY_HOSTS = ['gateway.posthog.com', 'gateway.us.posthog.com', 'gateway.eu.posthog.com', 'ai-gateway.us.posthog.com', 'ai-gateway.eu.posthog.com'] +attribute posthog.ai.gateway.log = logging.getLogger('posthog') +attribute posthog.ai.gemini.gemini.Client.models = Models(api_key=api_key, vertexai=vertexai, credentials=credentials, project=project, location=location, debug_config=debug_config, http_options=http_options, posthog_client=(self._ph_client), posthog_distinct_id=posthog_distinct_id, posthog_properties=posthog_properties, posthog_privacy_mode=posthog_privacy_mode, posthog_groups=posthog_groups, **kwargs) +attribute posthog.ai.gemini.gemini_async.AsyncClient.models = AsyncModels(api_key=api_key, vertexai=vertexai, credentials=credentials, project=project, location=location, debug_config=debug_config, http_options=http_options, posthog_client=(self._ph_client), posthog_distinct_id=posthog_distinct_id, posthog_properties=posthog_properties, posthog_privacy_mode=posthog_privacy_mode, posthog_groups=posthog_groups, **kwargs) +attribute posthog.ai.gemini.gemini_converter.GeminiMessage.content: Union[str, List[Any]] +attribute posthog.ai.gemini.gemini_converter.GeminiMessage.parts: List[Union[GeminiPart, Dict[str, Any]]] +attribute posthog.ai.gemini.gemini_converter.GeminiMessage.role: str +attribute posthog.ai.gemini.gemini_converter.GeminiMessage.text: str +attribute posthog.ai.gemini.gemini_converter.GeminiPart.text: str +attribute posthog.ai.gemini.genai = _GenAI() +attribute posthog.ai.langchain.callbacks.GenerationMetadata.base_url: Optional[str] = None +attribute posthog.ai.langchain.callbacks.GenerationMetadata.model: Optional[str] = None +attribute posthog.ai.langchain.callbacks.GenerationMetadata.model_params: Optional[Dict[str, Any]] = None +attribute posthog.ai.langchain.callbacks.GenerationMetadata.posthog_properties: Optional[Dict[str, Any]] = None +attribute posthog.ai.langchain.callbacks.GenerationMetadata.provider: Optional[str] = None +attribute posthog.ai.langchain.callbacks.GenerationMetadata.tools: Optional[List[Dict[str, Any]]] = None +attribute posthog.ai.langchain.callbacks.ModelUsage.cache_read_tokens: Optional[int] +attribute posthog.ai.langchain.callbacks.ModelUsage.cache_write_tokens: Optional[int] +attribute posthog.ai.langchain.callbacks.ModelUsage.input_tokens: Optional[int] +attribute posthog.ai.langchain.callbacks.ModelUsage.output_tokens: Optional[int] +attribute posthog.ai.langchain.callbacks.ModelUsage.reasoning_tokens: Optional[int] +attribute posthog.ai.langchain.callbacks.RunMetadata = Union[SpanMetadata, GenerationMetadata] +attribute posthog.ai.langchain.callbacks.RunMetadataStorage = Dict[UUID, RunMetadata] +attribute posthog.ai.langchain.callbacks.SpanMetadata.end_time: Optional[float] +attribute posthog.ai.langchain.callbacks.SpanMetadata.input: Optional[Any] +attribute posthog.ai.langchain.callbacks.SpanMetadata.latency: float +attribute posthog.ai.langchain.callbacks.SpanMetadata.name: str +attribute posthog.ai.langchain.callbacks.SpanMetadata.start_time: float +attribute posthog.ai.langchain.callbacks.log = logging.getLogger('posthog') +attribute posthog.ai.openai.openai.OpenAI.beta = WrappedBeta(self, self._original_beta) +attribute posthog.ai.openai.openai.OpenAI.chat = WrappedChat(self, self._original_chat) +attribute posthog.ai.openai.openai.OpenAI.embeddings = WrappedEmbeddings(self, self._original_embeddings) +attribute posthog.ai.openai.openai.OpenAI.responses = WrappedResponses(self, self._original_responses) +attribute posthog.ai.openai.openai.WrappedBeta.chat +attribute posthog.ai.openai.openai.WrappedBetaChat.completions +attribute posthog.ai.openai.openai.WrappedChat.completions +attribute posthog.ai.openai.openai_async.AsyncOpenAI.beta = WrappedBeta(self, self._original_beta) +attribute posthog.ai.openai.openai_async.AsyncOpenAI.chat = WrappedChat(self, self._original_chat) +attribute posthog.ai.openai.openai_async.AsyncOpenAI.embeddings = WrappedEmbeddings(self, self._original_embeddings) +attribute posthog.ai.openai.openai_async.AsyncOpenAI.responses = WrappedResponses(self, self._original_responses) +attribute posthog.ai.openai.openai_async.WrappedBeta.chat +attribute posthog.ai.openai.openai_async.WrappedBetaChat.completions +attribute posthog.ai.openai.openai_async.WrappedChat.completions +attribute posthog.ai.openai.openai_providers.AsyncAzureOpenAI.beta = AsyncWrappedBeta(self, self._original_beta) +attribute posthog.ai.openai.openai_providers.AsyncAzureOpenAI.chat = AsyncWrappedChat(self, self._original_chat) +attribute posthog.ai.openai.openai_providers.AsyncAzureOpenAI.embeddings = AsyncWrappedEmbeddings(self, self._original_embeddings) +attribute posthog.ai.openai.openai_providers.AsyncAzureOpenAI.responses = AsyncWrappedResponses(self, self._original_responses) +attribute posthog.ai.openai.openai_providers.AzureOpenAI.beta = WrappedBeta(self, self._original_beta) +attribute posthog.ai.openai.openai_providers.AzureOpenAI.chat = WrappedChat(self, self._original_chat) +attribute posthog.ai.openai.openai_providers.AzureOpenAI.embeddings = WrappedEmbeddings(self, self._original_embeddings) +attribute posthog.ai.openai.openai_providers.AzureOpenAI.responses = WrappedResponses(self, self._original_responses) +attribute posthog.ai.openai.wrapper_utils.log = logging.getLogger('posthog') +attribute posthog.ai.openai_agents.processor.log = logging.getLogger('posthog') +attribute posthog.ai.otel.spans.AI_SPAN_PREFIXES = ('gen_ai.', 'llm.', 'ai.', 'traceloop.') +attribute posthog.ai.otel.spans.DEFAULT_HOST = 'https://us.i.posthog.com' +attribute posthog.ai.prompts.APP_ENDPOINT = 'https://us.posthog.com' +attribute posthog.ai.prompts.CachedPrompt.fetched_at = fetched_at +attribute posthog.ai.prompts.CachedPrompt.name = name +attribute posthog.ai.prompts.CachedPrompt.prompt = prompt +attribute posthog.ai.prompts.CachedPrompt.version = version +attribute posthog.ai.prompts.DEFAULT_CACHE_TTL_SECONDS = 300 +attribute posthog.ai.prompts.PromptCacheKey = tuple[str, Optional[int]] +attribute posthog.ai.prompts.PromptResult.name: Optional[str] = None +attribute posthog.ai.prompts.PromptResult.prompt: str +attribute posthog.ai.prompts.PromptResult.source: PromptSource +attribute posthog.ai.prompts.PromptResult.version: Optional[int] = None +attribute posthog.ai.prompts.PromptSource = Literal['api', 'cache', 'stale_cache', 'code_fallback'] +attribute posthog.ai.prompts.PromptVariables = Dict[str, Union[str, int, float, bool]] +attribute posthog.ai.prompts.log = logging.getLogger('posthog') +attribute posthog.ai.sanitization.REDACTED_IMAGE_PLACEHOLDER = '[base64 image redacted]' +attribute posthog.ai.stream.T = TypeVar('T') +attribute posthog.ai.types.FormattedContentItem = Union[FormattedTextContent, FormattedFunctionCall, FormattedImageContent, Dict[str, Any]] +attribute posthog.ai.types.FormattedFunctionCall.function: Dict[str, Any] +attribute posthog.ai.types.FormattedFunctionCall.id: Optional[str] +attribute posthog.ai.types.FormattedFunctionCall.type: str +attribute posthog.ai.types.FormattedImageContent.image: str +attribute posthog.ai.types.FormattedImageContent.type: str +attribute posthog.ai.types.FormattedMessage.content: Union[str, List[FormattedContentItem], Any] +attribute posthog.ai.types.FormattedMessage.role: str +attribute posthog.ai.types.FormattedTextContent.text: str +attribute posthog.ai.types.FormattedTextContent.type: str +attribute posthog.ai.types.ProviderResponse.error: Optional[str] +attribute posthog.ai.types.ProviderResponse.messages: List[FormattedMessage] +attribute posthog.ai.types.ProviderResponse.usage: TokenUsage +attribute posthog.ai.types.StreamingContentBlock.function: Optional[Dict[str, Any]] +attribute posthog.ai.types.StreamingContentBlock.id: Optional[str] +attribute posthog.ai.types.StreamingContentBlock.text: Optional[str] +attribute posthog.ai.types.StreamingContentBlock.type: str +attribute posthog.ai.types.StreamingEventData.base_url: str +attribute posthog.ai.types.StreamingEventData.distinct_id: Optional[str] +attribute posthog.ai.types.StreamingEventData.formatted_input: Any +attribute posthog.ai.types.StreamingEventData.formatted_output: Any +attribute posthog.ai.types.StreamingEventData.groups: Optional[Dict[str, Any]] +attribute posthog.ai.types.StreamingEventData.kwargs: Dict[str, Any] +attribute posthog.ai.types.StreamingEventData.latency: float +attribute posthog.ai.types.StreamingEventData.model: str +attribute posthog.ai.types.StreamingEventData.privacy_mode: bool +attribute posthog.ai.types.StreamingEventData.properties: Optional[Dict[str, Any]] +attribute posthog.ai.types.StreamingEventData.provider: str +attribute posthog.ai.types.StreamingEventData.stop_reason: Optional[str] +attribute posthog.ai.types.StreamingEventData.trace_id: Optional[str] +attribute posthog.ai.types.StreamingEventData.usage_stats: TokenUsage +attribute posthog.ai.types.TokenUsage.cache_creation_input_tokens: Optional[int] +attribute posthog.ai.types.TokenUsage.cache_read_input_tokens: Optional[int] +attribute posthog.ai.types.TokenUsage.input_tokens: int +attribute posthog.ai.types.TokenUsage.output_tokens: int +attribute posthog.ai.types.TokenUsage.raw_usage: Optional[Any] +attribute posthog.ai.types.TokenUsage.reasoning_tokens: Optional[int] +attribute posthog.ai.types.TokenUsage.web_search_count: Optional[int] +attribute posthog.ai.types.ToolInProgress.block: StreamingContentBlock +attribute posthog.ai.types.ToolInProgress.input_string: str +attribute posthog.api_key = None +attribute posthog.args.ExcInfo = Union[Tuple[Type[BaseException], BaseException, Optional[TracebackType]], Tuple[None, None, None]] +attribute posthog.args.ExceptionArg = Union[BaseException, ExcInfo] +attribute posthog.args.ID_TYPES = Union[numbers.Number, str, UUID, int] +attribute posthog.args.OptionalCaptureArgs.disable_geoip: NotRequired[Optional[bool]] +attribute posthog.args.OptionalCaptureArgs.distinct_id: NotRequired[Optional[ID_TYPES]] +attribute posthog.args.OptionalCaptureArgs.flags: NotRequired[Optional[FeatureFlagEvaluations]] +attribute posthog.args.OptionalCaptureArgs.groups: NotRequired[Optional[Dict[str, str]]] +attribute posthog.args.OptionalCaptureArgs.properties: NotRequired[Optional[Dict[str, Any]]] +attribute posthog.args.OptionalCaptureArgs.send_feature_flags: NotRequired[Optional[Union[bool, SendFeatureFlagsOptions]]] +attribute posthog.args.OptionalCaptureArgs.timestamp: NotRequired[Optional[Union[datetime, str]]] +attribute posthog.args.OptionalCaptureArgs.uuid: NotRequired[Optional[str]] +attribute posthog.args.OptionalSetArgs.disable_geoip: NotRequired[Optional[bool]] +attribute posthog.args.OptionalSetArgs.distinct_id: NotRequired[Optional[ID_TYPES]] +attribute posthog.args.OptionalSetArgs.properties: NotRequired[Optional[Dict[str, Any]]] +attribute posthog.args.OptionalSetArgs.timestamp: NotRequired[Optional[Union[datetime, str]]] +attribute posthog.args.OptionalSetArgs.uuid: NotRequired[Optional[str]] +attribute posthog.before_send = None +attribute posthog.bucketed_rate_limiter.Number = Union[int, float] +attribute posthog.bucketed_rate_limiter.ONE_DAY_IN_SECONDS = 86400.0 +attribute posthog.bucketed_rate_limiter.log = logging.getLogger('posthog') +attribute posthog.capture_exception_code_variables = False +attribute posthog.client.Client.api_key = (project_api_key or '').strip() +attribute posthog.client.Client.capture_exception_code_variables = capture_exception_code_variables +attribute posthog.client.Client.code_variables_ignore_patterns = code_variables_ignore_patterns if code_variables_ignore_patterns is not None else DEFAULT_CODE_VARIABLES_IGNORE_PATTERNS +attribute posthog.client.Client.code_variables_mask_patterns = code_variables_mask_patterns if code_variables_mask_patterns is not None else DEFAULT_CODE_VARIABLES_MASK_PATTERNS +attribute posthog.client.Client.cohorts: Optional[dict[str, Any]] = None +attribute posthog.client.Client.consumers = None +attribute posthog.client.Client.debug = debug +attribute posthog.client.Client.disable_geoip = disable_geoip +attribute posthog.client.Client.disabled = disabled or not self.api_key +attribute posthog.client.Client.distinct_ids_feature_flags_reported = SizeLimitedDict(MAX_DICT_SIZE, set) +attribute posthog.client.Client.enable_exception_autocapture = enable_exception_autocapture +attribute posthog.client.Client.enable_exception_autocapture_rate_limiting = enable_exception_autocapture_rate_limiting +attribute posthog.client.Client.enable_local_evaluation = enable_local_evaluation +attribute posthog.client.Client.exception_autocapture_bucket_size = exception_autocapture_bucket_size +attribute posthog.client.Client.exception_autocapture_refill_interval_seconds = exception_autocapture_refill_interval_seconds +attribute posthog.client.Client.exception_autocapture_refill_rate = exception_autocapture_refill_rate +attribute posthog.client.Client.exception_capture = None +attribute posthog.client.Client.feature_flags +attribute posthog.client.Client.feature_flags_by_key: Optional[dict[str, Any]] = None +attribute posthog.client.Client.feature_flags_request_timeout_seconds = feature_flags_request_timeout_seconds +attribute posthog.client.Client.flag_cache = self._initialize_flag_cache(flag_fallback_cache_url) +attribute posthog.client.Client.flag_definition_version = 0 +attribute posthog.client.Client.flag_fallback_cache_url = flag_fallback_cache_url +attribute posthog.client.Client.group_type_mapping: Optional[dict[str, str]] = None +attribute posthog.client.Client.gzip = gzip +attribute posthog.client.Client.historical_migration = historical_migration +attribute posthog.client.Client.host = determine_server_host(host) +attribute posthog.client.Client.in_app_modules = in_app_modules +attribute posthog.client.Client.is_server = is_server +attribute posthog.client.Client.log = logging.getLogger('posthog') +attribute posthog.client.Client.log_captured_exceptions = log_captured_exceptions +attribute posthog.client.Client.on_error = on_error +attribute posthog.client.Client.personal_api_key = (personal_api_key.strip() if isinstance(personal_api_key, str) else personal_api_key) or None +attribute posthog.client.Client.poll_interval = poll_interval +attribute posthog.client.Client.poller: Optional[Poller] = None +attribute posthog.client.Client.privacy_mode = privacy_mode +attribute posthog.client.Client.project_root = project_root +attribute posthog.client.Client.queue: Queue = Queue(max_queue_size) +attribute posthog.client.Client.raw_host = normalize_host(host) +attribute posthog.client.Client.send = send +attribute posthog.client.Client.super_properties = super_properties +attribute posthog.client.Client.sync_mode = sync_mode +attribute posthog.client.Client.timeout = timeout +attribute posthog.client.MAX_DICT_SIZE = 50000 +attribute posthog.code_variables_ignore_patterns = DEFAULT_CODE_VARIABLES_IGNORE_PATTERNS +attribute posthog.code_variables_mask_patterns = DEFAULT_CODE_VARIABLES_MASK_PATTERNS +attribute posthog.consumer.AI_MAX_MSG_SIZE = 8 * 1024 * 1024 +attribute posthog.consumer.BATCH_SIZE_LIMIT = 5 * 1024 * 1024 +attribute posthog.consumer.Consumer.api_key = api_key +attribute posthog.consumer.Consumer.daemon = True +attribute posthog.consumer.Consumer.dedicated_ai_endpoint = dedicated_ai_endpoint +attribute posthog.consumer.Consumer.flush_at = flush_at +attribute posthog.consumer.Consumer.flush_interval = flush_interval +attribute posthog.consumer.Consumer.gzip = gzip +attribute posthog.consumer.Consumer.historical_migration = historical_migration +attribute posthog.consumer.Consumer.host = host +attribute posthog.consumer.Consumer.log = logging.getLogger('posthog') +attribute posthog.consumer.Consumer.on_error = on_error +attribute posthog.consumer.Consumer.queue = queue +attribute posthog.consumer.Consumer.retries = retries +attribute posthog.consumer.Consumer.running = True +attribute posthog.consumer.Consumer.timeout = timeout +attribute posthog.consumer.MAX_MSG_SIZE = 900 * 1024 +attribute posthog.contexts.ContextScope.capture_exception_code_variables: Optional[bool] = None +attribute posthog.contexts.ContextScope.capture_exceptions = capture_exceptions +attribute posthog.contexts.ContextScope.client: Optional[Client] = client +attribute posthog.contexts.ContextScope.code_variables_ignore_patterns: Optional[list] = None +attribute posthog.contexts.ContextScope.code_variables_mask_patterns: Optional[list] = None +attribute posthog.contexts.ContextScope.device_id: Optional[str] = None +attribute posthog.contexts.ContextScope.distinct_id: Optional[str] = None +attribute posthog.contexts.ContextScope.fresh = fresh +attribute posthog.contexts.ContextScope.parent = parent +attribute posthog.contexts.ContextScope.session_id: Optional[str] = None +attribute posthog.contexts.ContextScope.tags: Dict[str, Any] = {} +attribute posthog.contexts.F = TypeVar('F', bound=(Callable[..., Any])) +attribute posthog.debug = False +attribute posthog.default_client = None +attribute posthog.disable_geoip = True +attribute posthog.disabled = False +attribute posthog.enable_exception_autocapture = False +attribute posthog.enable_exception_autocapture_rate_limiting = False +attribute posthog.enable_local_evaluation = True +attribute posthog.exception_autocapture_bucket_size = ExceptionCapture.DEFAULT_BUCKET_SIZE +attribute posthog.exception_autocapture_refill_interval_seconds = ExceptionCapture.DEFAULT_REFILL_INTERVAL_SECONDS +attribute posthog.exception_autocapture_refill_rate = ExceptionCapture.DEFAULT_REFILL_RATE +attribute posthog.exception_capture.ExceptionCapture.DEFAULT_BUCKET_SIZE = 50 +attribute posthog.exception_capture.ExceptionCapture.DEFAULT_REFILL_INTERVAL_SECONDS = 10 +attribute posthog.exception_capture.ExceptionCapture.DEFAULT_REFILL_RATE = 10 +attribute posthog.exception_capture.ExceptionCapture.client = client +attribute posthog.exception_capture.ExceptionCapture.log = logging.getLogger('posthog') +attribute posthog.exception_capture.ExceptionCapture.original_excepthook = sys.excepthook +attribute posthog.exception_utils.Annotated = Union[AnnotatedValue, T] +attribute posthog.exception_utils.AnnotatedValue.metadata = metadata +attribute posthog.exception_utils.AnnotatedValue.value = value +attribute posthog.exception_utils.BASE64_ALPHABET = re.compile('^[a-zA-Z0-9/+=]*$') +attribute posthog.exception_utils.CODE_VARIABLES_REDACTED_VALUE = '$$_posthog_redacted_based_on_masking_rules_$$' +attribute posthog.exception_utils.CODE_VARIABLES_TOO_LONG_VALUE = '$$_posthog_value_too_long_$$' +attribute posthog.exception_utils.DEFAULT_CODE_VARIABLES_IGNORE_PATTERNS = ['^__.*'] +attribute posthog.exception_utils.DEFAULT_CODE_VARIABLES_MASK_PATTERNS = ['(?i)password', '(?i)secret', '(?i)passwd', '(?i)pwd', '(?i)api_key', '(?i)apikey', '(?i)auth', '(?i)credentials', '(?i)privatekey', '(?i)private_key', '(?i)token', '(?i)aws_access_key_id', '(?i)_pass', '(?i)sk_', '(?i)jwt'] +attribute posthog.exception_utils.DEFAULT_MAX_VALUE_LENGTH = 1024 +attribute posthog.exception_utils.DEFAULT_TOTAL_VARIABLES_SIZE_LIMIT = 20 * 1024 +attribute posthog.exception_utils.Event = TypedDict('Event', {'breadcrumbs': Dict[Literal['values'], List[Dict[str, Any]]], 'check_in_id': str, 'contexts': Dict[str, Dict[str, object]], 'dist': str, 'duration': Optional[float], 'environment': str, 'errors': List[Dict[str, Any]], 'event_id': str, 'exception': Dict[Literal['values'], List[Dict[str, Any]]], 'level': LogLevelStr, 'logger': str, 'message': str, 'modules': Dict[str, str], 'monitor_slug': Optional[str], 'platform': Literal['python'], 'profile': object, 'release': str, 'request': Dict[str, object], 'server_name': str, 'spans': List[Dict[str, object]], 'stacktrace': Dict[str, object], 'start_timestamp': datetime, 'status': Optional[str], 'threads': Dict[Literal['values'], List[Dict[str, Any]]], 'timestamp': Optional[datetime], 'transaction': str, 'type': Literal['check_in', 'transaction'], 'user': Dict[str, object], '_metrics_summary': Dict[str, object]}, total=False) +attribute posthog.exception_utils.HAS_CHAINED_EXCEPTIONS = hasattr(Exception, '__suppress_context__') +attribute posthog.exception_utils.LogLevelStr = Literal['fatal', 'critical', 'error', 'warning', 'info', 'debug'] +attribute posthog.exception_utils.SENSITIVE_DATA_SUBSTITUTE = '[Filtered]' +attribute posthog.exception_utils.T = TypeVar('T') +attribute posthog.exception_utils.VariableSizeLimiter.current_size = 0 +attribute posthog.exception_utils.VariableSizeLimiter.max_size = max_size +attribute posthog.exception_utils.epoch = datetime(1970, 1, 1) +attribute posthog.feature_flag_evaluations.FeatureFlagEvaluations.keys: List[str] +attribute posthog.feature_flags.ConditionMatch.MATCH = 'match' +attribute posthog.feature_flags.ConditionMatch.NO_MATCH = 'no_match' +attribute posthog.feature_flags.ConditionMatch.OUT_OF_ROLLOUT_BOUND = 'out_of_rollout_bound' +attribute posthog.feature_flags.DATE_OPERATORS = ('is_date_before', 'is_date_after') +attribute posthog.feature_flags.EQUALITY_OPERATORS = ('exact', 'is_not', 'is_set', 'is_not_set') +attribute posthog.feature_flags.NONE_VALUES_ALLOWED_OPERATORS = ['is_not'] +attribute posthog.feature_flags.NUMERIC_OPERATORS = ('gt', 'gte', 'lt', 'lte') +attribute posthog.feature_flags.PROPERTY_OPERATORS = EQUALITY_OPERATORS + STRING_OPERATORS + NUMERIC_OPERATORS + DATE_OPERATORS + SEMVER_OPERATORS +attribute posthog.feature_flags.SEMVER_COMPARISON_OPERATORS = ('semver_eq', 'semver_neq', 'semver_gt', 'semver_gte', 'semver_lt', 'semver_lte') +attribute posthog.feature_flags.SEMVER_OPERATORS = SEMVER_COMPARISON_OPERATORS + SEMVER_RANGE_OPERATORS +attribute posthog.feature_flags.SEMVER_RANGE_OPERATORS = ('semver_tilde', 'semver_caret', 'semver_wildcard') +attribute posthog.feature_flags.STRING_OPERATORS = ('icontains', 'not_icontains', 'regex', 'not_regex') +attribute posthog.feature_flags.log = logging.getLogger('posthog') +attribute posthog.feature_flags_request_timeout_seconds = 3 +attribute posthog.flag_definition_cache.FlagDefinitionCacheData.cohorts: Required[Dict[str, Any]] +attribute posthog.flag_definition_cache.FlagDefinitionCacheData.flags: Required[List[Dict[str, Any]]] +attribute posthog.flag_definition_cache.FlagDefinitionCacheData.group_type_mapping: Required[Dict[str, str]] +attribute posthog.flag_definition_cache_provider = None +attribute posthog.host = None +attribute posthog.in_app_modules = None +attribute posthog.integrations.celery.PosthogCeleryIntegration.capture_exceptions = capture_exceptions +attribute posthog.integrations.celery.PosthogCeleryIntegration.capture_task_lifecycle_events = capture_task_lifecycle_events +attribute posthog.integrations.celery.PosthogCeleryIntegration.client = client +attribute posthog.integrations.celery.PosthogCeleryIntegration.propagate_context = propagate_context +attribute posthog.integrations.celery.PosthogCeleryIntegration.task_filter = task_filter +attribute posthog.integrations.django.PosthogContextMiddleware.async_capable = True +attribute posthog.integrations.django.PosthogContextMiddleware.capture_exceptions = settings.POSTHOG_MW_CAPTURE_EXCEPTIONS +attribute posthog.integrations.django.PosthogContextMiddleware.client = cast('Optional[Client]', settings.POSTHOG_MW_CLIENT) +attribute posthog.integrations.django.PosthogContextMiddleware.extra_tags = cast('Optional[Callable[[HttpRequest], Dict[str, Any]]]', settings.POSTHOG_MW_EXTRA_TAGS) +attribute posthog.integrations.django.PosthogContextMiddleware.get_response = get_response +attribute posthog.integrations.django.PosthogContextMiddleware.request_filter = cast('Optional[Callable[[HttpRequest], bool]]', settings.POSTHOG_MW_REQUEST_FILTER) +attribute posthog.integrations.django.PosthogContextMiddleware.sync_capable = True +attribute posthog.integrations.django.PosthogContextMiddleware.tag_map = cast('Optional[Callable[[Dict[str, Any]], Dict[str, Any]]]', settings.POSTHOG_MW_TAG_MAP) +attribute posthog.is_server = True +attribute posthog.log_captured_exceptions = False +attribute posthog.on_error = None +attribute posthog.personal_api_key = None +attribute posthog.poll_interval = 30 +attribute posthog.poller.Poller.args = args +attribute posthog.poller.Poller.daemon = True +attribute posthog.poller.Poller.execute = execute +attribute posthog.poller.Poller.interval = interval +attribute posthog.poller.Poller.kwargs = kwargs +attribute posthog.poller.Poller.stopped = threading.Event() +attribute posthog.privacy_mode = False +attribute posthog.project_api_key = None +attribute posthog.project_root = None +attribute posthog.request.AI_EVENTS_ENDPOINT = '/i/v0/ai/batch/' +attribute posthog.request.APIError.message = message +attribute posthog.request.APIError.retry_after = retry_after +attribute posthog.request.APIError.status = status +attribute posthog.request.DEFAULT_HOST = US_INGESTION_ENDPOINT +attribute posthog.request.EU_INGESTION_ENDPOINT = 'https://eu.i.posthog.com' +attribute posthog.request.EVENTS_ENDPOINT = '/batch/' +attribute posthog.request.GetResponse.data: Any +attribute posthog.request.GetResponse.etag: Optional[str] = None +attribute posthog.request.GetResponse.not_modified: bool = False +attribute posthog.request.HTTPAdapterWithSocketOptions.socket_options = socket_options +attribute posthog.request.KEEPALIVE_IDLE_SECONDS = 60 +attribute posthog.request.KEEPALIVE_INTERVAL_SECONDS = 60 +attribute posthog.request.KEEPALIVE_PROBE_COUNT = 3 +attribute posthog.request.KEEP_ALIVE_SOCKET_OPTIONS: SocketOptions = list(HTTPConnection.default_socket_options) + [(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)] +attribute posthog.request.RETRY_STATUS_FORCELIST = [408, 500, 502, 503, 504] +attribute posthog.request.RequestsConnectionError = requests.exceptions.ConnectionError +attribute posthog.request.RequestsTimeout = requests.exceptions.Timeout +attribute posthog.request.SocketOptions = List[Tuple[int, int, Union[int, bytes]]] +attribute posthog.request.USER_AGENT = 'posthog-python/' + VERSION +attribute posthog.request.US_INGESTION_ENDPOINT = 'https://us.i.posthog.com' +attribute posthog.send = True +attribute posthog.super_properties = None +attribute posthog.sync_mode = False +attribute posthog.types.BeforeSendCallback = Callable[[dict[str, Any]], Optional[dict[str, Any]]] +attribute posthog.types.FeatureFlag.enabled: bool +attribute posthog.types.FeatureFlag.key: str +attribute posthog.types.FeatureFlag.metadata: Union[FlagMetadata, LegacyFlagMetadata] +attribute posthog.types.FeatureFlag.reason: Optional[FlagReason] +attribute posthog.types.FeatureFlag.variant: Optional[str] +attribute posthog.types.FeatureFlagError.CONNECTION_ERROR = 'connection_error' +attribute posthog.types.FeatureFlagError.ERRORS_WHILE_COMPUTING = 'errors_while_computing_flags' +attribute posthog.types.FeatureFlagError.FLAG_MISSING = 'flag_missing' +attribute posthog.types.FeatureFlagError.QUOTA_LIMITED = 'quota_limited' +attribute posthog.types.FeatureFlagError.TIMEOUT = 'timeout' +attribute posthog.types.FeatureFlagError.UNKNOWN_ERROR = 'unknown_error' +attribute posthog.types.FeatureFlagResult.enabled: bool +attribute posthog.types.FeatureFlagResult.key: str +attribute posthog.types.FeatureFlagResult.payload: Optional[Any] +attribute posthog.types.FeatureFlagResult.reason: Optional[str] +attribute posthog.types.FeatureFlagResult.variant: Optional[str] +attribute posthog.types.FlagMetadata.description: str +attribute posthog.types.FlagMetadata.id: int +attribute posthog.types.FlagMetadata.payload: Optional[str] +attribute posthog.types.FlagMetadata.version: int +attribute posthog.types.FlagReason.code: str +attribute posthog.types.FlagReason.condition_index: Optional[int] +attribute posthog.types.FlagReason.description: str +attribute posthog.types.FlagValue = Union[bool, str] +attribute posthog.types.FlagsAndPayloads.featureFlagPayloads: Optional[dict[str, Any]] +attribute posthog.types.FlagsAndPayloads.featureFlags: Optional[dict[str, FlagValue]] +attribute posthog.types.FlagsResponse.errorsWhileComputingFlags: bool +attribute posthog.types.FlagsResponse.evaluatedAt: Optional[int] +attribute posthog.types.FlagsResponse.flags: dict[str, FeatureFlag] +attribute posthog.types.FlagsResponse.quotaLimit: Optional[List[str]] +attribute posthog.types.FlagsResponse.requestId: str +attribute posthog.types.LegacyFlagMetadata.payload: Any +attribute posthog.types.SendFeatureFlagsOptions.flag_keys_filter: Optional[list[str]] +attribute posthog.types.SendFeatureFlagsOptions.group_properties: Optional[dict[str, dict[str, Any]]] +attribute posthog.types.SendFeatureFlagsOptions.only_evaluate_locally: Optional[bool] +attribute posthog.types.SendFeatureFlagsOptions.person_properties: Optional[dict[str, Any]] +attribute posthog.types.SendFeatureFlagsOptions.should_send: bool +attribute posthog.utils.CACHE_KEY_PREFIX = 'posthog:flags:' +attribute posthog.utils.CACHE_MAX_SIZE = 10000 +attribute posthog.utils.CACHE_STALE_TTL = 3600 +attribute posthog.utils.CACHE_TTL = 300 +attribute posthog.utils.FlagCache.access_times = {} +attribute posthog.utils.FlagCache.cache = {} +attribute posthog.utils.FlagCache.default_ttl = default_ttl +attribute posthog.utils.FlagCache.max_size = max_size +attribute posthog.utils.FlagCacheEntry.flag_definition_version = flag_definition_version +attribute posthog.utils.FlagCacheEntry.flag_result = flag_result +attribute posthog.utils.FlagCacheEntry.timestamp = timestamp or time.time() +attribute posthog.utils.RedisFlagCache.default_ttl = default_ttl +attribute posthog.utils.RedisFlagCache.key_prefix = key_prefix +attribute posthog.utils.RedisFlagCache.redis = redis_client +attribute posthog.utils.RedisFlagCache.stale_ttl = stale_ttl +attribute posthog.utils.RedisFlagCache.version_key = f'{key_prefix}version' +attribute posthog.utils.SizeLimitedDict.max_size = max_size +attribute posthog.utils.log = logging.getLogger('posthog') +attribute posthog.version.VERSION = '7.19.1' +class posthog.Posthog +class posthog.ai.anthropic.anthropic.Anthropic(posthog_client: Optional[PostHogClient] = None, **kwargs) +class posthog.ai.anthropic.anthropic.WrappedMessages +class posthog.ai.anthropic.anthropic_async.AsyncAnthropic(posthog_client: Optional[PostHogClient] = None, **kwargs) +class posthog.ai.anthropic.anthropic_async.AsyncWrappedMessages +class posthog.ai.anthropic.anthropic_providers.AnthropicBedrock(posthog_client: Optional[PostHogClient] = None, **kwargs) +class posthog.ai.anthropic.anthropic_providers.AnthropicVertex(posthog_client: Optional[PostHogClient] = None, **kwargs) +class posthog.ai.anthropic.anthropic_providers.AsyncAnthropicBedrock(posthog_client: Optional[PostHogClient] = None, **kwargs) +class posthog.ai.anthropic.anthropic_providers.AsyncAnthropicVertex(posthog_client: Optional[PostHogClient] = None, **kwargs) +class posthog.ai.claude_agent_sdk.client.PostHogClaudeSDKClient(options: Optional[ClaudeAgentOptions] = None, transport: Any = None, *, posthog_client: Optional[Client] = None, posthog_distinct_id: Optional[Union[str, Callable[[ResultMessage], Optional[str]]]] = None, posthog_trace_id: Optional[str] = None, posthog_properties: Optional[Dict[str, Any]] = None, posthog_privacy_mode: bool = False, posthog_groups: Optional[Dict[str, Any]] = None) +class posthog.ai.claude_agent_sdk.processor.PostHogClaudeAgentProcessor(client: Optional[Client] = None, distinct_id: Optional[Union[str, Callable[[ResultMessage], Optional[str]]]] = None, privacy_mode: bool = False, groups: Optional[Dict[str, Any]] = None, properties: Optional[Dict[str, Any]] = None) +class posthog.ai.gemini.gemini.Client(api_key: Optional[str] = None, vertexai: Optional[bool] = None, credentials: Optional[Any] = None, project: Optional[str] = None, location: Optional[str] = None, debug_config: Optional[Any] = None, http_options: Optional[Any] = None, posthog_client: Optional[PostHogClient] = None, posthog_distinct_id: Optional[str] = None, posthog_properties: Optional[Dict[str, Any]] = None, posthog_privacy_mode: bool = False, posthog_groups: Optional[Dict[str, Any]] = None, **kwargs) +class posthog.ai.gemini.gemini.Models(api_key: Optional[str] = None, vertexai: Optional[bool] = None, credentials: Optional[Any] = None, project: Optional[str] = None, location: Optional[str] = None, debug_config: Optional[Any] = None, http_options: Optional[Any] = None, posthog_client: Optional[PostHogClient] = None, posthog_distinct_id: Optional[str] = None, posthog_properties: Optional[Dict[str, Any]] = None, posthog_privacy_mode: bool = False, posthog_groups: Optional[Dict[str, Any]] = None, **kwargs) +class posthog.ai.gemini.gemini_async.AsyncClient(api_key: Optional[str] = None, vertexai: Optional[bool] = None, credentials: Optional[Any] = None, project: Optional[str] = None, location: Optional[str] = None, debug_config: Optional[Any] = None, http_options: Optional[Any] = None, posthog_client: Optional[PostHogClient] = None, posthog_distinct_id: Optional[str] = None, posthog_properties: Optional[Dict[str, Any]] = None, posthog_privacy_mode: bool = False, posthog_groups: Optional[Dict[str, Any]] = None, **kwargs) +class posthog.ai.gemini.gemini_async.AsyncModels(api_key: Optional[str] = None, vertexai: Optional[bool] = None, credentials: Optional[Any] = None, project: Optional[str] = None, location: Optional[str] = None, debug_config: Optional[Any] = None, http_options: Optional[Any] = None, posthog_client: Optional[PostHogClient] = None, posthog_distinct_id: Optional[str] = None, posthog_properties: Optional[Dict[str, Any]] = None, posthog_privacy_mode: bool = False, posthog_groups: Optional[Dict[str, Any]] = None, **kwargs) +class posthog.ai.gemini.gemini_converter.GeminiMessage +class posthog.ai.gemini.gemini_converter.GeminiPart +class posthog.ai.langchain.callbacks.CallbackHandler(client: Optional[Client] = None, *, distinct_id: Optional[Union[str, int, UUID]] = None, trace_id: Optional[Union[str, int, float, UUID]] = None, properties: Optional[Dict[str, Any]] = None, privacy_mode: bool = False, groups: Optional[Dict[str, Any]] = None) +class posthog.ai.langchain.callbacks.GenerationMetadata(name: str, start_time: float, end_time: Optional[float], input: Optional[Any], provider: Optional[str] = None, model: Optional[str] = None, model_params: Optional[Dict[str, Any]] = None, base_url: Optional[str] = None, tools: Optional[List[Dict[str, Any]]] = None, posthog_properties: Optional[Dict[str, Any]] = None) +class posthog.ai.langchain.callbacks.ModelUsage(input_tokens: Optional[int], output_tokens: Optional[int], cache_write_tokens: Optional[int], cache_read_tokens: Optional[int], reasoning_tokens: Optional[int]) +class posthog.ai.langchain.callbacks.SpanMetadata(name: str, start_time: float, end_time: Optional[float], input: Optional[Any]) +class posthog.ai.openai.openai.OpenAI(posthog_client: Optional[PostHogClient] = None, **kwargs) +class posthog.ai.openai.openai.WrappedBeta +class posthog.ai.openai.openai.WrappedBetaChat +class posthog.ai.openai.openai.WrappedBetaCompletions +class posthog.ai.openai.openai.WrappedChat +class posthog.ai.openai.openai.WrappedCompletions +class posthog.ai.openai.openai.WrappedEmbeddings +class posthog.ai.openai.openai.WrappedResponses +class posthog.ai.openai.openai_async.AsyncOpenAI(posthog_client: Optional[PostHogClient] = None, **kwargs) +class posthog.ai.openai.openai_async.WrappedBeta +class posthog.ai.openai.openai_async.WrappedBetaChat +class posthog.ai.openai.openai_async.WrappedBetaCompletions +class posthog.ai.openai.openai_async.WrappedChat +class posthog.ai.openai.openai_async.WrappedCompletions +class posthog.ai.openai.openai_async.WrappedEmbeddings +class posthog.ai.openai.openai_async.WrappedResponses +class posthog.ai.openai.openai_providers.AsyncAzureOpenAI(posthog_client: Optional[PostHogClient] = None, **kwargs) +class posthog.ai.openai.openai_providers.AzureOpenAI(posthog_client: Optional[PostHogClient] = None, **kwargs) +class posthog.ai.openai_agents.processor.PostHogTracingProcessor(client: Optional[Client] = None, distinct_id: Optional[Union[str, Callable[[Trace], Optional[str]]]] = None, privacy_mode: bool = False, groups: Optional[Dict[str, Any]] = None, properties: Optional[Dict[str, Any]] = None) +class posthog.ai.otel.exporter.PostHogTraceExporter(api_key: str, host: str = DEFAULT_HOST) +class posthog.ai.otel.processor.PostHogSpanProcessor(api_key: str, host: str = DEFAULT_HOST) +class posthog.ai.prompts.CachedPrompt(prompt: str, fetched_at: float, name: str, version: int) +class posthog.ai.prompts.PromptResult(source: PromptSource, prompt: str, name: Optional[str] = None, version: Optional[int] = None) +class posthog.ai.prompts.Prompts(posthog: Optional[Any] = None, *, personal_api_key: Optional[str] = None, project_api_key: Optional[str] = None, host: Optional[str] = None, default_cache_ttl_seconds: Optional[int] = None, capture_errors: bool = False) +class posthog.ai.stream.AsyncStreamWrapper(generator: AsyncGenerator[T, None], stream: Optional[Any] = None) +class posthog.ai.types.FormattedFunctionCall +class posthog.ai.types.FormattedImageContent +class posthog.ai.types.FormattedMessage +class posthog.ai.types.FormattedTextContent +class posthog.ai.types.ProviderResponse +class posthog.ai.types.StreamingContentBlock +class posthog.ai.types.StreamingEventData +class posthog.ai.types.TokenUsage +class posthog.ai.types.ToolInProgress +class posthog.args.OptionalCaptureArgs +class posthog.args.OptionalSetArgs +class posthog.bucketed_rate_limiter.BucketedRateLimiter(bucket_size: Number, refill_rate: Number, refill_interval_seconds: Number, on_bucket_rate_limited: Optional[Callable[[Hashable], None]] = None, clock: Callable[[], float] = time.monotonic) +class posthog.client.Client(project_api_key: str, host=None, debug=False, max_queue_size=10000, send=True, on_error=None, flush_at=100, flush_interval=0.5, gzip=False, max_retries=3, sync_mode=False, timeout=15, thread=1, poll_interval=30, personal_api_key=None, disabled=False, disable_geoip=True, is_server=True, historical_migration=False, feature_flags_request_timeout_seconds=3, super_properties=None, enable_exception_autocapture=False, log_captured_exceptions=False, project_root=None, privacy_mode=False, before_send=None, flag_fallback_cache_url=None, enable_local_evaluation=True, flag_definition_cache_provider: Optional[FlagDefinitionCacheProvider] = None, capture_exception_code_variables=False, code_variables_mask_patterns=None, code_variables_ignore_patterns=None, in_app_modules: list[str] | None = None, enable_exception_autocapture_rate_limiting=False, exception_autocapture_bucket_size=ExceptionCapture.DEFAULT_BUCKET_SIZE, exception_autocapture_refill_rate=ExceptionCapture.DEFAULT_REFILL_RATE, exception_autocapture_refill_interval_seconds=ExceptionCapture.DEFAULT_REFILL_INTERVAL_SECONDS, _dedicated_ai_endpoint=False) +class posthog.consumer.Consumer(queue, api_key, flush_at=100, host=None, on_error=None, flush_interval=0.5, gzip=False, retries=10, timeout=15, historical_migration=False, dedicated_ai_endpoint=False) +class posthog.contexts.ContextScope(parent=None, fresh: bool = False, capture_exceptions: bool = True, client: Optional[Client] = None) +class posthog.exception_capture.ExceptionCapture(client: Client, rate_limiting_enabled=False, bucket_size=DEFAULT_BUCKET_SIZE, refill_rate=DEFAULT_REFILL_RATE, refill_interval_seconds=DEFAULT_REFILL_INTERVAL_SECONDS) +class posthog.exception_utils.AnnotatedValue(value, metadata) +class posthog.exception_utils.VariableSizeLimiter(max_size=DEFAULT_TOTAL_VARIABLES_SIZE_LIMIT) +class posthog.feature_flag_evaluations.FeatureFlagEvaluations(host: _FeatureFlagEvaluationsHost, distinct_id: str, flags: Dict[str, _EvaluatedFlagRecord], groups: Optional[Dict[str, str]] = None, disable_geoip: Optional[bool] = None, request_id: Optional[str] = None, evaluated_at: Optional[int] = None, errors_while_computing: bool = False, quota_limited: bool = False, accessed: Optional[Set[str]] = None) +class posthog.feature_flags.ConditionMatch +class posthog.feature_flags.InconclusiveMatchError +class posthog.feature_flags.RequiresServerEvaluation +class posthog.flag_definition_cache.FlagDefinitionCacheData +class posthog.flag_definition_cache.FlagDefinitionCacheProvider +class posthog.integrations.celery.PosthogCeleryIntegration(client: Optional[Client] = None, capture_exceptions: bool = True, capture_task_lifecycle_events: bool = True, propagate_context: bool = True, task_filter: Optional[Callable[[Optional[str], dict[str, Any]], bool]] = None) +class posthog.integrations.django.PosthogContextMiddleware(get_response) +class posthog.poller.Poller(interval, execute, *args, **kwargs) +class posthog.request.APIError(status: Union[int, str], message: str, retry_after: Optional[float] = None) +class posthog.request.DatetimeSerializer +class posthog.request.GetResponse(data: Any, etag: Optional[str] = None, not_modified: bool = False) +class posthog.request.HTTPAdapterWithSocketOptions(*args, socket_options: Optional[SocketOptions] = None, **kwargs) +class posthog.request.QuotaLimitError +class posthog.types.FeatureFlag(key: str, enabled: bool, variant: Optional[str], reason: Optional[FlagReason], metadata: Union[FlagMetadata, LegacyFlagMetadata]) +class posthog.types.FeatureFlagError +class posthog.types.FeatureFlagResult(key: str, enabled: bool, variant: Optional[str], payload: Optional[Any], reason: Optional[str]) +class posthog.types.FlagMetadata(id: int, payload: Optional[str], version: int, description: str) +class posthog.types.FlagReason(code: str, condition_index: Optional[int], description: str) +class posthog.types.FlagsAndPayloads +class posthog.types.FlagsResponse +class posthog.types.LegacyFlagMetadata(payload: Any) +class posthog.types.SendFeatureFlagsOptions +class posthog.utils.FlagCache(max_size=CACHE_MAX_SIZE, default_ttl=CACHE_TTL) +class posthog.utils.FlagCacheEntry(flag_result, flag_definition_version, timestamp=None) +class posthog.utils.RedisFlagCache(redis_client, default_ttl=CACHE_TTL, stale_ttl=CACHE_STALE_TTL, key_prefix=CACHE_KEY_PREFIX) +class posthog.utils.SizeLimitedDict(max_size, *args, **kwargs) +function posthog.ai.anthropic.anthropic_converter.extract_anthropic_stop_reason(response: Any) -> Optional[str] +function posthog.ai.anthropic.anthropic_converter.extract_anthropic_tools(kwargs: Dict[str, Any]) -> Optional[Any] +function posthog.ai.anthropic.anthropic_converter.extract_anthropic_usage_from_event(event: Any) -> TokenUsage +function posthog.ai.anthropic.anthropic_converter.extract_anthropic_usage_from_response(response: Any) -> TokenUsage +function posthog.ai.anthropic.anthropic_converter.extract_anthropic_web_search_count(response: Any) -> int +function posthog.ai.anthropic.anthropic_converter.finalize_anthropic_tool_input(event: Any, content_blocks: List[StreamingContentBlock], tools_in_progress: Dict[str, ToolInProgress]) -> None +function posthog.ai.anthropic.anthropic_converter.format_anthropic_input(messages: List[Dict[str, Any]], system: Optional[str] = None) -> List[FormattedMessage] +function posthog.ai.anthropic.anthropic_converter.format_anthropic_response(response: Any) -> List[FormattedMessage] +function posthog.ai.anthropic.anthropic_converter.format_anthropic_streaming_content(content_blocks: List[StreamingContentBlock]) -> List[FormattedContentItem] +function posthog.ai.anthropic.anthropic_converter.format_anthropic_streaming_input(kwargs: Dict[str, Any]) -> Any +function posthog.ai.anthropic.anthropic_converter.format_anthropic_streaming_output_complete(content_blocks: List[StreamingContentBlock], accumulated_content: str) -> List[FormattedMessage] +function posthog.ai.anthropic.anthropic_converter.handle_anthropic_content_block_start(event: Any) -> Tuple[Optional[StreamingContentBlock], Optional[ToolInProgress]] +function posthog.ai.anthropic.anthropic_converter.handle_anthropic_text_delta(event: Any, current_block: Optional[StreamingContentBlock]) -> Optional[str] +function posthog.ai.anthropic.anthropic_converter.handle_anthropic_tool_delta(event: Any, content_blocks: List[StreamingContentBlock], tools_in_progress: Dict[str, ToolInProgress]) -> None +function posthog.ai.claude_agent_sdk.instrument(client: Optional[Client] = None, distinct_id: Optional[Union[str, Callable[[ResultMessage], Optional[str]]]] = None, privacy_mode: bool = False, groups: Optional[Dict[str, Any]] = None, properties: Optional[Dict[str, Any]] = None) -> PostHogClaudeAgentProcessor +function posthog.ai.claude_agent_sdk.query(*, prompt: Any, options: Optional[ClaudeAgentOptions] = None, transport: Any = None, posthog_client: Optional[Client] = None, posthog_distinct_id: Optional[Union[str, Callable[[ResultMessage], Optional[str]]]] = None, posthog_trace_id: Optional[str] = None, posthog_properties: Optional[Dict[str, Any]] = None, posthog_privacy_mode: bool = False, posthog_groups: Optional[Dict[str, Any]] = None) +function posthog.ai.gateway.is_posthog_ai_gateway_url(base_url: Any) -> bool +function posthog.ai.gateway.warn_if_posthog_ai_gateway(base_url: Any) -> None +function posthog.ai.gateway.warn_if_posthog_ai_gateway_otel_attributes(attributes: Optional[Mapping[str, Any]]) -> None +function posthog.ai.gemini.gemini_converter.extract_gemini_content_from_chunk(chunk: Any) -> Optional[Dict[str, Any]] +function posthog.ai.gemini.gemini_converter.extract_gemini_embedding_token_count(response) -> int +function posthog.ai.gemini.gemini_converter.extract_gemini_stop_reason(response: Any) -> Optional[str] +function posthog.ai.gemini.gemini_converter.extract_gemini_stop_reason_from_chunk(chunk: Any) -> Optional[str] +function posthog.ai.gemini.gemini_converter.extract_gemini_system_instruction(config: Any) -> Optional[str] +function posthog.ai.gemini.gemini_converter.extract_gemini_tools(kwargs: Dict[str, Any]) -> Optional[Any] +function posthog.ai.gemini.gemini_converter.extract_gemini_usage_from_chunk(chunk: Any) -> TokenUsage +function posthog.ai.gemini.gemini_converter.extract_gemini_usage_from_response(response: Any) -> TokenUsage +function posthog.ai.gemini.gemini_converter.extract_gemini_web_search_count(response: Any) -> int +function posthog.ai.gemini.gemini_converter.format_gemini_input(contents: Any) -> List[FormattedMessage] +function posthog.ai.gemini.gemini_converter.format_gemini_input_with_system(contents: Any, config: Any = None) -> List[FormattedMessage] +function posthog.ai.gemini.gemini_converter.format_gemini_response(response: Any) -> List[FormattedMessage] +function posthog.ai.gemini.gemini_converter.format_gemini_streaming_output(accumulated_content: Union[str, List[Any]]) -> List[FormattedMessage] +function posthog.ai.openai.openai_converter.accumulate_openai_tool_calls(accumulated_tool_calls: Dict[int, Dict[str, Any]], chunk_tool_calls: List[Dict[str, Any]]) -> None +function posthog.ai.openai.openai_converter.extract_openai_content_from_chunk(chunk: Any, provider_type: str = 'chat') -> Optional[str] +function posthog.ai.openai.openai_converter.extract_openai_stop_reason(response: Any) -> Optional[str] +function posthog.ai.openai.openai_converter.extract_openai_tool_calls_from_chunk(chunk: Any) -> Optional[List[Dict[str, Any]]] +function posthog.ai.openai.openai_converter.extract_openai_tools(kwargs: Dict[str, Any]) -> Optional[Any] +function posthog.ai.openai.openai_converter.extract_openai_usage_from_chunk(chunk: Any, provider_type: str = 'chat') -> TokenUsage +function posthog.ai.openai.openai_converter.extract_openai_usage_from_response(response: Any) -> TokenUsage +function posthog.ai.openai.openai_converter.extract_openai_web_search_count(response: Any) -> int +function posthog.ai.openai.openai_converter.format_openai_input(messages: Optional[List[Dict[str, Any]]] = None, input_data: Optional[Any] = None) -> List[FormattedMessage] +function posthog.ai.openai.openai_converter.format_openai_response(response: Any) -> List[FormattedMessage] +function posthog.ai.openai.openai_converter.format_openai_streaming_content(accumulated_content: str, tool_calls: Optional[List[Dict[str, Any]]] = None) -> List[FormattedContentItem] +function posthog.ai.openai.openai_converter.format_openai_streaming_input(kwargs: Dict[str, Any], api_type: str = 'chat') -> Any +function posthog.ai.openai.openai_converter.format_openai_streaming_output(accumulated_content: Any, provider_type: str = 'chat', tool_calls: Optional[List[Dict[str, Any]]] = None) -> List[FormattedMessage] +function posthog.ai.openai.wrapper_utils.reset_fallback_warnings() -> None +function posthog.ai.openai.wrapper_utils.warn_on_fallback(wrapper_name: str, name: str) -> None +function posthog.ai.openai_agents.instrument(client: Optional[Client] = None, distinct_id: Optional[Union[str, Callable[[Trace], Optional[str]]]] = None, privacy_mode: bool = False, groups: Optional[Dict[str, Any]] = None, properties: Optional[Dict[str, Any]] = None) -> PostHogTracingProcessor +function posthog.ai.otel.spans.is_ai_span(span: ReadableSpan) -> bool +function posthog.ai.sanitization.is_base64_data_url(text: str) -> bool +function posthog.ai.sanitization.is_raw_base64(text: str) -> bool +function posthog.ai.sanitization.is_valid_url(text: str) -> bool +function posthog.ai.sanitization.process_gemini_item(item: Any) -> Any +function posthog.ai.sanitization.process_messages(messages: Any, transform_content_func) -> Any +function posthog.ai.sanitization.redact_base64_data_url(value: Any) -> Any +function posthog.ai.sanitization.sanitize_anthropic(data: Any) -> Any +function posthog.ai.sanitization.sanitize_anthropic_image(item: Any) -> Any +function posthog.ai.sanitization.sanitize_gemini(data: Any) -> Any +function posthog.ai.sanitization.sanitize_gemini_part(part: Any) -> Any +function posthog.ai.sanitization.sanitize_langchain(data: Any) -> Any +function posthog.ai.sanitization.sanitize_langchain_image(item: Any) -> Any +function posthog.ai.sanitization.sanitize_openai(data: Any) -> Any +function posthog.ai.sanitization.sanitize_openai_image(item: Any) -> Any +function posthog.ai.sanitization.sanitize_openai_response(data: Any) -> Any +function posthog.ai.sanitization.sanitize_openai_response_image(item: Any) -> Any +function posthog.ai.utils.call_llm_and_track_usage(posthog_distinct_id: Optional[str], ph_client: PostHogClient, provider: str, posthog_trace_id: Optional[str], posthog_properties: Optional[Dict[str, Any]], posthog_privacy_mode: bool, posthog_groups: Optional[Dict[str, Any]], base_url: str, call_method: Callable[..., Any], **kwargs: Any) -> Any +function posthog.ai.utils.call_llm_and_track_usage_async(posthog_distinct_id: Optional[str], ph_client: PostHogClient, provider: str, posthog_trace_id: Optional[str], posthog_properties: Optional[Dict[str, Any]], posthog_privacy_mode: bool, posthog_groups: Optional[Dict[str, Any]], base_url: str, call_async_method: Callable[..., Any], **kwargs: Any) -> Any +function posthog.ai.utils.capture_streaming_event(ph_client: PostHogClient, event_data: StreamingEventData) +function posthog.ai.utils.extract_available_tool_calls(provider: str, kwargs: Dict[str, Any]) +function posthog.ai.utils.extract_stop_reason(response: Any, provider: str) -> Optional[str] +function posthog.ai.utils.format_response(response, provider: str) +function posthog.ai.utils.get_model_params(kwargs: Dict[str, Any]) -> Dict[str, Any] +function posthog.ai.utils.get_usage(response, provider: str) -> TokenUsage +function posthog.ai.utils.merge_system_prompt(kwargs: Dict[str, Any], provider: str) -> List[FormattedMessage] +function posthog.ai.utils.merge_usage_stats(target: TokenUsage, source: TokenUsage, mode: str = 'incremental') -> None +function posthog.ai.utils.sanitize_messages(data: Any, provider: str) -> Any +function posthog.ai.utils.serialize_raw_usage(raw_usage: Any) -> Optional[Dict[str, Any]] +function posthog.ai.utils.with_privacy_mode(ph_client: PostHogClient, privacy_mode: bool, value: Any) +function posthog.alias(previous_id, distinct_id, timestamp=None, uuid=None, disable_geoip=None) +function posthog.capture(event: str, **kwargs: Unpack[OptionalCaptureArgs]) -> Optional[str] +function posthog.capture_exception(exception: Optional[ExceptionArg] = None, **kwargs: Unpack[OptionalCaptureArgs]) -> Optional[str] +function posthog.client.add_context_tags(properties) +function posthog.client.get_identity_state(passed) -> tuple[str, bool] +function posthog.client.no_throw(default_return=None) +function posthog.client.stringify_id(val) +function posthog.contexts.get_capture_exception_code_variables_context() -> Optional[bool] +function posthog.contexts.get_code_variables_ignore_patterns_context() -> Optional[list] +function posthog.contexts.get_code_variables_mask_patterns_context() -> Optional[list] +function posthog.contexts.get_context_device_id() -> Optional[str] +function posthog.contexts.get_context_distinct_id() -> Optional[str] +function posthog.contexts.get_context_session_id() -> Optional[str] +function posthog.contexts.get_tags() -> Dict[str, Any] +function posthog.contexts.identify_context(distinct_id: str) -> None +function posthog.contexts.new_context(fresh: bool = False, capture_exceptions: bool = True, client: Optional[Client] = None) +function posthog.contexts.scoped(fresh: bool = False, capture_exceptions: bool = True) +function posthog.contexts.set_capture_exception_code_variables_context(enabled: bool) -> None +function posthog.contexts.set_code_variables_ignore_patterns_context(ignore_patterns: list) -> None +function posthog.contexts.set_code_variables_mask_patterns_context(mask_patterns: list) -> None +function posthog.contexts.set_context_device_id(device_id: str) -> None +function posthog.contexts.set_context_session(session_id: str) -> None +function posthog.contexts.tag(key: str, value: Any) -> None +function posthog.evaluate_flags(distinct_id=None, groups=None, person_properties=None, group_properties=None, only_evaluate_locally=False, disable_geoip=None, flag_keys=None, device_id=None) -> FeatureFlagEvaluations +function posthog.exception_utils.attach_code_variables_to_frames(all_exceptions, exc_info, mask_patterns, ignore_patterns) +function posthog.exception_utils.construct_artificial_traceback(e) +function posthog.exception_utils.event_hint_with_exc_info(exc_info=None) +function posthog.exception_utils.exc_info_from_error(error) +function posthog.exception_utils.exception_is_already_captured(error) +function posthog.exception_utils.exceptions_from_error(exc_type, exc_value, tb, mechanism=None, exception_id=0, parent_id=0, source=None) +function posthog.exception_utils.exceptions_from_error_tuple(exc_info, mechanism=None) +function posthog.exception_utils.filename_for_module(module, abs_path) +function posthog.exception_utils.format_timestamp(value) +function posthog.exception_utils.get_errno(exc_value) +function posthog.exception_utils.get_error_message(exc_value) +function posthog.exception_utils.get_lines_from_file(filename, lineno, max_length=None, loader=None, module=None) +function posthog.exception_utils.get_source_context(frame, tb_lineno, max_value_length=None) +function posthog.exception_utils.get_type_module(cls) +function posthog.exception_utils.get_type_name(cls) +function posthog.exception_utils.handle_in_app(event, in_app_exclude=None, in_app_include=None, project_root=None) +function posthog.exception_utils.iter_event_frames(event) +function posthog.exception_utils.iter_event_stacktraces(event) +function posthog.exception_utils.iter_stacks(tb) +function posthog.exception_utils.mark_exception_as_captured(error, uuid) +function posthog.exception_utils.safe_repr(value) +function posthog.exception_utils.safe_str(value) +function posthog.exception_utils.serialize_code_variables(frame, limiter, mask_patterns=None, ignore_patterns=None, max_length=1024) +function posthog.exception_utils.serialize_frame(frame, tb_lineno=None, max_value_length=None) +function posthog.exception_utils.set_in_app_in_frames(frames, in_app_exclude, in_app_include, project_root=None) +function posthog.exception_utils.should_hide_frame(frame: FrameType) -> bool +function posthog.exception_utils.single_exception_from_error_tuple(exc_type, exc_value, tb, mechanism=None, exception_id=None, parent_id=None, source=None) +function posthog.exception_utils.strip_string(value, max_length=None) +function posthog.exception_utils.to_string(value) +function posthog.exception_utils.to_timestamp(value) +function posthog.exception_utils.try_attach_code_variables_to_frames(all_exceptions, exc_info, mask_patterns, ignore_patterns) +function posthog.exception_utils.walk_exception_chain(exc_info) +function posthog.feature_enabled(key, distinct_id, groups=None, person_properties=None, group_properties=None, only_evaluate_locally=False, send_feature_flag_events=True, disable_geoip=None, device_id=None) +function posthog.feature_flag_definitions() +function posthog.feature_flags.evaluate_flag_dependency(property, flags_by_key, evaluation_cache, distinct_id, properties, cohort_properties, device_id=None) +function posthog.feature_flags.get_matching_variant(flag, bucketing_value) +function posthog.feature_flags.is_condition_match(feature_flag, distinct_id, condition, properties, cohort_properties, flags_by_key=None, evaluation_cache=None, *, bucketing_value, device_id=None) -> ConditionMatch +function posthog.feature_flags.match_cohort(property, property_values, cohort_properties, flags_by_key=None, evaluation_cache=None, distinct_id=None, device_id=None) -> bool +function posthog.feature_flags.match_feature_flag_properties(flag, distinct_id, properties, *, cohort_properties=None, flags_by_key=None, evaluation_cache=None, device_id=None, bucketing_value=None, group_type_mapping=None, groups=None, group_properties=None) -> FlagValue +function posthog.feature_flags.match_property(property, property_values) -> bool +function posthog.feature_flags.match_property_group(property_group, property_values, cohort_properties, flags_by_key=None, evaluation_cache=None, distinct_id=None, device_id=None) -> bool +function posthog.feature_flags.matches_dependency_value(expected_value, actual_value) +function posthog.feature_flags.parse_datetime(value: str) -> datetime.datetime +function posthog.feature_flags.parse_semver(value: str) -> tuple +function posthog.feature_flags.relative_date_parse_for_feature_flag_matching(value: str) -> Optional[datetime.datetime] +function posthog.feature_flags.resolve_bucketing_value(flag, distinct_id, device_id=None) +function posthog.feature_flags.variant_lookup_table(feature_flag) +function posthog.flush() -> None +function posthog.get_all_flags(distinct_id, groups=None, person_properties=None, group_properties=None, only_evaluate_locally=False, disable_geoip=None, device_id=None, flag_keys_to_evaluate=None) -> Optional[dict[str, FeatureFlag]] +function posthog.get_all_flags_and_payloads(distinct_id, groups=None, person_properties=None, group_properties=None, only_evaluate_locally=False, disable_geoip=None, device_id=None, flag_keys_to_evaluate=None) -> FlagsAndPayloads +function posthog.get_feature_flag(key, distinct_id, groups=None, person_properties=None, group_properties=None, only_evaluate_locally=False, send_feature_flag_events=True, disable_geoip=None, device_id=None) -> Optional[FeatureFlag] +function posthog.get_feature_flag_payload(key, distinct_id, match_value=None, groups=None, person_properties=None, group_properties=None, only_evaluate_locally=False, send_feature_flag_events=True, disable_geoip=None, device_id=None) -> Optional[str] +function posthog.get_feature_flag_result(key, distinct_id, groups=None, person_properties=None, group_properties=None, only_evaluate_locally=False, send_feature_flag_events=True, disable_geoip=None, device_id=None) +function posthog.get_remote_config_payload(key) +function posthog.get_tags() -> Dict[str, Any] +function posthog.group_identify(group_type, group_key, properties=None, timestamp=None, uuid=None, disable_geoip=None, distinct_id=None) +function posthog.identify_context(distinct_id: str) +function posthog.integrations.django.markcoroutinefunction(func) +function posthog.join() -> None +function posthog.load_feature_flags() +function posthog.new_context(fresh: bool = False, capture_exceptions: bool = True, client: Optional[Client] = None) +function posthog.request.batch_post(api_key: str, host: Optional[str] = None, gzip: bool = False, timeout: int = 15, path: str = EVENTS_ENDPOINT, **kwargs) -> requests.Response +function posthog.request.determine_server_host(host: Optional[str]) -> str +function posthog.request.disable_connection_reuse() -> None +function posthog.request.enable_keep_alive() -> None +function posthog.request.flags(api_key: str, host: Optional[str] = None, gzip: bool = False, timeout: int = 15, **kwargs) -> Any +function posthog.request.get(api_key: str, url: str, host: Optional[str] = None, timeout: Optional[int] = None, etag: Optional[str] = None) -> GetResponse +function posthog.request.is_ai_event(event_name) -> bool +function posthog.request.normalize_host(host: Optional[str]) -> str +function posthog.request.post(api_key: str, host: Optional[str] = None, path: Optional[str] = None, gzip: bool = False, timeout: int = 15, session: Optional[requests.Session] = None, **kwargs) -> requests.Response +function posthog.request.remote_config(personal_api_key: str, project_api_key: str, host: Optional[str] = None, key: str = '', timeout: int = 15) -> Any +function posthog.request.reset_sessions() -> None +function posthog.request.set_socket_options(socket_options: Optional[SocketOptions]) -> None +function posthog.scoped(fresh=False, capture_exceptions=True) +function posthog.set(**kwargs: Unpack[OptionalSetArgs]) -> Optional[str] +function posthog.set_capture_exception_code_variables_context(enabled: bool) +function posthog.set_code_variables_ignore_patterns_context(ignore_patterns: list) +function posthog.set_code_variables_mask_patterns_context(mask_patterns: list) +function posthog.set_context_device_id(device_id: str) +function posthog.set_context_session(session_id: str) +function posthog.set_once(**kwargs: Unpack[OptionalSetArgs]) -> Optional[str] +function posthog.setup() -> Client +function posthog.shutdown() -> None +function posthog.tag(name: str, value: Any) +function posthog.types.normalize_flags_response(resp: Any) -> FlagsResponse +function posthog.types.to_flags_and_payloads(resp: FlagsResponse) -> FlagsAndPayloads +function posthog.types.to_payloads(response: FlagsResponse) -> Optional[dict[str, str]] +function posthog.types.to_values(response: FlagsResponse) -> Optional[dict[str, FlagValue]] +function posthog.utils.clean(item) +function posthog.utils.convert_to_datetime_aware(date_obj) +function posthog.utils.get_os_info() +function posthog.utils.guess_timezone(dt: datetime) -> datetime +function posthog.utils.is_naive(dt: datetime) -> bool +function posthog.utils.is_valid_regex(value) -> bool +function posthog.utils.remove_trailing_slash(host: str) -> str +function posthog.utils.str_icontains(source, search) +function posthog.utils.str_iequals(value, comparand) +function posthog.utils.system_context() -> dict[str, Any] +function posthog.utils.total_seconds(delta: timedelta) -> float +method posthog.ai.anthropic.anthropic.WrappedMessages.create(posthog_distinct_id: Optional[str] = None, posthog_trace_id: Optional[str] = None, posthog_properties: Optional[Dict[str, Any]] = None, posthog_privacy_mode: bool = False, posthog_groups: Optional[Dict[str, Any]] = None, **kwargs: Any) +method posthog.ai.anthropic.anthropic.WrappedMessages.stream(posthog_distinct_id: Optional[str] = None, posthog_trace_id: Optional[str] = None, posthog_properties: Optional[Dict[str, Any]] = None, posthog_privacy_mode: bool = False, posthog_groups: Optional[Dict[str, Any]] = None, **kwargs: Any) +method posthog.ai.anthropic.anthropic_async.AsyncWrappedMessages.create(posthog_distinct_id: Optional[str] = None, posthog_trace_id: Optional[str] = None, posthog_properties: Optional[Dict[str, Any]] = None, posthog_privacy_mode: bool = False, posthog_groups: Optional[Dict[str, Any]] = None, **kwargs: Any) +method posthog.ai.anthropic.anthropic_async.AsyncWrappedMessages.stream(posthog_distinct_id: Optional[str] = None, posthog_trace_id: Optional[str] = None, posthog_properties: Optional[Dict[str, Any]] = None, posthog_privacy_mode: bool = False, posthog_groups: Optional[Dict[str, Any]] = None, **kwargs: Any) +method posthog.ai.claude_agent_sdk.client.PostHogClaudeSDKClient.connect(prompt: Any = None) -> None +method posthog.ai.claude_agent_sdk.client.PostHogClaudeSDKClient.disconnect() -> None +method posthog.ai.claude_agent_sdk.client.PostHogClaudeSDKClient.interrupt() -> None +method posthog.ai.claude_agent_sdk.client.PostHogClaudeSDKClient.query(prompt: str, session_id: str = 'default') -> None +method posthog.ai.claude_agent_sdk.client.PostHogClaudeSDKClient.receive_response() +method posthog.ai.claude_agent_sdk.client.PostHogClaudeSDKClient.set_model(model: Optional[str] = None) -> None +method posthog.ai.claude_agent_sdk.client.PostHogClaudeSDKClient.set_permission_mode(mode: str) -> None +method posthog.ai.claude_agent_sdk.processor.PostHogClaudeAgentProcessor.query(*, prompt: Any, options: Optional[ClaudeAgentOptions] = None, transport: Any = None, posthog_distinct_id: Optional[Union[str, Callable[[ResultMessage], Optional[str]]]] = None, posthog_trace_id: Optional[str] = None, posthog_properties: Optional[Dict[str, Any]] = None, posthog_privacy_mode: Optional[bool] = None, posthog_groups: Optional[Dict[str, Any]] = None) +method posthog.ai.gemini.gemini.Models.embed_content(model: str, contents, posthog_distinct_id: Optional[str] = None, posthog_trace_id: Optional[str] = None, posthog_properties: Optional[Dict[str, Any]] = None, posthog_privacy_mode: Optional[bool] = None, posthog_groups: Optional[Dict[str, Any]] = None, **kwargs: Any) +method posthog.ai.gemini.gemini.Models.generate_content(model: str, contents, posthog_distinct_id: Optional[str] = None, posthog_trace_id: Optional[str] = None, posthog_properties: Optional[Dict[str, Any]] = None, posthog_privacy_mode: Optional[bool] = None, posthog_groups: Optional[Dict[str, Any]] = None, **kwargs: Any) +method posthog.ai.gemini.gemini.Models.generate_content_stream(model: str, contents, posthog_distinct_id: Optional[str] = None, posthog_trace_id: Optional[str] = None, posthog_properties: Optional[Dict[str, Any]] = None, posthog_privacy_mode: Optional[bool] = None, posthog_groups: Optional[Dict[str, Any]] = None, **kwargs: Any) +method posthog.ai.gemini.gemini_async.AsyncModels.embed_content(model: str, contents, posthog_distinct_id: Optional[str] = None, posthog_trace_id: Optional[str] = None, posthog_properties: Optional[Dict[str, Any]] = None, posthog_privacy_mode: Optional[bool] = None, posthog_groups: Optional[Dict[str, Any]] = None, **kwargs: Any) +method posthog.ai.gemini.gemini_async.AsyncModels.generate_content(model: str, contents, posthog_distinct_id: Optional[str] = None, posthog_trace_id: Optional[str] = None, posthog_properties: Optional[Dict[str, Any]] = None, posthog_privacy_mode: Optional[bool] = None, posthog_groups: Optional[Dict[str, Any]] = None, **kwargs: Any) +method posthog.ai.gemini.gemini_async.AsyncModels.generate_content_stream(model: str, contents, posthog_distinct_id: Optional[str] = None, posthog_trace_id: Optional[str] = None, posthog_properties: Optional[Dict[str, Any]] = None, posthog_privacy_mode: Optional[bool] = None, posthog_groups: Optional[Dict[str, Any]] = None, **kwargs: Any) +method posthog.ai.langchain.callbacks.CallbackHandler.on_agent_action(action: AgentAction, *, run_id: UUID, parent_run_id: Optional[UUID] = None, **kwargs: Any) -> Any +method posthog.ai.langchain.callbacks.CallbackHandler.on_agent_finish(finish: AgentFinish, *, run_id: UUID, parent_run_id: Optional[UUID] = None, **kwargs: Any) -> Any +method posthog.ai.langchain.callbacks.CallbackHandler.on_chain_end(outputs: Dict[str, Any], *, run_id: UUID, parent_run_id: Optional[UUID] = None, **kwargs: Any) +method posthog.ai.langchain.callbacks.CallbackHandler.on_chain_error(error: BaseException, *, run_id: UUID, parent_run_id: Optional[UUID] = None, **kwargs: Any) +method posthog.ai.langchain.callbacks.CallbackHandler.on_chain_start(serialized: Dict[str, Any], inputs: Dict[str, Any], *, run_id: UUID, parent_run_id: Optional[UUID] = None, metadata: Optional[Dict[str, Any]] = None, **kwargs) +method posthog.ai.langchain.callbacks.CallbackHandler.on_chat_model_start(serialized: Dict[str, Any], messages: List[List[BaseMessage]], *, run_id: UUID, parent_run_id: Optional[UUID] = None, **kwargs) +method posthog.ai.langchain.callbacks.CallbackHandler.on_llm_end(response: LLMResult, *, run_id: UUID, parent_run_id: Optional[UUID] = None, **kwargs: Any) +method posthog.ai.langchain.callbacks.CallbackHandler.on_llm_error(error: BaseException, *, run_id: UUID, parent_run_id: Optional[UUID] = None, **kwargs: Any) +method posthog.ai.langchain.callbacks.CallbackHandler.on_llm_new_token(token: str, *, run_id: UUID, parent_run_id: Optional[UUID] = None, **kwargs: Any) -> Any +method posthog.ai.langchain.callbacks.CallbackHandler.on_llm_start(serialized: Dict[str, Any], prompts: List[str], *, run_id: UUID, parent_run_id: Optional[UUID] = None, **kwargs: Any) +method posthog.ai.langchain.callbacks.CallbackHandler.on_retriever_end(documents: Sequence[Document], *, run_id: UUID, parent_run_id: Optional[UUID] = None, **kwargs: Any) +method posthog.ai.langchain.callbacks.CallbackHandler.on_retriever_error(error: BaseException, *, run_id: UUID, parent_run_id: Optional[UUID] = None, tags: Optional[list[str]] = None, **kwargs: Any) -> Any +method posthog.ai.langchain.callbacks.CallbackHandler.on_retriever_start(serialized: Optional[Dict[str, Any]], query: str, *, run_id: UUID, parent_run_id: Optional[UUID] = None, metadata: Optional[Dict[str, Any]] = None, **kwargs: Any) -> Any +method posthog.ai.langchain.callbacks.CallbackHandler.on_tool_end(output: str, *, run_id: UUID, parent_run_id: Optional[UUID] = None, **kwargs: Any) -> Any +method posthog.ai.langchain.callbacks.CallbackHandler.on_tool_error(error: BaseException, *, run_id: UUID, parent_run_id: Optional[UUID] = None, tags: Optional[list[str]] = None, **kwargs: Any) -> Any +method posthog.ai.langchain.callbacks.CallbackHandler.on_tool_start(serialized: Optional[Dict[str, Any]], input_str: str, *, run_id: UUID, parent_run_id: Optional[UUID] = None, metadata: Optional[Dict[str, Any]] = None, **kwargs: Any) -> Any +method posthog.ai.openai.openai.WrappedBetaCompletions.parse(posthog_distinct_id: Optional[str] = None, posthog_trace_id: Optional[str] = None, posthog_properties: Optional[Dict[str, Any]] = None, posthog_privacy_mode: bool = False, posthog_groups: Optional[Dict[str, Any]] = None, **kwargs: Any) +method posthog.ai.openai.openai.WrappedCompletions.create(posthog_distinct_id: Optional[str] = None, posthog_trace_id: Optional[str] = None, posthog_properties: Optional[Dict[str, Any]] = None, posthog_privacy_mode: bool = False, posthog_groups: Optional[Dict[str, Any]] = None, **kwargs: Any) +method posthog.ai.openai.openai.WrappedCompletions.parse(posthog_distinct_id: Optional[str] = None, posthog_trace_id: Optional[str] = None, posthog_properties: Optional[Dict[str, Any]] = None, posthog_privacy_mode: bool = False, posthog_groups: Optional[Dict[str, Any]] = None, **kwargs: Any) +method posthog.ai.openai.openai.WrappedEmbeddings.create(posthog_distinct_id: Optional[str] = None, posthog_trace_id: Optional[str] = None, posthog_properties: Optional[Dict[str, Any]] = None, posthog_privacy_mode: bool = False, posthog_groups: Optional[Dict[str, Any]] = None, **kwargs: Any) +method posthog.ai.openai.openai.WrappedResponses.create(posthog_distinct_id: Optional[str] = None, posthog_trace_id: Optional[str] = None, posthog_properties: Optional[Dict[str, Any]] = None, posthog_privacy_mode: bool = False, posthog_groups: Optional[Dict[str, Any]] = None, **kwargs: Any) +method posthog.ai.openai.openai.WrappedResponses.parse(posthog_distinct_id: Optional[str] = None, posthog_trace_id: Optional[str] = None, posthog_properties: Optional[Dict[str, Any]] = None, posthog_privacy_mode: bool = False, posthog_groups: Optional[Dict[str, Any]] = None, **kwargs: Any) +method posthog.ai.openai.openai_async.WrappedBetaCompletions.parse(posthog_distinct_id: Optional[str] = None, posthog_trace_id: Optional[str] = None, posthog_properties: Optional[Dict[str, Any]] = None, posthog_privacy_mode: bool = False, posthog_groups: Optional[Dict[str, Any]] = None, **kwargs: Any) +method posthog.ai.openai.openai_async.WrappedCompletions.create(posthog_distinct_id: Optional[str] = None, posthog_trace_id: Optional[str] = None, posthog_properties: Optional[Dict[str, Any]] = None, posthog_privacy_mode: bool = False, posthog_groups: Optional[Dict[str, Any]] = None, **kwargs: Any) +method posthog.ai.openai.openai_async.WrappedCompletions.parse(posthog_distinct_id: Optional[str] = None, posthog_trace_id: Optional[str] = None, posthog_properties: Optional[Dict[str, Any]] = None, posthog_privacy_mode: bool = False, posthog_groups: Optional[Dict[str, Any]] = None, **kwargs: Any) +method posthog.ai.openai.openai_async.WrappedEmbeddings.create(posthog_distinct_id: Optional[str] = None, posthog_trace_id: Optional[str] = None, posthog_properties: Optional[Dict[str, Any]] = None, posthog_privacy_mode: bool = False, posthog_groups: Optional[Dict[str, Any]] = None, **kwargs: Any) +method posthog.ai.openai.openai_async.WrappedResponses.create(posthog_distinct_id: Optional[str] = None, posthog_trace_id: Optional[str] = None, posthog_properties: Optional[Dict[str, Any]] = None, posthog_privacy_mode: bool = False, posthog_groups: Optional[Dict[str, Any]] = None, **kwargs: Any) +method posthog.ai.openai.openai_async.WrappedResponses.parse(posthog_distinct_id: Optional[str] = None, posthog_trace_id: Optional[str] = None, posthog_properties: Optional[Dict[str, Any]] = None, posthog_privacy_mode: bool = False, posthog_groups: Optional[Dict[str, Any]] = None, **kwargs: Any) +method posthog.ai.openai_agents.processor.PostHogTracingProcessor.force_flush() -> None +method posthog.ai.openai_agents.processor.PostHogTracingProcessor.on_span_end(span: Span[Any]) -> None +method posthog.ai.openai_agents.processor.PostHogTracingProcessor.on_span_start(span: Span[Any]) -> None +method posthog.ai.openai_agents.processor.PostHogTracingProcessor.on_trace_end(trace: Trace) -> None +method posthog.ai.openai_agents.processor.PostHogTracingProcessor.on_trace_start(trace: Trace) -> None +method posthog.ai.openai_agents.processor.PostHogTracingProcessor.shutdown() -> None +method posthog.ai.otel.exporter.PostHogTraceExporter.export(spans: Sequence[ReadableSpan]) -> SpanExportResult +method posthog.ai.otel.exporter.PostHogTraceExporter.force_flush(timeout_millis: Optional[int] = None) -> bool +method posthog.ai.otel.exporter.PostHogTraceExporter.shutdown() -> None +method posthog.ai.otel.processor.PostHogSpanProcessor.force_flush(timeout_millis: Optional[int] = None) -> bool +method posthog.ai.otel.processor.PostHogSpanProcessor.on_end(span: ReadableSpan) -> None +method posthog.ai.otel.processor.PostHogSpanProcessor.on_start(span: Span, parent_context: Optional[Context] = None) -> None +method posthog.ai.otel.processor.PostHogSpanProcessor.shutdown() -> None +method posthog.ai.prompts.Prompts.clear_cache(name: Optional[str] = None, *, version: Optional[int] = None) -> None +method posthog.ai.prompts.Prompts.compile(prompt: str, variables: PromptVariables) -> str +method posthog.ai.prompts.Prompts.get(name: str, *, with_metadata: Optional[bool] = None, cache_ttl_seconds: Optional[int] = None, fallback: Optional[str] = None, version: Optional[int] = None) -> Union[str, PromptResult] +method posthog.bucketed_rate_limiter.BucketedRateLimiter.consume_rate_limit(key: Hashable) -> bool +method posthog.bucketed_rate_limiter.BucketedRateLimiter.stop() -> None +method posthog.client.Client.alias(previous_id: str, distinct_id: Optional[str], timestamp=None, uuid=None, disable_geoip=None) +method posthog.client.Client.capture(event: str, **kwargs: Unpack[OptionalCaptureArgs]) -> Optional[str] +method posthog.client.Client.capture_exception(exception: Optional[ExceptionArg], **kwargs: Unpack[OptionalCaptureArgs]) -> Optional[str] +method posthog.client.Client.evaluate_flags(distinct_id: Optional[ID_TYPES] = None, *, groups: Optional[Dict[str, str]] = None, person_properties: Optional[Dict[str, Any]] = None, group_properties: Optional[Dict[str, Dict[str, Any]]] = None, only_evaluate_locally: bool = False, disable_geoip: Optional[bool] = None, flag_keys: Optional[List[str]] = None, device_id: Optional[str] = None) -> FeatureFlagEvaluations +method posthog.client.Client.feature_enabled(key, distinct_id, *, groups=None, person_properties=None, group_properties=None, only_evaluate_locally=False, send_feature_flag_events=True, disable_geoip=None, device_id: Optional[str] = None) +method posthog.client.Client.feature_flag_definitions() +method posthog.client.Client.flush() -> None +method posthog.client.Client.get_all_flags(distinct_id, *, groups=None, person_properties=None, group_properties=None, only_evaluate_locally=False, disable_geoip=None, flag_keys_to_evaluate: Optional[list[str]] = None, device_id: Optional[str] = None) -> Optional[dict[str, Union[bool, str]]] +method posthog.client.Client.get_all_flags_and_payloads(distinct_id, *, groups=None, person_properties=None, group_properties=None, only_evaluate_locally=False, disable_geoip=None, flag_keys_to_evaluate: Optional[list[str]] = None, device_id: Optional[str] = None) -> FlagsAndPayloads +method posthog.client.Client.get_feature_flag(key, distinct_id, *, groups=None, person_properties=None, group_properties=None, only_evaluate_locally=False, send_feature_flag_events=True, disable_geoip=None, device_id: Optional[str] = None) -> Optional[FlagValue] +method posthog.client.Client.get_feature_flag_payload(key, distinct_id, *, match_value: Optional[FlagValue] = None, groups=None, person_properties=None, group_properties=None, only_evaluate_locally=False, send_feature_flag_events=False, disable_geoip=None, device_id: Optional[str] = None) +method posthog.client.Client.get_feature_flag_result(key, distinct_id, *, groups=None, person_properties=None, group_properties=None, only_evaluate_locally=False, send_feature_flag_events=True, disable_geoip=None, device_id: Optional[str] = None) -> Optional[FeatureFlagResult] +method posthog.client.Client.get_feature_flags_and_payloads(distinct_id, groups=None, person_properties=None, group_properties=None, disable_geoip=None, flag_keys_to_evaluate: Optional[list[str]] = None, device_id: Optional[str] = None) -> FlagsAndPayloads +method posthog.client.Client.get_feature_payloads(distinct_id, groups=None, person_properties=None, group_properties=None, disable_geoip=None, flag_keys_to_evaluate: Optional[list[str]] = None, device_id: Optional[str] = None) -> dict[str, str] +method posthog.client.Client.get_feature_variants(distinct_id, groups=None, person_properties=None, group_properties=None, disable_geoip=None, flag_keys_to_evaluate: Optional[list[str]] = None, device_id: Optional[str] = None) -> dict[str, Union[bool, str]] +method posthog.client.Client.get_flags_decision(distinct_id: Optional[ID_TYPES] = None, groups: Optional[dict] = None, person_properties=None, group_properties=None, disable_geoip=None, flag_keys_to_evaluate: Optional[list[str]] = None, device_id: Optional[str] = None) -> FlagsResponse +method posthog.client.Client.get_remote_config_payload(key: str) +method posthog.client.Client.group_identify(group_type: str, group_key: str, properties: Optional[Dict[str, Any]] = None, timestamp: Optional[Union[datetime, str]] = None, uuid: Optional[str] = None, disable_geoip: Optional[bool] = None, distinct_id: Optional[ID_TYPES] = None) -> Optional[str] +method posthog.client.Client.join() -> None +method posthog.client.Client.load_feature_flags() +method posthog.client.Client.new_context(fresh=False, capture_exceptions=True) +method posthog.client.Client.set(**kwargs: Unpack[OptionalSetArgs]) -> Optional[str] +method posthog.client.Client.set_once(**kwargs: Unpack[OptionalSetArgs]) -> Optional[str] +method posthog.client.Client.shutdown() -> None +method posthog.consumer.Consumer.next() +method posthog.consumer.Consumer.pause() +method posthog.consumer.Consumer.request(batch) +method posthog.consumer.Consumer.run() +method posthog.consumer.Consumer.upload() +method posthog.contexts.ContextScope.add_tag(key: str, value: Any) +method posthog.contexts.ContextScope.collect_tags() -> Dict[str, Any] +method posthog.contexts.ContextScope.get_capture_exception_code_variables() -> Optional[bool] +method posthog.contexts.ContextScope.get_code_variables_ignore_patterns() -> Optional[list] +method posthog.contexts.ContextScope.get_code_variables_mask_patterns() -> Optional[list] +method posthog.contexts.ContextScope.get_device_id() -> Optional[str] +method posthog.contexts.ContextScope.get_distinct_id() -> Optional[str] +method posthog.contexts.ContextScope.get_parent() +method posthog.contexts.ContextScope.get_session_id() -> Optional[str] +method posthog.contexts.ContextScope.set_capture_exception_code_variables(enabled: bool) +method posthog.contexts.ContextScope.set_code_variables_ignore_patterns(ignore_patterns: list) +method posthog.contexts.ContextScope.set_code_variables_mask_patterns(mask_patterns: list) +method posthog.contexts.ContextScope.set_device_id(device_id: str) +method posthog.contexts.ContextScope.set_distinct_id(distinct_id: str) +method posthog.contexts.ContextScope.set_session_id(session_id: str) +method posthog.exception_capture.ExceptionCapture.capture_exception(exception, metadata=None) +method posthog.exception_capture.ExceptionCapture.close() +method posthog.exception_capture.ExceptionCapture.exception_handler(exc_type, exc_value, exc_traceback) +method posthog.exception_capture.ExceptionCapture.exception_receiver(exc_info, extra_properties) +method posthog.exception_capture.ExceptionCapture.thread_exception_handler(args) +method posthog.exception_utils.AnnotatedValue.removed_because_over_size_limit() +method posthog.exception_utils.AnnotatedValue.removed_because_raw_data() +method posthog.exception_utils.AnnotatedValue.substituted_because_contains_sensitive_data() +method posthog.exception_utils.VariableSizeLimiter.add(size) +method posthog.exception_utils.VariableSizeLimiter.can_add(size) +method posthog.exception_utils.VariableSizeLimiter.get_remaining_space() +method posthog.feature_flag_evaluations.FeatureFlagEvaluations.get_flag(key: str) -> Optional[FlagValue] +method posthog.feature_flag_evaluations.FeatureFlagEvaluations.get_flag_payload(key: str) -> Optional[Any] +method posthog.feature_flag_evaluations.FeatureFlagEvaluations.is_enabled(key: str) -> bool +method posthog.feature_flag_evaluations.FeatureFlagEvaluations.only(keys: List[str]) -> FeatureFlagEvaluations +method posthog.feature_flag_evaluations.FeatureFlagEvaluations.only_accessed() -> FeatureFlagEvaluations +method posthog.flag_definition_cache.FlagDefinitionCacheProvider.get_flag_definitions() -> Union[Optional[FlagDefinitionCacheData], Awaitable[Optional[FlagDefinitionCacheData]]] +method posthog.flag_definition_cache.FlagDefinitionCacheProvider.on_flag_definitions_received(data: FlagDefinitionCacheData) -> Optional[Awaitable[None]] +method posthog.flag_definition_cache.FlagDefinitionCacheProvider.should_fetch_flag_definitions() -> Union[bool, Awaitable[bool]] +method posthog.flag_definition_cache.FlagDefinitionCacheProvider.shutdown() -> Optional[Awaitable[None]] +method posthog.integrations.celery.PosthogCeleryIntegration.instrument() -> None +method posthog.integrations.celery.PosthogCeleryIntegration.shutdown() -> None +method posthog.integrations.celery.PosthogCeleryIntegration.uninstrument() -> None +method posthog.integrations.django.PosthogContextMiddleware.aextract_request_user(request) +method posthog.integrations.django.PosthogContextMiddleware.aextract_tags(request) +method posthog.integrations.django.PosthogContextMiddleware.extract_request_user(request) +method posthog.integrations.django.PosthogContextMiddleware.extract_tags(request) +method posthog.integrations.django.PosthogContextMiddleware.process_exception(request, exception) +method posthog.poller.Poller.run() +method posthog.poller.Poller.stop() +method posthog.request.DatetimeSerializer.default(obj: Any) +method posthog.request.HTTPAdapterWithSocketOptions.init_poolmanager(*args, **kwargs) +method posthog.types.FeatureFlag.from_json(resp: Any) -> FeatureFlag +method posthog.types.FeatureFlag.from_value_and_payload(key: str, value: FlagValue, payload: Any) -> FeatureFlag +method posthog.types.FeatureFlag.get_value() -> FlagValue +method posthog.types.FeatureFlagError.api_error(status: Union[int, str]) -> str +method posthog.types.FeatureFlagResult.from_flag_details(details: Union[FeatureFlag, None], override_match_value: Optional[FlagValue] = None) -> FeatureFlagResult | None +method posthog.types.FeatureFlagResult.from_value_and_payload(key: str, value: Union[FlagValue, None], payload: Any) -> Union[FeatureFlagResult, None] +method posthog.types.FeatureFlagResult.get_value() -> FlagValue +method posthog.types.FlagMetadata.from_json(resp: Any) -> Union[FlagMetadata, LegacyFlagMetadata] +method posthog.types.FlagReason.from_json(resp: Any) -> Optional[FlagReason] +method posthog.utils.FlagCache.clear() +method posthog.utils.FlagCache.get_cached_flag(distinct_id, flag_key, current_flag_version) +method posthog.utils.FlagCache.get_stale_cached_flag(distinct_id, flag_key, max_stale_age=None) +method posthog.utils.FlagCache.invalidate_version(old_version) +method posthog.utils.FlagCache.set_cached_flag(distinct_id, flag_key, flag_result, flag_definition_version) +method posthog.utils.FlagCacheEntry.is_stale_but_usable(current_time, max_stale_age=CACHE_STALE_TTL) +method posthog.utils.FlagCacheEntry.is_valid(current_time, ttl, current_flag_version) +method posthog.utils.RedisFlagCache.clear() +method posthog.utils.RedisFlagCache.get_cached_flag(distinct_id, flag_key, current_flag_version) +method posthog.utils.RedisFlagCache.get_stale_cached_flag(distinct_id, flag_key, max_stale_age=None) +method posthog.utils.RedisFlagCache.invalidate_version(old_version) +method posthog.utils.RedisFlagCache.set_cached_flag(distinct_id, flag_key, flag_result, flag_definition_version) +module posthog +module posthog.ai +module posthog.ai.anthropic +module posthog.ai.anthropic.anthropic +module posthog.ai.anthropic.anthropic_async +module posthog.ai.anthropic.anthropic_converter +module posthog.ai.anthropic.anthropic_providers +module posthog.ai.claude_agent_sdk +module posthog.ai.claude_agent_sdk.client +module posthog.ai.claude_agent_sdk.processor +module posthog.ai.gateway +module posthog.ai.gemini +module posthog.ai.gemini.gemini +module posthog.ai.gemini.gemini_async +module posthog.ai.gemini.gemini_converter +module posthog.ai.langchain +module posthog.ai.langchain.callbacks +module posthog.ai.openai +module posthog.ai.openai.openai +module posthog.ai.openai.openai_async +module posthog.ai.openai.openai_converter +module posthog.ai.openai.openai_providers +module posthog.ai.openai.wrapper_utils +module posthog.ai.openai_agents +module posthog.ai.openai_agents.processor +module posthog.ai.otel +module posthog.ai.otel.exporter +module posthog.ai.otel.processor +module posthog.ai.otel.spans +module posthog.ai.prompts +module posthog.ai.sanitization +module posthog.ai.stream +module posthog.ai.types +module posthog.ai.utils +module posthog.args +module posthog.bucketed_rate_limiter +module posthog.client +module posthog.consumer +module posthog.contexts +module posthog.exception_capture +module posthog.exception_utils +module posthog.feature_flag_evaluations +module posthog.feature_flags +module posthog.flag_definition_cache +module posthog.integrations +module posthog.integrations.celery +module posthog.integrations.django +module posthog.poller +module posthog.request +module posthog.types +module posthog.utils +module posthog.version diff --git a/uv.lock b/uv.lock index 1a7598c5..bc294109 100644 --- a/uv.lock +++ b/uv.lock @@ -9,7 +9,7 @@ resolution-markers = [ ] [options] -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 = "2026-06-05T14:10:56.136305Z" exclude-newer-span = "P7D" [[package]] @@ -827,6 +827,41 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/5c/4f/aab73ecaa6b3086a4c89863d94cf26fa84cbff63f52ce9bc4342b3087a06/greenlet-3.2.3-cp314-cp314-win_amd64.whl", hash = "sha256:8c47aae8fbbfcf82cc13327ae802ba13c9c36753b67e760023fd116bc124a62a", size = 301236, upload-time = "2025-06-05T16:15:20.111Z" }, ] +[[package]] +name = "griffe" +version = "2.0.2" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "griffecli" }, + { name = "griffelib" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/4a/49/eb6d2935e27883af92c930ed40cc4c69bcd32c402be43b8ca4ab20510f67/griffe-2.0.2.tar.gz", hash = "sha256:c5d56326d159f274492e9bf93a9895cec101155d944caa66d0fc4e0c13751b92", size = 293757, upload-time = "2026-03-27T11:34:52.205Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/94/c0/2bb018eecf9a83c68db9cd9fffd9dab25f102ad30ed869451046e46d1187/griffe-2.0.2-py3-none-any.whl", hash = "sha256:2b31816460aee1996af26050a1fc6927a2e5936486856707f55508e4c9b5960b", size = 5141, upload-time = "2026-03-27T11:34:47.721Z" }, +] + +[[package]] +name = "griffecli" +version = "2.0.2" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "colorama" }, + { name = "griffelib" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/79/e0/6a7d661d71bb043656a109b91d84a42b5342752542074ec83b16a6eb97f0/griffecli-2.0.2.tar.gz", hash = "sha256:40a1ad4181fc39685d025e119ae2c5b669acdc1f19b705fb9bf971f4e6f6dffb", size = 56281, upload-time = "2026-03-27T11:34:50.087Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/2e/e8/90d93356c88ac34c20cb5edffca68138df55ca9bbd1a06eccfbcec8fdbe5/griffecli-2.0.2-py3-none-any.whl", hash = "sha256:0d44d39e59afa81e288a3e1c3bf352cc4fa537483326ac06b8bb6a51fd8303a0", size = 9500, upload-time = "2026-03-27T11:34:48.81Z" }, +] + +[[package]] +name = "griffelib" +version = "2.0.2" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/9d/82/74f4a3310cdabfbb10da554c3a672847f1ed33c6f61dd472681ce7f1fe67/griffelib-2.0.2.tar.gz", hash = "sha256:3cf20b3bc470e83763ffbf236e0076b1211bac1bc67de13daf494640f2de707e", size = 166461, upload-time = "2026-03-27T11:34:51.091Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/11/8c/c9138d881c79aa0ea9ed83cbd58d5ca75624378b38cee225dcf5c42cc91f/griffelib-2.0.2-py3-none-any.whl", hash = "sha256:925c857658fb1ba40c0772c37acbc2ab650bd794d9c1b9726922e36ea4117ea1", size = 142357, upload-time = "2026-03-27T11:34:46.275Z" }, +] + [[package]] name = "h11" version = "0.16.0" @@ -2181,6 +2216,7 @@ dependencies = [ [package.optional-dependencies] dev = [ { name = "django-stubs" }, + { name = "griffe" }, { name = "lxml" }, { name = "mypy" }, { name = "mypy-baseline" }, @@ -2246,6 +2282,7 @@ requires-dist = [ { name = "django-stubs", marker = "extra == 'dev'" }, { name = "freezegun", marker = "extra == 'test'", specifier = "==1.5.1" }, { name = "google-genai", marker = "extra == 'test'" }, + { name = "griffe", marker = "extra == 'dev'" }, { name = "langchain", marker = "extra == 'langchain'", specifier = ">=0.2.0" }, { name = "langchain-anthropic", marker = "extra == 'test'", specifier = ">=1.0" }, { name = "langchain-community", marker = "extra == 'test'", specifier = ">=0.4" },