diff --git a/code/backend/batch/utilities/orchestrator/open_ai_functions.py b/code/backend/batch/utilities/orchestrator/open_ai_functions.py index 3eb6a52df..02a95710e 100644 --- a/code/backend/batch/utilities/orchestrator/open_ai_functions.py +++ b/code/backend/batch/utilities/orchestrator/open_ai_functions.py @@ -125,11 +125,18 @@ async def orchestrate( prompt_tokens=answer.prompt_tokens, completion_tokens=answer.completion_tokens, ) + else: + logger.info("Unknown function call detected") + text = result.choices[0].message.content + answer = Answer(question=user_message, answer=text) else: logger.info("No function call detected") text = result.choices[0].message.content answer = Answer(question=user_message, answer=text) + if answer.answer is None: + answer.answer = "The requested information is not available in the retrieved data. Please try another query or topic." + # Call Content Safety tool if self.config.prompts.enable_content_safety: if response := self.call_content_safety_output(user_message, answer.answer):