Struct async_openai_wasm::Chat
source · pub struct Chat<'c> { /* private fields */ }
Expand description
Given a list of messages comprising a conversation, the model will return a response.
Related guide: Chat completions
Implementations§
source§impl<'c> Chat<'c>
impl<'c> Chat<'c>
pub fn new(client: &'c Client) -> Self
sourcepub async fn create(
&self,
request: CreateChatCompletionRequest
) -> Result<CreateChatCompletionResponse, OpenAIError>
pub async fn create( &self, request: CreateChatCompletionRequest ) -> Result<CreateChatCompletionResponse, OpenAIError>
Creates a model response for the given chat conversation.
sourcepub async fn create_stream(
&self,
request: CreateChatCompletionRequest
) -> Result<ChatCompletionResponseStream, OpenAIError>
pub async fn create_stream( &self, request: CreateChatCompletionRequest ) -> Result<ChatCompletionResponseStream, OpenAIError>
Creates a completion for the chat message
partial message deltas will be sent, like in ChatGPT. Tokens will be sent as data-only server-sent events as they become available, with the stream terminated by a data: [DONE]
message.
ChatCompletionResponseStream is a parsed SSE stream until a [DONE] is received from server.
Auto Trait Implementations§
impl<'c> Freeze for Chat<'c>
impl<'c> !RefUnwindSafe for Chat<'c>
impl<'c> !Send for Chat<'c>
impl<'c> !Sync for Chat<'c>
impl<'c> Unpin for Chat<'c>
impl<'c> !UnwindSafe for Chat<'c>
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