(name: string, input: string | object, parentIds: ICommonObject)
| 1688 | } |
| 1689 | |
| 1690 | async onToolStart(name: string, input: string | object, parentIds: ICommonObject) { |
| 1691 | const returnIds: ICommonObject = { |
| 1692 | langSmith: {}, |
| 1693 | langFuse: {}, |
| 1694 | lunary: {}, |
| 1695 | langWatch: {}, |
| 1696 | arize: {}, |
| 1697 | phoenix: {}, |
| 1698 | opik: {} |
| 1699 | } |
| 1700 | |
| 1701 | if (Object.prototype.hasOwnProperty.call(this.handlers, 'langSmith')) { |
| 1702 | const parentRun: RunTree | undefined = this.handlers['langSmith'].chainRun[parentIds['langSmith'].chainRun] |
| 1703 | if (parentRun) { |
| 1704 | const childToolRun = await parentRun.createChild({ |
| 1705 | name, |
| 1706 | run_type: 'tool', |
| 1707 | inputs: { |
| 1708 | input |
| 1709 | } |
| 1710 | }) |
| 1711 | await childToolRun.postRun() |
| 1712 | this.handlers['langSmith'].toolRun = { [childToolRun.id]: childToolRun } |
| 1713 | returnIds['langSmith'].toolRun = childToolRun.id |
| 1714 | } |
| 1715 | } |
| 1716 | |
| 1717 | if (Object.prototype.hasOwnProperty.call(this.handlers, 'langFuse')) { |
| 1718 | const trace: LangfuseTraceClient | undefined = this.handlers['langFuse'].trace[parentIds['langFuse'].trace] |
| 1719 | if (trace) { |
| 1720 | const toolSpan = trace.span({ |
| 1721 | name, |
| 1722 | input |
| 1723 | }) |
| 1724 | this.handlers['langFuse'].toolSpan = { [toolSpan.id]: toolSpan } |
| 1725 | returnIds['langFuse'].toolSpan = toolSpan.id |
| 1726 | } |
| 1727 | } |
| 1728 | |
| 1729 | if (Object.prototype.hasOwnProperty.call(this.handlers, 'lunary')) { |
| 1730 | const monitor = this.handlers['lunary'].client |
| 1731 | const chainEventId: string = this.handlers['lunary'].chainEvent[parentIds['lunary'].chainEvent] |
| 1732 | |
| 1733 | if (monitor && chainEventId) { |
| 1734 | const runId = uuidv4() |
| 1735 | await monitor.trackEvent('tool', 'start', { |
| 1736 | runId, |
| 1737 | parentRunId: chainEventId, |
| 1738 | name, |
| 1739 | input |
| 1740 | }) |
| 1741 | this.handlers['lunary'].toolEvent = { [runId]: runId } |
| 1742 | returnIds['lunary'].toolEvent = runId |
| 1743 | } |
| 1744 | } |
| 1745 | |
| 1746 | if (Object.prototype.hasOwnProperty.call(this.handlers, 'langWatch')) { |
| 1747 | const trace: LangWatchTrace | undefined = this.handlers['langWatch'].trace[parentIds['langWatch'].trace] |
no test coverage detected