pub async fn stream(self) -> reqwest::Result<impl TextCompletionStream> {
        let url = self.url();
        let request = TextCompletionRequest {
            prompt: self.prompt,
            max_tokens: self.max_tokens,
            temperature: self.temperature,
            top_k: self.top_k,
            top_p: self.top_p,
            stream: Some(true),
            stop: None,
        };

        self.engine
            .text_synth
            .post(url)
            .json(&request)
            .send()
            .await?
            .bytes_stream()
            .map(|bytes| {
                bytes
                    .map(|bytes| bytes.slice(..bytes.len() - 2))
                    .map(|bytes| serde_json::from_slice::<crate::UntaggedResult<_>>(&bytes))
                    .map(|result| result.map(Into::into))
            })
            .pipe(Ok)
    }
/// Create a text completion stream.
Create a text completion stream.
Create a text completion stream .
pub async fn stream(self) -> reqwest::Result<impl TextCompletionStream> {
        let url = self.url();
        let request = TextCompletionRequest {
            prompt: self.prompt,
            max_tokens: self.max_tokens,
            temperature: self.temperature,
            top_k: self.top_k,
            top_p: self.top_p,
            stream: Some(true),
            stop: None,
        };
        self.engine
            .text_synth
            .post(url)
            .json(&request)
            .send()
            .await?
            .bytes_stream()
            .map(|bytes| {
                bytes
                    .map(|bytes| bytes.slice(..bytes.len() - 2))
                    .map(|bytes| serde_json::from_slice::<crate::UntaggedResult<_>>(&bytes))
                    .map(|result| result.map(Into::into))
            })
            .pipe(Ok)
    }
pub async fn stream ( self ) -> reqwest :: Result < impl TextCompletionStream > { let url = self . url ( ) ; let request = TextCompletionRequest { prompt : self . prompt , max_tokens : self . max_tokens , temperature : self . temperature , top_k : self . top_k , top_p : self . top_p , stream : Some ( true ) , stop : None , } ; self . engine . text_synth . post ( url ) . json ( & request ) . send ( ) . await ? . bytes_stream ( ) . map ( | bytes | { bytes . map ( | bytes | bytes . slice ( .. bytes . len ( ) - 2 ) ) . map ( | bytes | serde_json :: from_slice :: < crate :: UntaggedResult < _ > > ( & bytes ) ) . map ( | result | result . map ( Into :: into ) ) } ) . pipe ( Ok ) }
Create a text completion stream.
Create a text completion stream .
self
self