UNPKG

@traceloop/instrumentation-anthropic

Version:
35 lines (31 loc) 1.26 kB
import { InstrumentationConfig, InstrumentationBase, InstrumentationModuleDefinition } from '@opentelemetry/instrumentation'; import * as anthropic from '@anthropic-ai/sdk'; interface AnthropicInstrumentationConfig 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 const anthropicFinishReasonMap: Record<string, string>; declare class AnthropicInstrumentation extends InstrumentationBase { protected _config: AnthropicInstrumentationConfig; constructor(config?: AnthropicInstrumentationConfig); setConfig(config?: AnthropicInstrumentationConfig): void; manuallyInstrument(module: typeof anthropic): void; protected init(): InstrumentationModuleDefinition; private patch; private unpatch; private patchAnthropic; private startSpan; private _streamingWrapPromise; private _wrapPromise; private _endSpan; private _shouldSendPrompts; } export { AnthropicInstrumentation, anthropicFinishReasonMap }; export type { AnthropicInstrumentationConfig };