pub struct Chat<'a> { /* private fields */ }Implementations§
Source§impl<'a> Chat<'a>
impl<'a> Chat<'a>
Sourcepub fn builder(client: &'a Client) -> ChatBuilder<'a>
pub fn builder(client: &'a Client) -> ChatBuilder<'a>
Create an instance of Chat using the builder syntax
Source§impl Chat<'_>
impl Chat<'_>
Sourcepub async fn chat(&self) -> Result<ChatResponse, Error>
pub async fn chat(&self) -> Result<ChatResponse, Error>
多轮对话形式
发送的形式:
// 第一条可以是prompt
{"content": "You are a helpful assistant", "role": "system" }
{"content": "Hi", "role": "user" }
// 或者直接是user
{"content": "Hi", "role": "user" }pub async fn chat_by_stream( &self, ) -> Result<impl Stream<Item = Result<StreamEventData, Error>> + use<>, Error>
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Chat<'a>
impl<'a> !RefUnwindSafe for Chat<'a>
impl<'a> Send for Chat<'a>
impl<'a> Sync for Chat<'a>
impl<'a> Unpin for Chat<'a>
impl<'a> UnsafeUnpin for Chat<'a>
impl<'a> !UnwindSafe for Chat<'a>
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