prompt-version-manager
Version:
Centralized prompt management system for Human Behavior AI agents
68 lines • 2.58 kB
TypeScript
/**
* Chain tracking decorator and context manager for TypeScript.
*/
import { ChainManager } from './manager';
import { Message, LLMResponse } from '../core/models';
export declare function getChainManager(): ChainManager;
export declare class ChainContext {
private readonly manager;
private readonly chainId;
private readonly oldChainId;
constructor(name: string, description?: string, chainId?: string);
start(): Promise<string>;
complete(): Promise<void>;
fail(error: string): Promise<void>;
getChainId(): string;
}
export declare function chainContext<T>(name: string, description: string | undefined, chainId: string | undefined, fn: (chainId: string) => Promise<T>): Promise<T>;
export interface TrackedLLMOptions {
tag: string;
dependencies?: string[];
language?: 'python' | 'typescript';
nodeId?: string;
}
export declare function trackedLLM(options: TrackedLLMOptions): <T extends (...args: any[]) => Promise<LLMResponse>>(_target: any, _propertyName: string, descriptor: TypedPropertyDescriptor<T>) => void;
export declare function trackedLLMCall(model: string, messages: Message[], options: TrackedLLMOptions & {
[key: string]: any;
}): Promise<LLMResponse>;
export declare class ChainTracker {
private manager;
constructor(repoPath?: string);
createChain(name: string, description?: string): Promise<string>;
addLLMNode(chainId: string, tag: string, model: string, dependencies?: string[], language?: 'python' | 'typescript'): Promise<string>;
executeNode(chainId: string, nodeId: string, messages: Message[], options?: {
[key: string]: any;
}): Promise<LLMResponse>;
executeChain(chainId: string, inputs: Record<string, any>): Promise<Record<string, LLMResponse>>;
getChainVisualization(chainId: string): any;
/**
* Track a single execution step with metrics
*/
trackExecution(stepId: string, metrics: {
provider: string;
model: string;
tokens: {
input: number;
output: number;
total: number;
};
duration: number;
success: boolean;
error?: string;
}): Promise<void>;
/**
* Get accumulated metrics for all tracked executions
*/
getMetrics(): {
totalExecutions: number;
successfulExecutions: number;
failedExecutions: number;
totalCost: number;
totalTokens: {
input: number;
output: number;
total: number;
};
};
}
//# sourceMappingURL=tracker.d.ts.map