@olakai/sdk
Version:
This document demonstrates how to use the Olakai SDK with all its features.
65 lines (64 loc) • 2.29 kB
TypeScript
/**
* Helper functions to make monitoring easier and more intuitive
*/
import type { MonitorOptions, OlakaiEventParams } from "./types";
/**
* Event-based configuration function
* @param config - Configuration object
*/
export declare function olakaiConfig(config: {
apiKey: string;
endpoint: string;
debug?: boolean;
}): Promise<void>;
/**
* Event-based tracking function
* @param eventType - Always 'event'
* @param eventName - Always 'ai_activity'
* @param params - Event parameters
*/
export declare function olakai(eventType: "event", eventName: "ai_activity", params: OlakaiEventParams): void;
/**
/**
* Monitor function that automatically captures everything by default and sends the data to the Olakai API
* No type parameters needed - TypeScript will infer them
* @param fn - The function to monitor
* @param options - The eventual options for the monitored function
* @returns The monitored function
*/
export declare function olakaiMonitor<T extends (...args: any[]) => any>(fn: T, options?: Partial<MonitorOptions<Parameters<T>, ReturnType<T>>>): T extends (...args: any[]) => Promise<any> ? (...args: Parameters<T>) => Promise<ReturnType<T>> : (...args: Parameters<T>) => Promise<ReturnType<T>>;
/**
* Report an AI interaction event directly to Olakai without wrapping a function
* @param prompt - The input/prompt sent to the AI
* @param response - The response received from the AI
* @param options - Optional parameters for the report
* @returns Promise that resolves when the report is sent
*/
export declare function olakaiReport(prompt: any, response: any, options?: {
email?: string;
chatId?: string;
task?: string;
subTask?: string;
tokens?: number;
requestTime?: number;
shouldScore?: boolean;
sanitize?: boolean;
priority?: "low" | "normal" | "high";
customDimensions?: {
dim1?: string;
dim2?: string;
dim3?: string;
dim4?: string;
dim5?: string;
[key: string]: string | undefined;
};
customMetrics?: {
metric1?: number;
metric2?: number;
metric3?: number;
metric4?: number;
metric5?: number;
[key: string]: number | undefined;
};
}): Promise<void>;
//# sourceMappingURL=helpers.d.ts.map