OpenSPG / KAG

KAG is a logical form-guided reasoning and retrieval framework based on OpenSPG engine and LLMs. It is used to build logical reasoning and factual Q&A solutions for professional domain knowledge bases. It can effectively overcome the shortcomings of the traditional RAG vector similarity calculation model.
https://spg.openkg.cn/en-US
Apache License 2.0
646 stars 49 forks source link

default_reflextor.py代码中的self.llm_module.invoke的judge模块永遠無法執行,怀疑有bug #70

Open zhangyanbo2007 opened 16 hours ago

zhangyanbo2007 commented 16 hours ago
def _can_answer(self, memory: KagMemoryABC, instruction: str):
    """
    Determines whether the query can be answered.

    :param memory (KagMemory): The context or memory information to use for rewriting.
    :param instruction (str): The original instruction to be rewritten.
    :return: Whether the query can be answered (boolean)
    """
    serialize_memory = self._get_serialize_memory(memory)
    if serialize_memory == "":
        return False

    if memory.get_solved_answer() != "":
        return True

    return self.llm_module.invoke({'memory': serialize_memory, 'instruction': instruction}, self.judge_prompt,
                                  with_json_parse=False)

     直接用hotpotqa數據集測試。
     測例:Are Christopher Nolan and Sathish Kalathil both film directors?