pub struct InputBuilder { /* private fields */ }
Expand description
Builder for Input
.
Implementations§
Source§impl InputBuilder
impl InputBuilder
Sourcepub fn messages(&mut self, value: Vec<Message>) -> &mut Self
pub fn messages(&mut self, value: Vec<Message>) -> &mut Self
Examples found in repository?
examples/multimodal-generation-stream.rs (lines 8-18)
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let request = MultiModalConversationParamBuilder::default()
.model("qwen-vl-max")
.input(InputBuilder::default().messages(vec![
MessageBuilder::default()
.role("user")
.contents(
vec![
json!({"image": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20241022/emyrja/dog_and_girl.jpeg"}),
json!({"text": "这是什么?"})
]
).build()?
]).build()?
)
.build()?;
let client = Client::new();
let response = client.multi_modal_conversation().call(request).await?;
dbg!(response);
Ok(())
}
More examples
examples/multimodal-generation.rs (lines 9-19)
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let request = MultiModalConversationParamBuilder::default()
.model("qwen-vl-max")
.input(InputBuilder::default().messages(vec![
MessageBuilder::default()
.role("user")
.contents(
vec![
json!({"image": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20241022/emyrja/dog_and_girl.jpeg"}),
json!({"text": "这是什么?"})
]
).build()?
]).build()?
)
.build()?;
let client = Client::new();
let response = client.multi_modal_conversation().call(request).await?;
dbg!(response);
Ok(())
}
Sourcepub fn build(&self) -> Result<Input, InputBuilderError>
pub fn build(&self) -> Result<Input, InputBuilderError>
Examples found in repository?
examples/multimodal-generation-stream.rs (line 18)
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let request = MultiModalConversationParamBuilder::default()
.model("qwen-vl-max")
.input(InputBuilder::default().messages(vec![
MessageBuilder::default()
.role("user")
.contents(
vec![
json!({"image": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20241022/emyrja/dog_and_girl.jpeg"}),
json!({"text": "这是什么?"})
]
).build()?
]).build()?
)
.build()?;
let client = Client::new();
let response = client.multi_modal_conversation().call(request).await?;
dbg!(response);
Ok(())
}
More examples
examples/multimodal-generation.rs (line 19)
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let request = MultiModalConversationParamBuilder::default()
.model("qwen-vl-max")
.input(InputBuilder::default().messages(vec![
MessageBuilder::default()
.role("user")
.contents(
vec![
json!({"image": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20241022/emyrja/dog_and_girl.jpeg"}),
json!({"text": "这是什么?"})
]
).build()?
]).build()?
)
.build()?;
let client = Client::new();
let response = client.multi_modal_conversation().call(request).await?;
dbg!(response);
Ok(())
}
Trait Implementations§
Source§impl Clone for InputBuilder
impl Clone for InputBuilder
Source§fn clone(&self) -> InputBuilder
fn clone(&self) -> InputBuilder
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for InputBuilder
impl RefUnwindSafe for InputBuilder
impl Send for InputBuilder
impl Sync for InputBuilder
impl Unpin for InputBuilder
impl UnwindSafe for InputBuilder
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
Mutably borrows from an owned value. Read more