(returnIds: ICommonObject, output: string | object)
| 1817 | } |
| 1818 | |
| 1819 | async onToolEnd(returnIds: ICommonObject, output: string | object) { |
| 1820 | if (Object.prototype.hasOwnProperty.call(this.handlers, 'langSmith')) { |
| 1821 | const toolRun: RunTree | undefined = this.handlers['langSmith'].toolRun[returnIds['langSmith'].toolRun] |
| 1822 | if (toolRun) { |
| 1823 | await toolRun.end({ |
| 1824 | outputs: { |
| 1825 | output |
| 1826 | } |
| 1827 | }) |
| 1828 | await toolRun.patchRun() |
| 1829 | } |
| 1830 | } |
| 1831 | |
| 1832 | if (Object.prototype.hasOwnProperty.call(this.handlers, 'langFuse')) { |
| 1833 | const toolSpan: LangfuseSpanClient | undefined = this.handlers['langFuse'].toolSpan[returnIds['langFuse'].toolSpan] |
| 1834 | if (toolSpan) { |
| 1835 | toolSpan.end({ |
| 1836 | output |
| 1837 | }) |
| 1838 | } |
| 1839 | } |
| 1840 | |
| 1841 | if (Object.prototype.hasOwnProperty.call(this.handlers, 'lunary')) { |
| 1842 | const toolEventId: string = this.handlers['lunary'].toolEvent[returnIds['lunary'].toolEvent] |
| 1843 | const monitor = this.handlers['lunary'].client |
| 1844 | |
| 1845 | if (monitor && toolEventId) { |
| 1846 | await monitor.trackEvent('tool', 'end', { |
| 1847 | runId: toolEventId, |
| 1848 | output |
| 1849 | }) |
| 1850 | } |
| 1851 | } |
| 1852 | |
| 1853 | if (Object.prototype.hasOwnProperty.call(this.handlers, 'langWatch')) { |
| 1854 | const span: LangWatchSpan | undefined = this.handlers['langWatch'].span[returnIds['langWatch'].span] |
| 1855 | if (span) { |
| 1856 | span.end({ |
| 1857 | output: autoconvertTypedValues(output) |
| 1858 | }) |
| 1859 | } |
| 1860 | } |
| 1861 | |
| 1862 | if (Object.prototype.hasOwnProperty.call(this.handlers, 'arize')) { |
| 1863 | const toolSpan: Span | undefined = this.handlers['arize'].toolSpan[returnIds['arize'].toolSpan] |
| 1864 | if (toolSpan) { |
| 1865 | toolSpan.setAttribute('output.value', JSON.stringify(output)) |
| 1866 | toolSpan.setAttribute('output.mime_type', 'application/json') |
| 1867 | toolSpan.setStatus({ code: SpanStatusCode.OK }) |
| 1868 | toolSpan.end() |
| 1869 | } |
| 1870 | } |
| 1871 | |
| 1872 | if (Object.prototype.hasOwnProperty.call(this.handlers, 'phoenix')) { |
| 1873 | const toolSpan: Span | undefined = this.handlers['phoenix'].toolSpan[returnIds['phoenix'].toolSpan] |
| 1874 | if (toolSpan) { |
| 1875 | toolSpan.setAttribute('output.value', JSON.stringify(output)) |
| 1876 | toolSpan.setAttribute('output.mime_type', 'application/json') |
no test coverage detected