:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
from langchain_core.prompts import ChatPromptTemplate
from langchain_core.runnables import RunnableConfig
from posthog.schema import AssistantFunnelsQuery
from ee.hogai.utils.types import AssistantState, PartialAssistantState
from ..schema_generator.nodes import SchemaGeneratorNode, SchemaGeneratorToolsNode
from ..schema_generator.utils import SchemaGeneratorOutput
from .prompts import FUNNEL_SYSTEM_PROMPT
from .toolkit import FUNNEL_SCHEMA
FunnelsSchemaGeneratorOutput = SchemaGeneratorOutput[AssistantFunnelsQuery]
class FunnelGeneratorNode(SchemaGeneratorNode[AssistantFunnelsQuery]):
INSIGHT_NAME = "Funnels"
OUTPUT_MODEL = FunnelsSchemaGeneratorOutput
OUTPUT_SCHEMA = FUNNEL_SCHEMA
async def arun(self, state: AssistantState, config: RunnableConfig) -> PartialAssistantState:
prompt = ChatPromptTemplate.from_messages(
[
("system", FUNNEL_SYSTEM_PROMPT),
],
template_format="mustache",
)
return await super()._run_with_prompt(state, prompt, config=config)
class FunnelGeneratorToolsNode(SchemaGeneratorToolsNode):
pass