Struct async_openai::Completions
source · pub struct Completions<'c, C: Config> { /* private fields */ }
Expand description
Given a prompt, the model will return one or more predicted completions, and can also return the probabilities of alternative tokens at each position.
Implementations§
source§impl<'c, C: Config> Completions<'c, C>
impl<'c, C: Config> Completions<'c, C>
pub fn new(client: &'c Client<C>) -> Self
sourcepub async fn create(
&self,
request: CreateCompletionRequest
) -> Result<CreateCompletionResponse, OpenAIError>
pub async fn create( &self, request: CreateCompletionRequest ) -> Result<CreateCompletionResponse, OpenAIError>
Creates a completion for the provided prompt and parameters
sourcepub async fn create_stream(
&self,
request: CreateCompletionRequest
) -> Result<CompletionResponseStream, OpenAIError>
pub async fn create_stream( &self, request: CreateCompletionRequest ) -> Result<CompletionResponseStream, OpenAIError>
Creates a completion request for the provided prompt and parameters
Stream back partial progress. Tokens will be sent as data-only server-sent events as they become available, with the stream terminated by a data: [DONE] message.
CompletionResponseStream is a parsed SSE stream until a [DONE] is received from server.
Auto Trait Implementations§
impl<'c, C> !RefUnwindSafe for Completions<'c, C>
impl<'c, C> Send for Completions<'c, C>where C: Sync,
impl<'c, C> Sync for Completions<'c, C>where C: Sync,
impl<'c, C> Unpin for Completions<'c, C>
impl<'c, C> !UnwindSafe for Completions<'c, 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