(returnIds: ICommonObject, error: string | object, shutdown = false)
| 1241 | } |
| 1242 | |
| 1243 | async onChainError(returnIds: ICommonObject, error: string | object, shutdown = false) { |
| 1244 | if (Object.prototype.hasOwnProperty.call(this.handlers, 'langSmith')) { |
| 1245 | const chainRun: RunTree | undefined = this.handlers['langSmith'].chainRun[returnIds['langSmith'].chainRun] |
| 1246 | if (chainRun) { |
| 1247 | await chainRun.end({ |
| 1248 | error: { |
| 1249 | error |
| 1250 | } |
| 1251 | }) |
| 1252 | await chainRun.patchRun() |
| 1253 | } |
| 1254 | } |
| 1255 | |
| 1256 | if (Object.prototype.hasOwnProperty.call(this.handlers, 'langFuse')) { |
| 1257 | const span: LangfuseSpanClient | undefined = this.handlers['langFuse'].span[returnIds['langFuse'].span] |
| 1258 | if (span) { |
| 1259 | span.end({ |
| 1260 | output: { |
| 1261 | error |
| 1262 | } |
| 1263 | }) |
| 1264 | const langfuseTraceClient = this.handlers['langFuse'].trace[returnIds['langFuse'].trace] |
| 1265 | if (langfuseTraceClient) { |
| 1266 | langfuseTraceClient.update({ |
| 1267 | output: { |
| 1268 | error |
| 1269 | } |
| 1270 | }) |
| 1271 | } |
| 1272 | if (shutdown) { |
| 1273 | const langfuse: Langfuse = this.handlers['langFuse'].client |
| 1274 | await langfuse.shutdownAsync() |
| 1275 | } |
| 1276 | } |
| 1277 | } |
| 1278 | |
| 1279 | if (Object.prototype.hasOwnProperty.call(this.handlers, 'lunary')) { |
| 1280 | const chainEventId = returnIds['lunary'].chainEvent |
| 1281 | const monitor = this.handlers['lunary'].client |
| 1282 | |
| 1283 | if (monitor && chainEventId) { |
| 1284 | await monitor.trackEvent('chain', 'end', { |
| 1285 | runId: chainEventId, |
| 1286 | output: error |
| 1287 | }) |
| 1288 | } |
| 1289 | } |
| 1290 | |
| 1291 | if (Object.prototype.hasOwnProperty.call(this.handlers, 'langWatch')) { |
| 1292 | const span: LangWatchSpan | undefined = this.handlers['langWatch'].span[returnIds['langWatch'].span] |
| 1293 | if (span) { |
| 1294 | span.end({ |
| 1295 | error |
| 1296 | }) |
| 1297 | } |
| 1298 | } |
| 1299 | |
| 1300 | if (Object.prototype.hasOwnProperty.call(this.handlers, 'arize')) { |
no test coverage detected