MCPcopy Create free account
hub / github.com/FlowiseAI/Flowise / onLLMError

Method onLLMError

packages/components/src/handler.ts:1616–1688  ·  view source on GitHub ↗
(returnIds: ICommonObject, error: string | object)

Source from the content-addressed store, hash-verified

1614 }
1615
1616 async onLLMError(returnIds: ICommonObject, error: string | object) {
1617 if (Object.prototype.hasOwnProperty.call(this.handlers, 'langSmith')) {
1618 const llmRun: RunTree | undefined = this.handlers['langSmith'].llmRun[returnIds['langSmith'].llmRun]
1619 if (llmRun) {
1620 await llmRun.end({
1621 error: {
1622 error
1623 }
1624 })
1625 await llmRun.patchRun()
1626 }
1627 }
1628
1629 if (Object.prototype.hasOwnProperty.call(this.handlers, 'langFuse')) {
1630 const generation: LangfuseGenerationClient | undefined = this.handlers['langFuse'].generation[returnIds['langFuse'].generation]
1631 if (generation) {
1632 generation.end({
1633 output: error
1634 })
1635 }
1636 }
1637
1638 if (Object.prototype.hasOwnProperty.call(this.handlers, 'lunary')) {
1639 const llmEventId: string = this.handlers['lunary'].llmEvent[returnIds['lunary'].llmEvent]
1640 const monitor = this.handlers['lunary'].client
1641
1642 if (monitor && llmEventId) {
1643 await monitor.trackEvent('llm', 'end', {
1644 runId: llmEventId,
1645 output: error
1646 })
1647 }
1648 }
1649
1650 if (Object.prototype.hasOwnProperty.call(this.handlers, 'langWatch')) {
1651 const span: LangWatchSpan | undefined = this.handlers['langWatch'].span[returnIds['langWatch'].span]
1652 if (span) {
1653 span.end({
1654 error
1655 })
1656 }
1657 }
1658
1659 if (Object.prototype.hasOwnProperty.call(this.handlers, 'arize')) {
1660 const llmSpan: Span | undefined = this.handlers['arize'].llmSpan[returnIds['arize'].llmSpan]
1661 if (llmSpan) {
1662 llmSpan.setAttribute('error.value', JSON.stringify(error))
1663 llmSpan.setAttribute('error.mime_type', 'application/json')
1664 llmSpan.setStatus({ code: SpanStatusCode.ERROR, message: error.toString() })
1665 llmSpan.end()
1666 }
1667 }
1668
1669 if (Object.prototype.hasOwnProperty.call(this.handlers, 'phoenix')) {
1670 const llmSpan: Span | undefined = this.handlers['phoenix'].llmSpan[returnIds['phoenix'].llmSpan]
1671 if (llmSpan) {
1672 llmSpan.setAttribute('error.value', JSON.stringify(error))
1673 llmSpan.setAttribute('error.mime_type', 'application/json')

Callers 5

runMethod · 0.45
handleToolSubmissionFunction · 0.45
runMethod · 0.45
runMethod · 0.45
runMethod · 0.45

Calls 2

stringifyMethod · 0.80
callMethod · 0.45

Tested by

no test coverage detected