MCPcopy
hub / github.com/huggingface/smolagents / dict

Method dict

src/smolagents/memory.py:161–172  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

159 token_usage: TokenUsage | None = None
160
161 def dict(self):
162 return {
163 "model_input_messages": [
164 make_json_serializable(get_dict_from_nested_dataclasses(msg)) for msg in self.model_input_messages
165 ],
166 "model_output_message": make_json_serializable(
167 get_dict_from_nested_dataclasses(self.model_output_message)
168 ),
169 "plan": self.plan,
170 "timing": self.timing.dict(),
171 "token_usage": asdict(self.token_usage) if self.token_usage else None,
172 }
173
174 def to_messages(self, summary_mode: bool = False) -> list[ChatMessage]:
175 if summary_mode:

Callers 1

Calls 3

make_json_serializableFunction · 0.90
dictMethod · 0.45

Tested by 1