pub struct ChatCompletionStreamRequestBuilder { /* private fields */ }Expand description
表示聊天补全流式请求构建器。
Implementations§
Source§impl ChatCompletionStreamRequestBuilder
impl ChatCompletionStreamRequestBuilder
Sourcepub fn messages(self, messages: Vec<ChatCompletionMessage>) -> Self
pub fn messages(self, messages: Vec<ChatCompletionMessage>) -> Self
设置消息列表。
Sourcepub fn message_system(self, content: impl Into<String>) -> Self
pub fn message_system(self, content: impl Into<String>) -> Self
追加一条 system 消息。
Sourcepub fn message_user(self, content: impl Into<String>) -> Self
pub fn message_user(self, content: impl Into<String>) -> Self
追加一条 user 消息。
Sourcepub fn message_assistant(self, content: impl Into<String>) -> Self
pub fn message_assistant(self, content: impl Into<String>) -> Self
追加一条 assistant 消息。
Sourcepub fn temperature(self, temperature: f32) -> Self
pub fn temperature(self, temperature: f32) -> Self
设置温度。
Sourcepub fn max_tokens(self, max_tokens: u32) -> Self
pub fn max_tokens(self, max_tokens: u32) -> Self
设置最大 token 数。
Sourcepub fn extra_body(
self,
key: impl Into<String>,
value: impl Into<JsonPayload>,
) -> Self
pub fn extra_body( self, key: impl Into<String>, value: impl Into<JsonPayload>, ) -> Self
添加额外字段。
Sourcepub fn provider_option(
self,
key: impl Into<String>,
value: impl Into<JsonPayload>,
) -> Self
pub fn provider_option( self, key: impl Into<String>, value: impl Into<JsonPayload>, ) -> Self
添加 provider 选项。
Sourcepub async fn send(self) -> Result<ChatCompletionStream>
pub async fn send(self) -> Result<ChatCompletionStream>
Sourcepub async fn send_events(self) -> Result<ChatCompletionEventStream>
pub async fn send_events(self) -> Result<ChatCompletionEventStream>
Trait Implementations§
Source§impl Clone for ChatCompletionStreamRequestBuilder
impl Clone for ChatCompletionStreamRequestBuilder
Source§fn clone(&self) -> ChatCompletionStreamRequestBuilder
fn clone(&self) -> ChatCompletionStreamRequestBuilder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ChatCompletionStreamRequestBuilder
impl !RefUnwindSafe for ChatCompletionStreamRequestBuilder
impl Send for ChatCompletionStreamRequestBuilder
impl Sync for ChatCompletionStreamRequestBuilder
impl Unpin for ChatCompletionStreamRequestBuilder
impl UnsafeUnpin for ChatCompletionStreamRequestBuilder
impl !UnwindSafe for ChatCompletionStreamRequestBuilder
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