File tree Expand file tree Collapse file tree 2 files changed +13
-5
lines changed
dev-packages/node-integration-tests/suites/tracing/openai Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -60,11 +60,15 @@ async function run() {
6060 apiKey : 'mock-api-key' ,
6161 } ) ;
6262
63- // Chat completion with long content (would normally be truncated)
63+ // Multiple messages with long content (would normally be truncated and popped to last message only )
6464 const longContent = 'A' . repeat ( 50_000 ) ;
6565 await client . chat . completions . create ( {
6666 model : 'gpt-4' ,
67- messages : [ { role : 'user' , content : longContent } ] ,
67+ messages : [
68+ { role : 'user' , content : longContent } ,
69+ { role : 'assistant' , content : 'Some reply' } ,
70+ { role : 'user' , content : 'Follow-up question' } ,
71+ ] ,
6872 } ) ;
6973
7074 // Responses API with long string input (would normally be truncated)
Original file line number Diff line number Diff line change @@ -350,11 +350,15 @@ describe('OpenAI integration', () => {
350350 const EXPECTED_TRANSACTION_NO_TRUNCATION = {
351351 transaction : 'main' ,
352352 spans : expect . arrayContaining ( [
353- // Chat completion with long content should not be truncated
353+ // Multiple messages should all be preserved (no popping to last message only)
354354 expect . objectContaining ( {
355355 data : expect . objectContaining ( {
356- [ GEN_AI_INPUT_MESSAGES_ATTRIBUTE ] : JSON . stringify ( [ { role : 'user' , content : longContent } ] ) ,
357- [ GEN_AI_INPUT_MESSAGES_ORIGINAL_LENGTH_ATTRIBUTE ] : 1 ,
356+ [ GEN_AI_INPUT_MESSAGES_ATTRIBUTE ] : JSON . stringify ( [
357+ { role : 'user' , content : longContent } ,
358+ { role : 'assistant' , content : 'Some reply' } ,
359+ { role : 'user' , content : 'Follow-up question' } ,
360+ ] ) ,
361+ [ GEN_AI_INPUT_MESSAGES_ORIGINAL_LENGTH_ATTRIBUTE ] : 3 ,
358362 } ) ,
359363 } ) ,
360364 // Responses API long string input should not be truncated or wrapped in quotes
You can’t perform that action at this time.
0 commit comments