128 lines
3.5 KiB
TypeScript
128 lines
3.5 KiB
TypeScript
export type JLINCTracerFields = {
|
|
dataStoreApiUrl?: string | undefined;
|
|
dataStoreApiKey?: string | undefined;
|
|
archiveApiUrl?: string | undefined;
|
|
archiveApiKey?: string | undefined;
|
|
systemPrefix?: string | undefined;
|
|
agreementId?: string | null | undefined;
|
|
debug?: boolean | undefined;
|
|
};
|
|
export type SerializedRun = {
|
|
name?: string | undefined;
|
|
start_time?: number | undefined;
|
|
end_time?: number | undefined;
|
|
trace_id?: string | undefined;
|
|
inputs?: any;
|
|
outputs?: any;
|
|
extra?: {
|
|
metadata?: {
|
|
ls_provider?: string;
|
|
ls_model_name?: string;
|
|
};
|
|
} | undefined;
|
|
};
|
|
/**
|
|
* @typedef {Object} JLINCTracerFields
|
|
* @property {string} [dataStoreApiUrl]
|
|
* @property {string} [dataStoreApiKey]
|
|
* @property {string} [archiveApiUrl]
|
|
* @property {string} [archiveApiKey]
|
|
* @property {string} [systemPrefix]
|
|
* @property {string|null} [agreementId]
|
|
* @property {boolean} [debug]
|
|
*/
|
|
/**
|
|
* @typedef {Object} SerializedRun
|
|
* @property {string} [name]
|
|
* @property {number} [start_time]
|
|
* @property {number} [end_time]
|
|
* @property {string} [trace_id]
|
|
* @property {any} [inputs]
|
|
* @property {any} [outputs]
|
|
* @property {{ metadata?: { ls_provider?: string, ls_model_name?: string } }} [extra]
|
|
*/
|
|
/**
|
|
* @extends {LangChainTracer}
|
|
*/
|
|
export class JLINCTracer extends LangChainTracer {
|
|
/**
|
|
* @param {JLINCTracerFields} [fields={}]
|
|
*/
|
|
constructor(fields?: JLINCTracerFields);
|
|
/** @type {string} */
|
|
dataStoreApiUrl: string;
|
|
/** @type {string} */
|
|
dataStoreApiKey: string;
|
|
/** @type {string} */
|
|
archiveApiUrl: string;
|
|
/** @type {string} */
|
|
archiveApiKey: string;
|
|
/** @type {string} */
|
|
systemPrefix: string;
|
|
/** @type {string|null} */
|
|
agreementId: string | null;
|
|
/** @type {boolean} */
|
|
debug: boolean;
|
|
/** @type {string|null} */
|
|
domain: string | null;
|
|
/** @type {Set<string>} */
|
|
entities: Set<string>;
|
|
/**
|
|
* @param {any} run
|
|
* @returns {Promise<void>}
|
|
*/
|
|
onRunCreate(run: any): Promise<void>;
|
|
/**
|
|
* @param {any} run
|
|
* @returns {Promise<void>}
|
|
*/
|
|
onRunUpdate(run: any): Promise<void>;
|
|
/**
|
|
* @returns {Promise<void>}
|
|
*/
|
|
getDefaultProjectName(): Promise<void>;
|
|
/**
|
|
* @param {SerializedRun} serialized
|
|
* @returns {Promise<void>}
|
|
*/
|
|
onLLMStart(serialized: SerializedRun): Promise<void>;
|
|
/**
|
|
* @param {SerializedRun} serialized
|
|
* @returns {Promise<void>}
|
|
*/
|
|
onLLMEnd(serialized: SerializedRun): Promise<void>;
|
|
/**
|
|
* @param {SerializedRun} serialized
|
|
* @returns {Promise<void>}
|
|
*/
|
|
onToolStart(serialized: SerializedRun): Promise<void>;
|
|
/**
|
|
* @param {SerializedRun} serialized
|
|
* @returns {Promise<void>}
|
|
*/
|
|
onToolEnd(serialized: SerializedRun): Promise<void>;
|
|
/**
|
|
* @param {string} dir
|
|
* @param {any} payload
|
|
* @returns {Promise<any>}
|
|
*/
|
|
_postToApi(dir: string, payload: any): Promise<any>;
|
|
/**
|
|
* @param {string} entityShortName
|
|
* @returns {Promise<void>}
|
|
*/
|
|
_setEntity(entityShortName: string): Promise<void>;
|
|
/**
|
|
* @param {string} input
|
|
* @returns {string}
|
|
*/
|
|
_sanitize(input: string): string;
|
|
/**
|
|
* @param {any} payload
|
|
* @param {'in' | 'out'} direction
|
|
* @returns {Promise<void>}
|
|
*/
|
|
_jlincTrace(payload: any, direction: "in" | "out"): Promise<void>;
|
|
}
|
|
import { LangChainTracer } from "@langchain/core/dist/tracers/tracer_langchain";
|