strands/agent/
invoke_args.rs1use crate::types::{ContentBlock, InterruptResponse, InterruptResponseContent, Message};
4
5#[derive(Debug, Clone, PartialEq)]
17#[non_exhaustive]
18pub enum InvokeArgs {
19 Text(String),
21 ContentBlocks(Vec<ContentBlock>),
23 Messages(Vec<Message>),
25 InterruptResponses(Vec<InterruptResponseContent>),
27}
28
29impl From<&str> for InvokeArgs {
30 fn from(text: &str) -> Self {
31 Self::Text(text.to_owned())
32 }
33}
34
35impl From<&String> for InvokeArgs {
36 fn from(text: &String) -> Self {
37 Self::Text(text.clone())
38 }
39}
40
41impl From<String> for InvokeArgs {
42 fn from(text: String) -> Self {
43 Self::Text(text)
44 }
45}
46
47impl From<Vec<ContentBlock>> for InvokeArgs {
48 fn from(blocks: Vec<ContentBlock>) -> Self {
49 Self::ContentBlocks(blocks)
50 }
51}
52
53impl From<Vec<Message>> for InvokeArgs {
54 fn from(messages: Vec<Message>) -> Self {
55 Self::Messages(messages)
56 }
57}
58
59impl From<Message> for InvokeArgs {
60 fn from(message: Message) -> Self {
61 Self::Messages(vec![message])
62 }
63}
64
65impl From<Vec<InterruptResponseContent>> for InvokeArgs {
66 fn from(responses: Vec<InterruptResponseContent>) -> Self {
67 Self::InterruptResponses(responses)
68 }
69}
70
71impl From<Vec<InterruptResponse>> for InvokeArgs {
72 fn from(responses: Vec<InterruptResponse>) -> Self {
73 Self::InterruptResponses(responses.into_iter().map(InterruptResponseContent::from).collect())
74 }
75}