import { type CountlyAIConfig } from "@countly/ai-sdk-core"; /** * The shape our factory returns. Consumers pass it into * `experimental_telemetry: { integrations: [telemetry] }`, or register it * globally with `registerTelemetryIntegration()`. */ export interface CountlyTelemetryIntegration { onStart?: (event: any) => void; onStepStart?: (event: any) => void; onStepFinish?: (event: any) => void; onToolCallFinish?: (event: any) => void; onFinish?: (event: any) => void; onError?: (error: unknown) => void; /** Flush pending events. */ flush(): Promise; /** Shutdown transport. */ shutdown(): Promise; } /** * Options are Countly's config plus the ONE fact the AI SDK never tells a * telemetry integration: which endpoint the provider talks to. */ export interface CountlyTelemetryOptions extends CountlyAIConfig { /** * The provider client's `baseURL`, used only to classify `api_host_type` and * to emit the bare hostname as `api_host` (path, query and credentials are * stripped by core). The AI SDK's telemetry events do not carry it, so it * cannot be observed — when it is not supplied, `api_host_type` is the * honest `"unknown"` and `api_host` is omitted. */ apiBaseURL?: string; } /** * Creates a Countly telemetry integration for the Vercel AI SDK. * * One `[CLY]_llm_interaction` row is emitted per GENERATION: an N-step * tool-calling `generateText` produces N rows sharing one `run_id`, each with * its own `generation_index`, model, usage and latency. Non-generation * operations (`embed`, `embedMany`, `rerank`) emit nothing. * * @example * ```ts * import { countlyTelemetry } from "@countly/ai-sdk-vercel"; * import { generateText } from "ai"; * * const telemetry = countlyTelemetry({ * appKey: "YOUR_APP_KEY", * url: "https://your-countly.com", * apiBaseURL: "https://api.openai.com/v1", // optional: enables api_host_type * }); * * const { text } = await generateText({ * model: openai("gpt-4o"), * prompt: "Hello", * experimental_telemetry: { integrations: [telemetry] }, * }); * ``` */ export declare function countlyTelemetry(userConfig: CountlyTelemetryOptions): CountlyTelemetryIntegration; /** * Class-based wrapper around `countlyTelemetry()`. * Provides the same Telemetry integration via a class constructor. */ export declare class CountlyTelemetry { private readonly integration; constructor(userConfig: CountlyTelemetryOptions); /** Returns the integration object for use with AI SDK. */ asIntegration(): CountlyTelemetryIntegration; flush(): Promise; shutdown(): Promise; } /** * @deprecated The AI SDK no longer uses OTel SpanProcessor. * Use `countlyTelemetry()` or `CountlyTelemetry` instead. * * This class is a no-op stub kept for backward compatibility. */ export declare class CountlySpanProcessor { constructor(_userConfig: CountlyAIConfig); onStart(_span: any, _parentContext?: any): void; onEnd(_span: any): void; forceFlush(): Promise; shutdown(): Promise; } //# sourceMappingURL=adapter.d.ts.map