Skip to content

Commit

Permalink
fix: Error handling for 'answer' variable (#1343)
Browse files Browse the repository at this point in the history
  • Loading branch information
Prasanjeet-Microsoft authored Sep 25, 2024
1 parent 9ecf2b7 commit c1cb24e
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit c1cb24e

Please sign in to comment.