UNPKG

pit-manager

Version:

Centralized prompt management system for Human Behavior AI agents

142 lines 4.25 kB
/** * Type definitions for simplified PIT API */ /** * Response object from model.complete() that enables automatic chaining. */ export interface ModelResponse { /** The actual content returned by the model */ content: string | object; /** Model used for this completion */ model: string; /** Hash of the prompt for tracking */ promptHash: string; /** Unique execution ID */ executionId: string; /** Metadata about the execution */ metadata: { tag: string; provider: string; chainId?: string; chainGroupId?: string; tokens: { prompt: number; completion: number; total: number; }; latencyMs: number; structured: boolean; }; /** Raw response from the provider */ rawResponse?: any; /** Signature for automatic chain detection */ _isPitResponse: true; /** Convert response to string for display */ toString(): string; /** Convert response to prompt string for chaining */ toPrompt(): string; } /** * Options for structured output */ export interface StructuredOutput<T = any> { /** JSON schema for the output */ schema?: object; /** Type/class for validation (provider-specific) */ type?: T; /** Name for the output (used in Claude tool calling) */ name?: string; } /** * Options for model.complete() */ export interface ModelOptions { /** Temperature for randomness (0-2) */ temperature?: number; /** Maximum tokens to generate */ maxTokens?: number; /** System prompt */ systemPrompt?: string; /** Parent execution ID for explicit chaining */ parentExecutionId?: string; /** Additional provider-specific options */ [key: string]: any; } /** * Variables for prompt templates */ export type PromptVariables = any[]; /** * Content that can be passed to model.complete() */ export type PromptContent = string | MultimodalContent | ModelResponse; /** * Multimodal content structure */ export interface MultimodalContent { parts: Array<TextPart | ImagePart>; } /** * Text part of multimodal content */ export interface TextPart { type: 'text'; text: string; } /** * Image part of multimodal content */ export interface ImagePart { type: 'image'; data: string; mimeType: string; } /** * Model interface */ export interface Model { /** * Execute model with automatic tracking and optional structured output * * @param modelName - Model identifier (e.g., "gpt-4o", "gemini-2.5-flash", "claude-3.5") * @param prompt - Prompt string, MultimodalContent, or ModelResponse from previous call (for chaining) * @param tag - Tag for tracking this execution * @param jsonOutput - Optional schema/type for structured output * @param options - Additional model options * @returns ModelResponse object that can be used for chaining */ complete(modelName: string, prompt: PromptContent, tag: string, jsonOutput?: StructuredOutput | object, options?: ModelOptions): Promise<ModelResponse>; /** * Start a new chain execution group for process-unique tracking. * * @param chainId - The chain ID for this group * @param options - Options for the chain execution group * @returns The chain execution group ID */ startChainExecutionGroup(chainId: string, options?: { session_id?: string; process_id?: string; metadata?: Record<string, any>; }): string; /** * End a chain execution group. * * @param groupId - The chain execution group ID * @param status - The final status of the group */ endChainExecutionGroup(groupId: string, status?: 'completed' | 'failed'): void; /** * Get the active chain group ID for the current process. * * @returns The active chain group ID or undefined if none */ getActiveChainGroupId(): string | undefined; /** * Get aggregated chain execution summary * * @param chainId - The chain ID to get summary for * @returns ChainExecutionSummary with aggregated statistics */ getChainSummary(chainId: string): Promise<any>; } //# sourceMappingURL=types.d.ts.map