Module: traceable
Type Aliases
RunTreeLike
Ƭ RunTreeLike: RunTree
Defined in
TraceableFunction
Ƭ TraceableFunction<Func
>: Func
extends (...args
: A1
) => R1
(...args
: A2
) => R2
(...args
: A3
) => R3
(...args
: A4
) => R4
(...args
: A5
) => R5
? UnionToIntersection
<WrapArgReturnPair
<[A1
, R1
] | [A2
, R2
] | [A3
, R3
] | [A4
, R4
] | [A5
, R5
]>> : Func
extends (...args
: A1
) => R1
(...args
: A2
) => R2
(...args
: A3
) => R3
(...args
: A4
) => R4
? UnionToIntersection
<WrapArgReturnPair
<[A1
, R1
] | [A2
, R2
] | [A3
, R3
] | [A4
, R4
]>> : Func
extends (...args
: A1
) => R1
(...args
: A2
) => R2
(...args
: A3
) => R3
? UnionToIntersection
<WrapArgReturnPair
<[A1
, R1
] | [A2
, R2
] | [A3
, R3
]>> : Func
extends (...args
: A1
) => R1
(...args
: A2
) => R2
? UnionToIntersection
<WrapArgReturnPair
<[A1
, R1
] | [A2
, R2
]>> : Func
extends (...args
: A1
) => R1
? UnionToIntersection
<WrapArgReturnPair
<[A1
, R1
]>> : never
Type parameters
Name | Type |
---|---|
Func | extends (...args : any []) => any |
Defined in
Functions
getCurrentRunTree
▸ getCurrentRunTree(): RunTree
Return the current run tree from within a traceable-wrapped function. Will throw an error if called outside of a traceable function.
Returns
The run tree for the given context.
Defined in
isTraceableFunction
▸ isTraceableFunction(x
): x is Function
Parameters
Name | Type |
---|---|
x | unknown |
Returns
x is Function
Defined in
traceable
▸ traceable<Func
>(wrappedFunc
, config?
): TraceableFunction
<Func
>
Higher-order function that takes function as input and returns a "TraceableFunction" - a wrapped version of the input that automatically handles tracing. If the returned traceable function calls any traceable functions, those are automatically traced as well.
The returned TraceableFunction can accept a run tree or run tree config as its first argument. If omitted, it will default to the caller's run tree, or will be treated as a root run.
Type parameters
Name | Type |
---|---|
Func | extends (...args : any []) => any |
Parameters
Name | Type | Description |
---|---|---|
wrappedFunc | Func | Targeted function to be traced |
config? | Partial <RunTreeConfig > & { aggregator? : (args : any []) => any ; argsConfigPath? : [number ] | [number , string ] ; tracingEnabled? : boolean } | Additional metadata such as name, tags or providing a custom LangSmith client instance |
Returns
TraceableFunction
<Func
>
Defined in
wrapFunctionAndEnsureTraceable
▸ wrapFunctionAndEnsureTraceable<Func
>(target
, options
, name?
): TraceableFunction
<Func
>
Type parameters
Name | Type |
---|---|
Func | extends (...args : any []) => any |
Parameters
Name | Type | Default value |
---|---|---|
target | Func | undefined |
options | Partial <RunTreeConfig > | undefined |
name | string | "target" |
Returns
TraceableFunction
<Func
>