pit-manager
Version:
Centralized prompt management system for Human Behavior AI agents
111 lines • 3.34 kB
TypeScript
/**
* Unified model interface with automatic tracking and chaining for TypeScript
*/
import { ModelResponse as IModelResponse, Model as IModel, StructuredOutput, ModelOptions, PromptContent, MultimodalContent } from './types';
import { ChainExecutionSummary } from '../core/models';
/**
* ModelResponse implementation that enables automatic chaining
*/
export declare class ModelResponse implements IModelResponse {
content: string | object;
model: string;
promptHash: string;
executionId: string;
metadata: {
tag: string;
provider: string;
chainId?: string;
chainGroupId?: string;
tokens: {
prompt: number;
completion: number;
total: number;
};
latencyMs: number;
structured: boolean;
};
rawResponse?: any;
_isPitResponse: true;
constructor(params: {
content: string | object;
model: string;
promptHash: string;
executionId: string;
metadata: IModelResponse['metadata'];
rawResponse?: any;
});
/**
* String representation returns the content
*/
toString(): string;
/**
* Convert response to prompt string for chaining
*/
toPrompt(): string;
/**
* Concatenate with another ModelResponse or string
*/
plus(other: ModelResponse | string): ModelResponse;
/**
* Internal concatenation logic
*/
private concatenate;
/**
* Combine agent names intelligently, avoiding duplicates
*/
private combineAgentNames;
/**
* Get the sequence of agents in this response
*/
private getAgentSequence;
/**
* Generate deterministic chain ID from agent sequence
*/
private generateDeterministicChainId;
/**
* Create ModelResponse from string
*/
static fromString(content: string, tag?: string): ModelResponse;
}
/**
* Unified model interface with automatic tracking
*/
export declare class Model implements IModel {
private repoPath;
private versioning;
private executionTracker;
private registry;
constructor();
/**
* Start a new chain execution group for process-unique tracking.
*/
startChainExecutionGroup(chainId: string, options?: {
session_id?: string;
process_id?: string;
metadata?: Record<string, any>;
}): string;
/**
* End a chain execution group.
*/
endChainExecutionGroup(groupId: string, status?: 'completed' | 'failed'): void;
/**
* Get the active chain group ID for the current process.
*/
getActiveChainGroupId(): string | undefined;
/**
* Execute model with automatic tracking and optional structured output
*/
complete(modelName: string, prompt: string | ModelResponse | PromptContent | MultimodalContent, tag: string, jsonOutput?: StructuredOutput, options?: ModelOptions): Promise<ModelResponse>;
private initializeFromEnvironment;
private findPitDirectory;
private detectProvider;
private extractContent;
private extractTokens;
private calculateCost;
/**
* Get aggregated chain execution summary
*/
getChainSummary(chainId: string): Promise<ChainExecutionSummary | null>;
}
export declare const model: Model;
//# sourceMappingURL=model.d.ts.map