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. We recommend most users use our Chat completions API. Learn more
Related guide: Legacy Completions
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> Freeze for Completions<'c, C>
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