@@ -501,6 +501,53 @@ describe('OpenAI integration', () => {
501501 } ) ;
502502 } ) ;
503503
504+ createEsmAndCjsTests ( __dirname , 'scenario-azure-openai.mjs' , 'instrument.mjs' , ( createRunner , test ) => {
505+ test ( 'it works with Azure OpenAI' , async ( ) => {
506+ await createRunner ( )
507+ // First the span that our mock express server is emitting, unrelated to this test
508+ . expect ( {
509+ transaction : {
510+ transaction : 'POST /azureopenai/deployments/:model/chat/completions' ,
511+ } ,
512+ } )
513+ . expect ( {
514+ transaction : {
515+ transaction : 'chat gpt-3.5-turbo' ,
516+ contexts : {
517+ trace : {
518+ span_id : expect . any ( String ) ,
519+ trace_id : expect . any ( String ) ,
520+ data : {
521+ 'gen_ai.operation.name' : 'chat' ,
522+ 'sentry.op' : 'gen_ai.chat' ,
523+ 'sentry.origin' : 'auto.ai.openai' ,
524+ 'gen_ai.system' : 'openai' ,
525+ 'gen_ai.request.model' : 'gpt-3.5-turbo' ,
526+ 'gen_ai.request.temperature' : 0.7 ,
527+ 'gen_ai.response.model' : 'gpt-3.5-turbo' ,
528+ 'gen_ai.response.id' : 'chatcmpl-mock123' ,
529+ 'gen_ai.response.finish_reasons' : '["stop"]' ,
530+ 'gen_ai.usage.input_tokens' : 10 ,
531+ 'gen_ai.usage.output_tokens' : 15 ,
532+ 'gen_ai.usage.total_tokens' : 25 ,
533+ 'openai.response.id' : 'chatcmpl-mock123' ,
534+ 'openai.response.model' : 'gpt-3.5-turbo' ,
535+ 'openai.response.timestamp' : '2023-03-01T06:31:28.000Z' ,
536+ 'openai.usage.completion_tokens' : 15 ,
537+ 'openai.usage.prompt_tokens' : 10 ,
538+ } ,
539+ op : 'gen_ai.chat' ,
540+ origin : 'auto.ai.openai' ,
541+ status : 'ok' ,
542+ } ,
543+ } ,
544+ } ,
545+ } )
546+ . start ( )
547+ . completed ( ) ;
548+ } ) ;
549+ } ) ;
550+
504551 createEsmAndCjsTests (
505552 __dirname ,
506553 'truncation/scenario-message-truncation-completions.mjs' ,
0 commit comments