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.

645 B
Raw Blame
import { Properties } from '~/plugin-scaffold'

import { EventWithProperties } from './modality-tokens'

/**
 * Build an `$ai_generation` PluginEvent with a properties bag for cost-pipeline
 * tests. Returns `EventWithProperties` (a `PluginEvent` with non-optional
 * `properties`) so it can be passed to extractors and cost calculators alike.
 */
export function createAIEvent(properties: Properties = {}): EventWithProperties {
    return {
        event: '$ai_generation',
        properties,
        ip: '',
        site_url: '',
        team_id: 0,
        now: '',
        distinct_id: '',
        uuid: '',
        timestamp: '',
    }
}