@@ -140,7 +140,6 @@ def init_openai_client():
140140 if app_settings .azure_openai .endpoint
141141 else f"https://{ app_settings .azure_openai .resource } .openai.azure.com/"
142142 )
143- print (f"Using Azure OpenAI endpoint: { endpoint } " )
144143 track_event_if_configured ("AzureOpenAIEndpointUsed" , {
145144 "endpoint" : endpoint
146145 })
@@ -182,7 +181,6 @@ def init_openai_client():
182181
183182# Initialize Azure Foundry SDK client
184183async def init_ai_foundry_client ():
185- print ("AIFoundryClientInitializationStart" )
186184 ai_foundry_client = None
187185 try :
188186 track_event_if_configured ("AIFoundryClientInitializationStart" , {"status" : "success" })
@@ -208,8 +206,7 @@ async def init_ai_foundry_client():
208206 endpoint = app_settings .azure_ai .agent_endpoint ,
209207 credential = DefaultAzureCredential ()
210208 )
211- print ("Using AI Foundry endpoint: " + app_settings .azure_ai .agent_endpoint )
212- track_event_if_configured ("AIFoundryEndpointUsed" , {
209+ track_event_if_configured ("AIFoundryAgentEndpointUsed" , {
213210 "endpoint" : app_settings .azure_ai .agent_endpoint
214211 })
215212 ai_foundry_client = await ai_project_client .inference .get_azure_openai_client (
@@ -303,7 +300,7 @@ def prepare_model_args(request_body, request_headers):
303300 ),
304301 }
305302 ]
306- # track_event_if_configured("NoDatasourceConfigured", {"system_message_used": messages[0]["content"]})
303+ # track_event_if_configured("NoDatasourceConfigured", {"system_message_used": messages[0]["content"]})
307304
308305 for message in request_messages :
309306 if message :
@@ -343,7 +340,6 @@ def prepare_model_args(request_body, request_headers):
343340 app_settings .datasource .construct_payload_configuration (request = request )
344341 ]
345342 }
346- print ("model_args extra_body: " + str (model_args ))
347343 # change role information if template chat
348344 # if chat_type == ChatType.TEMPLATE:
349345 # model_args["extra_body"]["data_sources"][0]["parameters"][
@@ -353,9 +349,7 @@ def prepare_model_args(request_body, request_headers):
353349 # track_event_if_configured("TemplateRoleInformationSet", {
354350 # "template_system_message": app_settings.azure_openai.template_system_message
355351 # })
356- print ("inside" + str (model_args ))
357352 model_args_clean = copy .deepcopy (model_args )
358- print ("model_args_clean: " + str (model_args_clean ))
359353 if model_args_clean .get ("extra_body" ):
360354 secret_params = [
361355 "key" ,
@@ -397,8 +391,6 @@ def prepare_model_args(request_body, request_headers):
397391async def send_chat_request (request_body , request_headers ):
398392 filtered_messages = []
399393 messages = request_body .get ("messages" , [])
400- print (f"Request body: { request_body } " )
401- print (f"Original messages: { messages } " )
402394 for message in messages :
403395 if message .get ("role" ) != "tool" :
404396 filtered_messages .append (message )
@@ -408,40 +400,31 @@ async def send_chat_request(request_body, request_headers):
408400 })
409401 request_body ["messages" ] = filtered_messages
410402 model_args = prepare_model_args (request_body , request_headers )
411- print (f"Model args after: { model_args } " )
412403
413404 try :
414405 if app_settings .base_settings .use_ai_foundry_sdk :
415406 # Use AI Foundry SDK for response
416-
417- print ("Foundry_sdk_for_response" )
418407 track_event_if_configured ("Foundry_sdk_for_response" , {"status" : "success" })
419- print (model_args )
420408 ai_foundry_client = await init_ai_foundry_client ()
421409 raw_response = await ai_foundry_client .chat .completions .with_raw_response .create (
422410 ** model_args
423411 )
424412 response = raw_response .parse ()
425- print (f"Raw response: { raw_response } " )
426413 apim_request_id = raw_response .headers .get ("apim-request-id" )
427414 track_event_if_configured ("ChatCompletionSuccess" , {
428415 "apim_request_id" : apim_request_id ,
429416 "message_count" : len (filtered_messages )
430417 })
431418 else :
432419 # Use Azure Open AI client for response
433- print ("Openai_sdk_for_response" )
434420 track_event_if_configured ("Openai_sdk_for_response" , {"status" : "success" })
435421 azure_openai_client = init_openai_client ()
436- print ("Ragini" + str (model_args ))
437422 raw_response = (
438423 await azure_openai_client .chat .completions .with_raw_response .create (
439424 ** model_args
440425 )
441426 )
442- print (f"Raw response: { raw_response } " )
443427 response = raw_response .parse ()
444- print (f"Response: { response } " )
445428 apim_request_id = raw_response .headers .get ("apim-request-id" )
446429
447430 track_event_if_configured ("ChatCompletionSuccess" , {
@@ -1194,7 +1177,6 @@ async def generate_title(conversation_messages):
11941177 response = None
11951178 if app_settings .base_settings .use_ai_foundry_sdk :
11961179 # Use Foundry SDK for title generation
1197- print ("Foundry_sdk_for_title" )
11981180 track_event_if_configured ("Foundry_sdk_for_title" , {"status" : "success" })
11991181 ai_foundry_client = await init_ai_foundry_client ()
12001182 response = await ai_foundry_client .chat .completions .create (
@@ -1205,7 +1187,6 @@ async def generate_title(conversation_messages):
12051187 )
12061188 else :
12071189 # Use Azure OpenAI client for title generation
1208- print ("Openai_sdk_for_title" )
12091190 track_event_if_configured ("Openai_sdk_for_title" , {"status" : "success" })
12101191 azure_openai_client = init_openai_client ()
12111192 response = await azure_openai_client .chat .completions .create (
@@ -1214,10 +1195,8 @@ async def generate_title(conversation_messages):
12141195 temperature = 1 ,
12151196 max_tokens = 64 ,
12161197 )
1217- print (f"Response from title generation: { response } " )
12181198 raw_content = response .choices [0 ].message .content
12191199 raw_content = raw_content .strip ()
1220- print (f"Raw content from title generation: { raw_content } " )
12211200 if raw_content .startswith ("{{" ) and raw_content .endswith ("}}" ):
12221201 raw_content = raw_content [1 :- 1 ] # Remove one set of braces
12231202
@@ -1228,7 +1207,6 @@ async def generate_title(conversation_messages):
12281207
12291208 json_str = json_match .group ()
12301209 title = json .loads (json_str )["title" ]
1231- print (f"Extracted title: { title } " )
12321210 track_event_if_configured ("TitleGenerated" , {"title" : title })
12331211 return title
12341212 except Exception as e :
@@ -1252,15 +1230,13 @@ async def get_section_content(request_body, request_headers):
12521230 raw_response = None
12531231 if app_settings .base_settings .use_ai_foundry_sdk :
12541232 # Use Foundry SDK for section content generation
1255- print ("Foundry_sdk_for_section" )
12561233 track_event_if_configured ("Foundry_sdk_for_section" , {"status" : "success" })
12571234 ai_foundry_client = await init_ai_foundry_client ()
12581235 raw_response = await ai_foundry_client .chat .completions .with_raw_response .create (
12591236 ** model_args
12601237 )
12611238 else :
12621239 # Use Azure OpenAI client for section content generation
1263- print ("Openai_sdk_for_section" )
12641240 track_event_if_configured ("Openai_sdk_for_section" , {"status" : "success" })
12651241 azure_openai_client = init_openai_client ()
12661242 raw_response = (
0 commit comments