#[non_exhaustive]pub struct PromptRequest {
pub session_id: SessionId,
pub prompt: Vec<ContentBlock>,
pub idempotency_key: Option<IdempotencyKey>,
pub meta: Option<Map<String, Value>>,
}unstable_protocol_v2 only.Expand description
Request parameters for sending a user prompt to the agent.
Contains the user’s message and any additional context.
See protocol docs: User Message
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.session_id: SessionIdThe ID of the session to send this user message to
prompt: Vec<ContentBlock>The blocks of content that compose the user’s message.
As a baseline, the Agent MUST support text and resource_link content blocks,
while other variants are optionally enabled via PromptCapabilities.
The Client MUST adapt its interface according to PromptCapabilities.
The client MAY include referenced pieces of context as either
resource or resource_link content blocks.
When available, resource is preferred
as it avoids extra round-trips and allows the message to include
pieces of context from sources the agent may not have access to.
Clients MUST NOT send an empty array. Agents MAY reject one with -32602 without
inserting it.
idempotency_key: Option<IdempotencyKey>Identifies this submission, so the Client can send the request again without the user message being inserted twice.
Optional. Omitted and null are equivalent and mean no key. The Agent then handles
the prompt without duplicate detection.
The Client generates the key and sends the same key on every attempt for the same
submission. The Agent inserts at most one user message for a key in a session, and
answers a retry with the messageId of the message it already inserted. Agents that
advertise capabilities.session MUST support the key.
When present, the value is an opaque, case-sensitive string of 1 to 255 characters.
Agents MUST reject any other value with -32602 (Invalid params) and MUST NOT treat
it as omitted.
See protocol docs: Retrying a prompt
meta: Option<Map<String, Value>>The _meta property is reserved by ACP to allow clients and agents to attach additional
metadata to their interactions. Omitted and null are equivalent and mean no metadata.
Implementations MUST NOT assign meaning to keys they do not recognize.
See protocol docs: Extensibility
Implementations§
Source§impl PromptRequest
impl PromptRequest
Sourcepub fn new(
session_id: impl Into<SessionId>,
prompt: Vec<ContentBlock>,
) -> PromptRequest
pub fn new( session_id: impl Into<SessionId>, prompt: Vec<ContentBlock>, ) -> PromptRequest
Builds PromptRequest with the required request fields set. Optional fields start unset or empty.
Sourcepub fn idempotency_key(
self,
idempotency_key: impl IntoOption<IdempotencyKey>,
) -> PromptRequest
pub fn idempotency_key( self, idempotency_key: impl IntoOption<IdempotencyKey>, ) -> PromptRequest
Identifies this submission, so the Client can send the request again without the user message being inserted twice.
The Client generates the key and sends the same key on every attempt for the same
submission. None means no key.
See protocol docs: Retrying a prompt
Sourcepub fn meta(self, meta: impl IntoOption<Map<String, Value>>) -> PromptRequest
pub fn meta(self, meta: impl IntoOption<Map<String, Value>>) -> PromptRequest
The _meta property is reserved by ACP to allow clients and agents to attach additional metadata to their interactions. Implementations MUST NOT assign meaning to keys they do not recognize.
See protocol docs: Extensibility
Trait Implementations§
Source§impl Clone for PromptRequest
impl Clone for PromptRequest
Source§fn clone(&self) -> PromptRequest
fn clone(&self) -> PromptRequest
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PromptRequest
impl Debug for PromptRequest
Source§impl<'de> Deserialize<'de> for PromptRequest
impl<'de> Deserialize<'de> for PromptRequest
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<PromptRequest, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<PromptRequest, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for PromptRequest
Source§impl JsonRpcMessage for PromptRequest
impl JsonRpcMessage for PromptRequest
Source§fn matches_method(method: &str) -> bool
fn matches_method(method: &str) -> bool
Source§fn to_untyped_message(&self) -> Result<UntypedMessage, Error>
fn to_untyped_message(&self) -> Result<UntypedMessage, Error>
Source§impl JsonRpcRequest for PromptRequest
impl JsonRpcRequest for PromptRequest
Source§type Response = PromptResponse
type Response = PromptResponse
Source§impl JsonSchema for PromptRequest
impl JsonSchema for PromptRequest
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl PartialEq for PromptRequest
impl PartialEq for PromptRequest
Source§impl Serialize for PromptRequest
impl Serialize for PromptRequest
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for PromptRequest
Auto Trait Implementations§
impl Forget for PromptRequest
impl Freeze for PromptRequest
impl Move for PromptRequest
impl RefUnwindSafe for PromptRequest
impl Send for PromptRequest
impl Sync for PromptRequest
impl Unpin for PromptRequest
impl UnsafeUnpin for PromptRequest
impl UnwindSafe for PromptRequest
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.