Gets the latest message from the user. Returns: The latest message from the user. If not found, returns an empty string.
(session: "Session")
| 93 | |
| 94 | |
| 95 | def _get_latest_message_from_user(session: "Session") -> str: |
| 96 | """Gets the latest message from the user. |
| 97 | |
| 98 | Returns: |
| 99 | The latest message from the user. If not found, returns an empty string. |
| 100 | """ |
| 101 | events = session.events |
| 102 | if not events: |
| 103 | return "" |
| 104 | |
| 105 | event = events[-1] |
| 106 | if event.author == "user" and not event.get_function_responses(): |
| 107 | if event.content.parts and event.content.parts[0].text: |
| 108 | return event.content.parts[0].text |
| 109 | else: |
| 110 | logger.warning("No message from user for fetching example.") |
| 111 | |
| 112 | return "" |
| 113 | |
| 114 | |
| 115 | def build_example_si( |
nothing calls this directly
no test coverage detected