@@ -346,8 +346,7 @@ describe('Plugin', () => {
346346 } )
347347 } )
348348
349- // TODO(sabrenner): Fix this test for v5.0.0 - tool "input" instead of "arguments"
350- it . skip ( 'creates a span for a tool call' , async ( ) => { // eslint-disable-line mocha/no-pending-tests
349+ it ( 'creates a span for a tool call' , async ( ) => {
351350 let tools
352351 let additionalOptions = { }
353352 const toolSchema = ai . jsonSchema ( {
@@ -504,8 +503,7 @@ describe('Plugin', () => {
504503 } )
505504 } )
506505
507- // TODO(sabrenner): Fix this test for v5.0.0 - tool "input" instead of "arguments" & parsing, streaming
508- it . skip ( 'created a span for a tool call from a stream' , async ( ) => { // eslint-disable-line mocha/no-pending-tests
506+ it ( 'created a span for a tool call from a stream' , async ( ) => {
509507 let tools
510508 let additionalOptions = { }
511509 const toolSchema = ai . jsonSchema ( {
@@ -629,15 +627,13 @@ describe('Plugin', () => {
629627 span : apmSpans [ 2 ] ,
630628 parentId : llmobsSpans [ 0 ] . span_id ,
631629 /**
632- * MOCK_STRING used as the stream implementation for ai does not finish the initial llm spans
630+ * Before [email protected] , the stream implementation did not finish the initial llm spans 633631 * first to associate the tool call id with the tool itself (by matching descriptions).
634632 *
635- * Usually, this would mean the tool call name is 'toolCall'.
636- *
637- * However, because we used mocked responses, the second time this test is called, the tool call
638- * will have the name 'weather' instead. We just assert that the name exists and is a string to simplify.
633+ * Usually, this would mean the tool call name is 'toolCall'. This is a limitation with the older library
634+ * versions. In v5+, this is resolved as the tool name is not its index in the tools array, but its actual name.
639635 */
640- name : MOCK_STRING ,
636+ name : semifies ( realVersion , NODE_MAJOR < 22 ? '<=4.0.2' : '<4.0.2' ) ? 'toolCall' : 'weather' ,
641637 spanKind : 'tool' ,
642638 inputValue : JSON . stringify ( { location : 'Tokyo' } ) ,
643639 outputValue : JSON . stringify ( { location : 'Tokyo' , temperature : 72 } ) ,
0 commit comments