@@ -332,9 +332,12 @@ describe("Test Anthropic instrumentation", async function () {
332332 it ( "should set attributes in span for beta messages with thinking" , async ( ) => {
333333 const message = await anthropic . beta . messages . create ( {
334334 max_tokens : 2048 ,
335- betas : [ ' interleaved-thinking-2025-05-14' ] ,
335+ betas : [ " interleaved-thinking-2025-05-14" ] ,
336336 messages : [
337- { role : "user" , content : "What is 2+2? Think through this step by step." } ,
337+ {
338+ role : "user" ,
339+ content : "What is 2+2? Think through this step by step." ,
340+ } ,
338341 ] ,
339342 model : "claude-opus-4-1-20250805" ,
340343 thinking : {
@@ -360,7 +363,7 @@ describe("Test Anthropic instrumentation", async function () {
360363 chatSpan . attributes [ `${ SpanAttributes . LLM_REQUEST_MAX_TOKENS } ` ] ,
361364 2048 ,
362365 ) ;
363-
366+
364367 // Check if thinking parameters are captured (these will fail initially)
365368 assert . strictEqual (
366369 chatSpan . attributes [ "llm.request.thinking.type" ] ,
@@ -382,28 +385,42 @@ describe("Test Anthropic instrumentation", async function () {
382385 ) ;
383386
384387 // Check that we capture both thinking and regular content blocks
385- const content = JSON . parse ( chatSpan . attributes [ `${ SpanAttributes . LLM_COMPLETIONS } .0.content` ] as string ) ;
388+ const content = JSON . parse (
389+ chatSpan . attributes [
390+ `${ SpanAttributes . LLM_COMPLETIONS } .0.content`
391+ ] as string ,
392+ ) ;
386393 assert . ok ( Array . isArray ( content ) ) ;
387-
394+
388395 interface ContentBlock {
389396 type : string ;
390397 thinking ?: string ;
391398 text ?: string ;
392399 }
393-
394- const thinkingBlock = content . find ( ( block : ContentBlock ) => block . type === "thinking" ) ;
395- const textBlock = content . find ( ( block : ContentBlock ) => block . type === "text" ) ;
396-
400+
401+ const thinkingBlock = content . find (
402+ ( block : ContentBlock ) => block . type === "thinking" ,
403+ ) ;
404+ const textBlock = content . find (
405+ ( block : ContentBlock ) => block . type === "text" ,
406+ ) ;
407+
397408 assert . ok ( thinkingBlock , "Should contain a thinking block" ) ;
398- assert . ok ( thinkingBlock . thinking , "Thinking block should have thinking content" ) ;
409+ assert . ok (
410+ thinkingBlock . thinking ,
411+ "Thinking block should have thinking content" ,
412+ ) ;
399413 assert . ok ( textBlock , "Should contain a text block" ) ;
400414 assert . ok ( textBlock . text , "Text block should have text content" ) ;
401415
402416 // Verify token usage includes thinking tokens
403- const completionTokens = chatSpan . attributes [ `${ SpanAttributes . LLM_USAGE_COMPLETION_TOKENS } ` ] ;
404- const promptTokens = chatSpan . attributes [ `${ SpanAttributes . LLM_USAGE_PROMPT_TOKENS } ` ] ;
405- const totalTokens = chatSpan . attributes [ `${ SpanAttributes . LLM_USAGE_TOTAL_TOKENS } ` ] ;
406-
417+ const completionTokens =
418+ chatSpan . attributes [ `${ SpanAttributes . LLM_USAGE_COMPLETION_TOKENS } ` ] ;
419+ const promptTokens =
420+ chatSpan . attributes [ `${ SpanAttributes . LLM_USAGE_PROMPT_TOKENS } ` ] ;
421+ const totalTokens =
422+ chatSpan . attributes [ `${ SpanAttributes . LLM_USAGE_TOTAL_TOKENS } ` ] ;
423+
407424 assert . ok ( completionTokens && + completionTokens > 0 ) ;
408425 assert . ok ( promptTokens && + promptTokens > 0 ) ;
409426 assert . equal ( + promptTokens + + completionTokens , totalTokens ) ;
0 commit comments