@@ -882,18 +882,10 @@ async def generate_title(conversation_messages):
882882
883883
884884async def get_section_content (request_body , request_headers ):
885- prompt = f'''Generate content for the sections below: { request_body } .
886- For eacth section, use the SectionTitle and SectionDescription to
887- create a new attributed called 'content' that contains the generated content,
888- Do not include any other commentary or description.
889- Always format the sections for better readability.
890- Leave placeholders for names and amounts etc.
891- Do not use markdown syntax.
892- '''
893- # prompt = f"""{app_settings.azure_openai.generate_section_content_prompt}
894- # Section Title: {request_body['sectionTitle']}
895- # Section Description: {request_body['sectionDescription']}
896- # """
885+ prompt = f"""{ app_settings .azure_openai .generate_section_content_prompt }
886+ Section Title: { request_body ['sectionTitle' ]}
887+ Section Description: { request_body ['sectionDescription' ]}
888+ """
897889
898890 messages = [{"role" : "system" , "content" : app_settings .azure_openai .system_message }]
899891 messages .append ({"role" : "user" , "content" : prompt })
@@ -903,8 +895,12 @@ async def get_section_content(request_body, request_headers):
903895
904896 try :
905897 azure_openai_client = init_openai_client ()
906- response = await azure_openai_client .chat .completions .create (** model_args )
907- # response = raw_response.parse()
898+ raw_response = (
899+ await azure_openai_client .chat .completions .with_raw_response .create (
900+ ** model_args
901+ )
902+ )
903+ response = raw_response .parse ()
908904
909905 except Exception as e :
910906 logging .exception ("Exception in send_chat_request" )
@@ -928,4 +924,4 @@ def retrieve_document(filepath):
928924 raise e
929925
930926
931- app = create_app ()
927+ app = create_app ()
0 commit comments