@traceloop/instrumentation-langchain
Version:
OpenTelemetry instrumentation for LangchainJS
41 lines (37 loc) • 1.43 kB
TypeScript
import { InstrumentationConfig, InstrumentationBase, InstrumentationModuleDefinition } from '@opentelemetry/instrumentation';
interface LangChainInstrumentationConfig 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 LangChainInstrumentation extends InstrumentationBase {
protected _config: LangChainInstrumentationConfig;
constructor(config?: LangChainInstrumentationConfig);
manuallyInstrument({ chainsModule, agentsModule, toolsModule, vectorStoreModule, runnablesModule, }: {
chainsModule?: any;
agentsModule?: any;
toolsModule?: any;
vectorStoreModule?: any;
runnablesModule?: any;
}): void;
protected init(): InstrumentationModuleDefinition[];
private patchChainModule;
private patchAgentModule;
private patchToolsModule;
private patchVectorStoreModule;
private patchRunnablesModule;
private unpatchChainModule;
private unpatchAgentModule;
private unpatchToolsModule;
private unpatchVectorStoreModule;
private unpatchRunnablesModule;
private _shouldSendPrompts;
}
export { LangChainInstrumentation };
export type { LangChainInstrumentationConfig };