Struct MultiModalConversation

Source
pub struct MultiModalConversation<'a> { /* private fields */ }

Implementations§

Source§

impl<'a> MultiModalConversation<'a>

Source

pub fn new(client: &'a Client) -> Self

Source

pub async fn call( &self, request: MultiModalConversationParam, ) -> Result<MultiModalConversationOutput>

异步调用多模态对话功能。

此函数用于处理非流式多模态对话请求。如果请求参数中设置了流式处理,将返回错误。

§参数
  • request: 包含多模态对话所需参数的请求对象。
§返回
  • 成功时返回包含多模态对话输出结果的 Result
  • 如果请求参数中设置了 streamtrue,将返回 InvalidArgument 错误。
Examples found in repository?
examples/multimodal-generation-stream.rs (line 28)
10async fn main() -> Result<(), Box<dyn std::error::Error>> {
11    let request = MultiModalConversationParamBuilder::default()
12        .model("qwen-vl-max")
13        .input(InputBuilder::default().messages(vec![
14            MessageBuilder::default()
15            .role("user")
16            .contents(
17                vec![
18                    json!({"image": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20241022/emyrja/dog_and_girl.jpeg"}),
19                    json!({"text": "这是什么?"})
20                ]
21            ).build()?
22        ]).build()?
23    )
24        .build()?;
25
26    let client = Client::new();
27
28    let response = client.multi_modal_conversation().call(request).await?;
29
30    dbg!(response);
31
32    Ok(())
33}
More examples
Hide additional examples
examples/multimodal-generation.rs (line 28)
10async fn main() -> Result<(), Box<dyn std::error::Error>> {
11    let request = MultiModalConversationParamBuilder::default()
12        .model("qwen-vl-max")
13        .input(InputBuilder::default().messages(vec![
14            MessageBuilder::default()
15            .role("user")
16            .contents(
17                vec![
18                    json!({"image": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20241022/emyrja/dog_and_girl.jpeg"}),
19                    json!({"text": "这是什么?"})
20                ]
21            ).build()?
22        ]).build()?
23    )
24        .build()?;
25
26    let client = Client::new();
27
28    let response = client.multi_modal_conversation().call(request).await?;
29
30    dbg!(response);
31
32    Ok(())
33}
Source

pub async fn call_stream( &self, request: MultiModalConversationParam, ) -> Result<MultiModalConversationOutputStream>

异步调用流式多媒体对话功能

此函数用于处理流式多媒体对话请求。它要求请求必须是流式请求, 并且如果请求参数中指定了非流式处理,则会返回错误。 如果请求参数未设置或未明确指定流式处理,函数将自动设置为流式处理。

§参数
  • request: 多媒体对话参数,包括是否为流式请求和其他配置参数
§返回

返回一个流式输出结果,用于逐步处理和接收对话结果

§错误

如果请求不是流式请求或参数配置与流式请求冲突,则返回无效参数错误

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T