MCPcopy Create free account
hub / github.com/MiniMax-AI/Mini-Agent / log_response

Method log_response

mini_agent/logger.py:85–120  ·  view source on GitHub ↗

Log LLM response Args: content: Response content thinking: Thinking content (optional) tool_calls: Tool call list (optional) finish_reason: Finish reason (optional)

(
        self,
        content: str,
        thinking: str | None = None,
        tool_calls: list[ToolCall] | None = None,
        finish_reason: str | None = None,
    )

Source from the content-addressed store, hash-verified

83 self._write_log("REQUEST", content)
84
85 def log_response(
86 self,
87 content: str,
88 thinking: str | None = None,
89 tool_calls: list[ToolCall] | None = None,
90 finish_reason: str | None = None,
91 ):
92 """Log LLM response
93
94 Args:
95 content: Response content
96 thinking: Thinking content (optional)
97 tool_calls: Tool call list (optional)
98 finish_reason: Finish reason (optional)
99 """
100 self.log_index += 1
101
102 # Build complete response data structure
103 response_data = {
104 "content": content,
105 }
106
107 if thinking:
108 response_data["thinking"] = thinking
109
110 if tool_calls:
111 response_data["tool_calls"] = [tc.model_dump() for tc in tool_calls]
112
113 if finish_reason:
114 response_data["finish_reason"] = finish_reason
115
116 # Format as JSON
117 log_content = "LLM Response:\n\n"
118 log_content += json.dumps(response_data, indent=2, ensure_ascii=False)
119
120 self._write_log("RESPONSE", log_content)
121
122 def log_tool_result(
123 self,

Callers 1

runMethod · 0.80

Calls 1

_write_logMethod · 0.95

Tested by

no test coverage detected