Process the message and return a list of messages to add to the conversation. The input message should already be applicable to this tool. Don't return the input message, just the new messages. If implementing a tool that has to block while calling a function use `c
(self, message: Message)
| 50 | return True |
| 51 | |
| 52 | async def process(self, message: Message) -> AsyncIterator[Message]: |
| 53 | """ |
| 54 | Process the message and return a list of messages to add to the conversation. |
| 55 | The input message should already be applicable to this tool. |
| 56 | Don't return the input message, just the new messages. |
| 57 | |
| 58 | If implementing a tool that has to block while calling a function use `call_on_background_thread` to get a coroutine. |
| 59 | |
| 60 | If you just want to test this use `evaluate_generator` to get the results. |
| 61 | |
| 62 | Do not override this method; override `_process` below (to avoid interfering with tracing). |
| 63 | """ |
| 64 | async for m in self._process(message): |
| 65 | if self.output_channel_should_match_input_channel: |
| 66 | _maybe_update_inplace_and_validate_channel(input_message=message, tool_message=m) |
| 67 | yield m |
| 68 | |
| 69 | @abstractmethod |
| 70 | async def _process(self, message: Message) -> AsyncIterator[Message]: |