(
&self,
py: Python<'_>,
prompt: String,
attachments: Vec<Bound<'_, PyDict>>,
history: Option<&Bound<'_, PyList>>,
)
| 1737 | /// history: Optional conversation history |
| 1738 | #[pyo3(signature = (prompt, attachments, history=None))] |
| 1739 | fn send_with_attachments( |
| 1740 | &self, |
| 1741 | py: Python<'_>, |
| 1742 | prompt: String, |
| 1743 | attachments: Vec<Bound<'_, PyDict>>, |
| 1744 | history: Option<&Bound<'_, PyList>>, |
| 1745 | ) -> PyResult<PyAgentResult> { |
| 1746 | let rust_attachments = py_attachments_to_rust(&attachments)?; |
| 1747 | let rust_history = history.map(|h| py_list_to_messages(h)).transpose()?; |
| 1748 | let session = self.inner.clone(); |
| 1749 | let result = py |
| 1750 | .allow_threads(move || { |
| 1751 | get_runtime().block_on(session.send_with_attachments( |
| 1752 | &prompt, |
| 1753 | &rust_attachments, |
| 1754 | rust_history.as_deref(), |
| 1755 | )) |
| 1756 | }) |
| 1757 | .map_err(|e| PyRuntimeError::new_err(format!("Agent execution failed: {e}")))?; |
| 1758 | Ok(PyAgentResult::from(result)) |
| 1759 | } |
| 1760 | |
| 1761 | /// Stream a prompt with image attachments. |
| 1762 | /// |
no test coverage detected