Initialize from dictionary. Args: d: dictionary containing fields to initialize
(message: Dict[str, Any])
| 182 | |
| 183 | @staticmethod |
| 184 | def from_dict(message: Dict[str, Any]) -> "OpenAIToolCall": |
| 185 | """ |
| 186 | Initialize from dictionary. |
| 187 | Args: |
| 188 | d: dictionary containing fields to initialize |
| 189 | """ |
| 190 | id = message["id"] |
| 191 | type = message["type"] |
| 192 | function = LLMFunctionCall.from_dict(message["function"]) |
| 193 | extra_content = message.get("extra_content") |
| 194 | return OpenAIToolCall( |
| 195 | id=id, type=type, function=function, extra_content=extra_content |
| 196 | ) |
| 197 | |
| 198 | def __str__(self) -> str: |
| 199 | if self.function is None: |
no test coverage detected