(
content: types.Content,
)
| 164 | # - If there are multiple parts, return parts |
| 165 | # - remove function_call_id if it exists |
| 166 | def simplify_content( |
| 167 | content: types.Content, |
| 168 | ) -> Union[str, types.Part, list[types.Part]]: |
| 169 | for part in content.parts: |
| 170 | if part.function_call and part.function_call.id: |
| 171 | part.function_call.id = None |
| 172 | if part.function_response and part.function_response.id: |
| 173 | part.function_response.id = None |
| 174 | if len(content.parts) == 1: |
| 175 | if content.parts[0].text: |
| 176 | return content.parts[0].text.strip() |
| 177 | else: |
| 178 | return content.parts[0] |
| 179 | return content.parts |
| 180 | |
| 181 | |
| 182 | def get_user_content(message: types.ContentUnion) -> types.Content: |
no test coverage detected