MCPcopy Index your code
hub / github.com/AI45Lab/Code / send_with_attachments

Method send_with_attachments

sdk/python/src/lib.rs:1739–1759  ·  view source on GitHub ↗
(
        &self,
        py: Python<'_>,
        prompt: String,
        attachments: Vec<Bound<'_, PyDict>>,
        history: Option<&Bound<'_, PyList>>,
    )

Source from the content-addressed store, hash-verified

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 ///

Callers 2

sendMethod · 0.45
send_requestMethod · 0.45

Calls 5

py_attachments_to_rustFunction · 0.85
py_list_to_messagesFunction · 0.85
block_onMethod · 0.80
get_runtimeFunction · 0.70
cloneMethod · 0.45

Tested by

no test coverage detected