MCPcopy Create free account
hub / github.com/AQ-MedAI/MedMemoryBench / generate_response

Method generate_response

methods/lightmem_agent.py:65–95  ·  view source on GitHub ↗

Generate a response using our tracked llm_client. Returns (parsed_response, usage_info) to match LightMem's interface.

(
        self,
        messages: List[Dict[str, str]],
        response_format: Optional[Dict[str, str]] = None,
        tools: Optional[List[Dict]] = None,
        tool_choice: str = "auto",
    )

Source from the content-addressed store, hash-verified

63
64Question: {question}
65
66Answer:"""
67
68# LongMemEval: from experiments/longmemeval/run_lightmem_gpt.py
69LONGMEMEVAL_ANSWER_PROMPT = """You are a helpful assistant.
70
71Question time:{question_date} and question:{question}
72Please answer the question based on the following memories: {memories}"""
73
74# MedMemoryBench: adapted from LoCoMo prompt for medical dialogues
75MEDMEMORYBENCH_ANSWER_PROMPT = """你是一个智能医疗记忆助手,负责从对话记忆中准确检索信息来回答问题。
76
77# 背景:
78你可以访问患者和医生之间对话的记忆。这些记忆包含带有时间戳的信息,可能与回答问题相关。
79
80# 指令:
811. 仔细分析患者和医生的所有记忆
822. 特别注意时间戳以确定答案
833. 如果问题询问特定事件或事实,请在记忆中寻找直接证据
844. 如果记忆包含矛盾信息,优先使用最近的记忆
855. 如果有时间参照问题(如"去年"、"两个月前"等),根据记忆时间戳计算实际日期
866. 始终将相对时间转换为具体日期、月份或年份
877. 仅关注记忆中的内容,基于证据回答
888. 回答应简洁直接
89
90# 思考步骤:
911. 找出与问题相关的所有记忆
922. 仔细检查这些记忆的时间戳和内容
933. 寻找能回答问题的日期、时间、地点或事件的明确提及
944. 如果需要计算,展示推理过程
955. 根据记忆中的证据给出精确答案
966. 确保答案直接回应所问问题
97
98患者的记忆:

Callers 2

_call_update_llmMethod · 0.95

Calls 1

chatMethod · 0.45

Tested by

no test coverage detected