pub struct InteractionsCompletionModel<T = Client> {
pub model: String,
/* private fields */
}Expand description
Completion model wrapper for the Gemini Interactions API.
Fields§
§model: StringImplementations§
Source§impl<T> InteractionsCompletionModel<T>
impl<T> InteractionsCompletionModel<T>
Sourcepub fn new(client: InteractionsClient<T>, model: impl Into<String>) -> Self
pub fn new(client: InteractionsClient<T>, model: impl Into<String>) -> Self
Create a new Interactions completion model for the given client and model name.
Sourcepub fn with_model(client: InteractionsClient<T>, model: &str) -> Self
pub fn with_model(client: InteractionsClient<T>, model: &str) -> Self
Create a new Interactions completion model using a string model name.
Sourcepub fn generate_content_api(self) -> CompletionModel<T>
pub fn generate_content_api(self) -> CompletionModel<T>
Use the GenerateContent API instead of Interactions.
Source§impl<T> InteractionsCompletionModel<T>
impl<T> InteractionsCompletionModel<T>
Sourcepub async fn create_interaction(
&self,
completion_request: CompletionRequest,
) -> Result<Interaction, CompletionError>
pub async fn create_interaction( &self, completion_request: CompletionRequest, ) -> Result<Interaction, CompletionError>
Create an interaction and return the raw response payload.
Sourcepub async fn get_interaction(
&self,
interaction_id: impl AsRef<str>,
) -> Result<Interaction, CompletionError>
pub async fn get_interaction( &self, interaction_id: impl AsRef<str>, ) -> Result<Interaction, CompletionError>
Fetch an interaction by ID for polling background tasks.
Sourcepub async fn stream_interaction_events(
&self,
completion_request: CompletionRequest,
) -> Result<InteractionEventStream, CompletionError>
pub async fn stream_interaction_events( &self, completion_request: CompletionRequest, ) -> Result<InteractionEventStream, CompletionError>
Start an interaction and stream raw SSE events.
Sourcepub async fn stream_interaction_events_by_id(
&self,
interaction_id: impl AsRef<str>,
last_event_id: Option<&str>,
) -> Result<InteractionEventStream, CompletionError>
pub async fn stream_interaction_events_by_id( &self, interaction_id: impl AsRef<str>, last_event_id: Option<&str>, ) -> Result<InteractionEventStream, CompletionError>
Resume an interaction stream by ID and optional last event ID.
Trait Implementations§
Source§impl<T: Clone> Clone for InteractionsCompletionModel<T>
impl<T: Clone> Clone for InteractionsCompletionModel<T>
Source§fn clone(&self) -> InteractionsCompletionModel<T>
fn clone(&self) -> InteractionsCompletionModel<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<T> CompletionModel for InteractionsCompletionModel<T>
impl<T> CompletionModel for InteractionsCompletionModel<T>
Source§type Response = Interaction
type Response = Interaction
Source§type StreamingResponse = StreamingCompletionResponse
type StreamingResponse = StreamingCompletionResponse
type Client = Client<GeminiInteractionsExt, T>
fn make(client: &Self::Client, model: impl Into<String>) -> Self
Source§async fn completion(
&self,
completion_request: CompletionRequest,
) -> Result<CompletionResponse<Interaction>, CompletionError>
async fn completion( &self, completion_request: CompletionRequest, ) -> Result<CompletionResponse<Interaction>, CompletionError>
async fn stream( &self, request: CompletionRequest, ) -> Result<StreamingCompletionResponse<Self::StreamingResponse>, CompletionError>
Source§fn completion_request(
&self,
prompt: impl Into<Message>,
) -> CompletionRequestBuilder<Self>
fn completion_request( &self, prompt: impl Into<Message>, ) -> CompletionRequestBuilder<Self>
prompt.Auto Trait Implementations§
impl<T> Freeze for InteractionsCompletionModel<T>where
T: Freeze,
impl<T> RefUnwindSafe for InteractionsCompletionModel<T>where
T: RefUnwindSafe,
impl<T> Send for InteractionsCompletionModel<T>where
T: Send,
impl<T> Sync for InteractionsCompletionModel<T>where
T: Sync,
impl<T> Unpin for InteractionsCompletionModel<T>where
T: Unpin,
impl<T> UnsafeUnpin for InteractionsCompletionModel<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for InteractionsCompletionModel<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T, R> CompletionModelDyn for T
impl<T, R> CompletionModelDyn for T
Source§fn completion_request(
&self,
prompt: Message,
) -> CompletionRequestBuilder<CompletionModelHandle<'_>>
👎Deprecated since 0.25.0: DynClientBuilder and related features have been deprecated and will be removed in a future release. In this case, use CompletionModel instead.
fn completion_request( &self, prompt: Message, ) -> CompletionRequestBuilder<CompletionModelHandle<'_>>
DynClientBuilder and related features have been deprecated and will be removed in a future release. In this case, use CompletionModel instead.
Generates a completion request builder for the given prompt.
Source§fn completion(
&self,
request: CompletionRequest,
) -> Pin<Box<dyn Future<Output = Result<CompletionResponse<()>, CompletionError>> + Send + '_>>
fn completion( &self, request: CompletionRequest, ) -> Pin<Box<dyn Future<Output = Result<CompletionResponse<()>, CompletionError>> + Send + '_>>
DynClientBuilder and related features have been deprecated and will be removed in a future release. In this case, use CompletionModel instead.
Source§fn stream(
&self,
request: CompletionRequest,
) -> Pin<Box<dyn Future<Output = Result<StreamingCompletionResponse<FinalCompletionResponse>, CompletionError>> + Send + '_>>
fn stream( &self, request: CompletionRequest, ) -> Pin<Box<dyn Future<Output = Result<StreamingCompletionResponse<FinalCompletionResponse>, CompletionError>> + Send + '_>>
DynClientBuilder and related features have been deprecated and will be removed in a future release. In this case, use CompletionModel instead.
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
Source§impl<T> CloneDebuggableStorage for Twhere
T: DebuggableStorage + Clone,
impl<T> CloneDebuggableStorage for Twhere
T: DebuggableStorage + Clone,
fn clone_storage(&self) -> Box<dyn CloneDebuggableStorage>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> CloneableStorage for T
impl<T> CloneableStorage for T
fn clone_storage(&self) -> Box<dyn CloneableStorage>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more