如果生成的响应以无法开头,我需要 if 块在 try 块内运行

问题描述 投票:0回答:1

如果响应[“answer”]包含“无法找到答案”,我需要条件才能工作

尝试:

        instructions =instruction
        prompt_query = query + instructions

        response = await conv_chain.acall({"question": prompt_query, "chat_history": chat_history_new})
        
        end_time = time.time()
        logger.info("response generated in :"+str(end_time-start_time)+"secs")

        if response["answer"] == "Unable to find the relevant answer":
    
           second_instruction=instruction1
           retry_prompt_query = query + second_instruction

           response = await conv_chain.acall({"question": retry_prompt_query, "chat_history": chat_history_new})
    except:
python azure testing botframework llm
1个回答
0
投票
    if "unable to find the relevant answer" in response["answer"]:
© www.soinside.com 2019 - 2024. All rights reserved.