@traceloop/instrumentation-together
Version:
Together Instrumentation
39 lines (35 loc) • 1.31 kB
TypeScript
import * as togetherai from 'together-ai';
import { InstrumentationConfig, InstrumentationBase, InstrumentationModuleDefinition } from '@opentelemetry/instrumentation';
interface TogetherAIInstrumentationConfig extends InstrumentationConfig {
/**
* Whether to log prompts, completions and embeddings on traces.
* @default true
*/
traceContent?: boolean;
/**
* Whether to enrich token information if missing from the trace.
* @default false
*/
enrichTokens?: boolean;
/**
* A custom logger to log any exceptions that happen during span creation.
*/
exceptionLogger?: (e: Error) => void;
}
declare class TogetherInstrumentation extends InstrumentationBase {
protected _config: TogetherAIInstrumentationConfig;
constructor(config?: TogetherAIInstrumentationConfig);
setConfig(config?: TogetherAIInstrumentationConfig): void;
manuallyInstrument(module: typeof togetherai.Together): void;
protected init(): InstrumentationModuleDefinition;
private patch;
private unpatch;
private patchTogether;
private startSpan;
private _streamingWrapPromise;
private _wrapPromise;
private _shouldSendPrompts;
private _endSpan;
}
export { TogetherInstrumentation };
export type { TogetherAIInstrumentationConfig };