@@ -31,34 +31,34 @@ test('should create AI spans with correct attributes', async ({ page }) => {
31
31
32
32
// First AI call - should have telemetry enabled and record inputs/outputs (sendDefaultPii: true)
33
33
/* const firstPipelineSpan = aiPipelineSpans[0];
34
- expect(firstPipelineSpan?.data?.['ai.model.id']).toBe('mock-model-id');
35
- expect(firstPipelineSpan?.data?.['ai.model.provider']).toBe('mock-provider');
36
- expect(firstPipelineSpan?.data?.['ai.prompt']).toContain('Where is the first span?');
34
+ expect(firstPipelineSpan?.data?.['vercel. ai.model.id']).toBe('mock-model-id');
35
+ expect(firstPipelineSpan?.data?.['vercel. ai.model.provider']).toBe('mock-provider');
36
+ expect(firstPipelineSpan?.data?.['vercel. ai.prompt']).toContain('Where is the first span?');
37
37
expect(firstPipelineSpan?.data?.['gen_ai.response.text']).toBe('First span here!');
38
38
expect(firstPipelineSpan?.data?.['gen_ai.usage.input_tokens']).toBe(10);
39
39
expect(firstPipelineSpan?.data?.['gen_ai.usage.output_tokens']).toBe(20); */
40
40
41
41
// Second AI call - explicitly enabled telemetry
42
42
const secondPipelineSpan = aiPipelineSpans [ 0 ] ;
43
- expect ( secondPipelineSpan ?. data ?. [ 'ai.prompt' ] ) . toContain ( 'Where is the second span?' ) ;
43
+ expect ( secondPipelineSpan ?. data ?. [ 'vercel. ai.prompt' ] ) . toContain ( 'Where is the second span?' ) ;
44
44
expect ( secondPipelineSpan ?. data ?. [ 'gen_ai.response.text' ] ) . toContain ( 'Second span here!' ) ;
45
45
46
46
// Third AI call - with tool calls
47
47
/* const thirdPipelineSpan = aiPipelineSpans[2];
48
- expect(thirdPipelineSpan?.data?.['ai.response.finishReason']).toBe('tool-calls');
48
+ expect(thirdPipelineSpan?.data?.['vercel. ai.response.finishReason']).toBe('tool-calls');
49
49
expect(thirdPipelineSpan?.data?.['gen_ai.usage.input_tokens']).toBe(15);
50
50
expect(thirdPipelineSpan?.data?.['gen_ai.usage.output_tokens']).toBe(25); */
51
51
52
52
// Tool call span
53
53
/* const toolSpan = toolCallSpans[0];
54
- expect(toolSpan?.data?.['ai.toolCall.name']).toBe('getWeather');
55
- expect(toolSpan?.data?.['ai.toolCall.id']).toBe('call-1');
56
- expect(toolSpan?.data?.['ai.toolCall.args']).toContain('San Francisco');
57
- expect(toolSpan?.data?.['ai.toolCall.result']).toContain('Sunny, 72°F'); */
54
+ expect(toolSpan?.data?.['vercel. ai.toolCall.name']).toBe('getWeather');
55
+ expect(toolSpan?.data?.['vercel. ai.toolCall.id']).toBe('call-1');
56
+ expect(toolSpan?.data?.['vercel. ai.toolCall.args']).toContain('San Francisco');
57
+ expect(toolSpan?.data?.['vercel. ai.toolCall.result']).toContain('Sunny, 72°F'); */
58
58
59
59
// Verify the fourth call was not captured (telemetry disabled)
60
60
const promptsInSpans = spans
61
- . map ( span => span . data ?. [ 'ai.prompt' ] )
61
+ . map ( span => span . data ?. [ 'vercel. ai.prompt' ] )
62
62
. filter ( ( prompt ) : prompt is string => prompt !== undefined ) ;
63
63
const hasDisabledPrompt = promptsInSpans . some ( prompt => prompt . includes ( 'Where is the third span?' ) ) ;
64
64
expect ( hasDisabledPrompt ) . toBe ( false ) ;
0 commit comments