@traceloop/instrumentation-llamaindex
Version:
Llamaindex Instrumentation
34 lines (30 loc) • 1.16 kB
TypeScript
import * as llamaindex from 'llamaindex';
import { InstrumentationConfig, InstrumentationBase, InstrumentationModuleDefinition } from '@opentelemetry/instrumentation';
interface LlamaIndexInstrumentationConfig extends InstrumentationConfig {
/**
* Whether to log prompts, completions and embeddings on traces.
* @default true
*/
traceContent?: boolean;
/**
* A custom logger to log any exceptions that happen during span creation.
*/
exceptionLogger?: (e: Error) => void;
}
declare class LlamaIndexInstrumentation extends InstrumentationBase {
protected _config: LlamaIndexInstrumentationConfig;
constructor(config?: LlamaIndexInstrumentationConfig);
setConfig(config?: LlamaIndexInstrumentationConfig): void;
manuallyInstrument(module: typeof llamaindex): void;
protected init(): InstrumentationModuleDefinition[];
private isLLM;
private isEmbedding;
private isSynthesizer;
private isRetriever;
private patch;
private unpatch;
private patchOpenAI;
private unpatchOpenAI;
}
export { LlamaIndexInstrumentation };
export type { LlamaIndexInstrumentationConfig };