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

Method send

sdk/python/src/lib.rs:1432–1455  ·  view source on GitHub ↗
(
        &self,
        py: Python<'_>,
        prompt: &Bound<'_, PyAny>,
        history: Option<&Bound<'_, PyList>>,
    )

Source from the content-addressed store, hash-verified

1430 /// `[{"role": "user", "content": [{"type": "text", "text": "..."}]}]`
1431 #[pyo3(signature = (prompt, history=None))]
1432 fn send(
1433 &self,
1434 py: Python<'_>,
1435 prompt: &Bound<'_, PyAny>,
1436 history: Option<&Bound<'_, PyList>>,
1437 ) -> PyResult<PyAgentResult> {
1438 let (prompt, rust_history, rust_attachments) = py_session_input_to_parts(prompt, history)?;
1439 let session = self.inner.clone();
1440 let result = if rust_attachments.is_empty() {
1441 py.allow_threads(move || {
1442 get_runtime().block_on(session.send(&prompt, rust_history.as_deref()))
1443 })
1444 } else {
1445 py.allow_threads(move || {
1446 get_runtime().block_on(session.send_with_attachments(
1447 &prompt,
1448 &rust_attachments,
1449 rust_history.as_deref(),
1450 ))
1451 })
1452 }
1453 .map_err(|e| PyRuntimeError::new_err(format!("Agent execution failed: {e}")))?;
1454 Ok(PyAgentResult::from(result))
1455 }
1456
1457 /// Alias for ``send(...)`` with a name that matches run/replay terminology.
1458 #[pyo3(signature = (prompt, history=None))]

Callers 5

runMethod · 0.45
send_requestMethod · 0.45
mainFunction · 0.45
test_agent_drivenFunction · 0.45

Calls 6

block_onMethod · 0.80
get_runtimeFunction · 0.70
cloneMethod · 0.45
is_emptyMethod · 0.45
send_with_attachmentsMethod · 0.45

Tested by 2

mainFunction · 0.36
test_agent_drivenFunction · 0.36