Skip to content

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

883 B
Raw Blame
from posthog.schema import AssistantFunnelsQuery

from ee.hogai.utils.helpers import dereference_schema, sort_schema_properties


def generate_funnel_schema() -> dict:
    schema = sort_schema_properties(
        AssistantFunnelsQuery.model_json_schema(),
        [
            "kind",
            "series",
            "dateRange",
            "interval",
            "funnelsFilter",
            "properties",
            "breakdownFilter",
        ],
    )
    return {
        "name": "output_insight_schema",
        "description": "Outputs the JSON schema of a product analytics insight",
        "parameters": {
            "type": "object",
            "properties": {
                "query": dereference_schema(schema),
            },
            "additionalProperties": False,
            "required": ["query"],
        },
    }


FUNNEL_SCHEMA = generate_funnel_schema()