pub struct GemSession { /* private fields */ }
Expand description
Represents a session with the Gemini API.
Implementations§
Source§impl GemSession
impl GemSession
Sourcepub fn new(api_key: String) -> Self
pub fn new(api_key: String) -> Self
Creates a new GemSession
with default settings and the provided API key.
Sourcepub fn Builder() -> GemSessionBuilder
pub fn Builder() -> GemSessionBuilder
Returns a new GemSessionBuilder
for creating a customized GemSession
.
Sourcepub async fn send_message(
&mut self,
message: &str,
role: Role,
settings: &Settings,
) -> ResponseResult
pub async fn send_message( &mut self, message: &str, role: Role, settings: &Settings, ) -> ResponseResult
Sends a message to the Gemini API and returns the response.
Sourcepub async fn send_file(
&mut self,
file_data: FileData,
role: Role,
settings: &Settings,
) -> ResponseResult
pub async fn send_file( &mut self, file_data: FileData, role: Role, settings: &Settings, ) -> ResponseResult
Sends a file to the Gemini API and returns the response.
Sourcepub async fn send_blob(
&mut self,
blob: Blob,
role: Role,
settings: &Settings,
) -> ResponseResult
pub async fn send_blob( &mut self, blob: Blob, role: Role, settings: &Settings, ) -> ResponseResult
Sends a blob to the Gemini API and returns the response.
Sourcepub async fn send_message_with_file(
&mut self,
message: &str,
file_data: FileData,
role: Role,
settings: &Settings,
) -> ResponseResult
pub async fn send_message_with_file( &mut self, message: &str, file_data: FileData, role: Role, settings: &Settings, ) -> ResponseResult
Sends a message with an attached file to the Gemini API and returns the response.
Sourcepub async fn send_message_with_blob(
&mut self,
message: &str,
blob: Blob,
role: Role,
settings: &Settings,
) -> ResponseResult
pub async fn send_message_with_blob( &mut self, message: &str, blob: Blob, role: Role, settings: &Settings, ) -> ResponseResult
Sends a message with an attached blob to the Gemini API and returns the response.
Sourcepub async fn send_message_stream(
&mut self,
message: &str,
role: Role,
settings: &Settings,
) -> StreamResponseResult
pub async fn send_message_stream( &mut self, message: &str, role: Role, settings: &Settings, ) -> StreamResponseResult
Sends a message to the Gemini API and returns a stream of responses.
Sourcepub async fn send_file_stream(
&mut self,
file_data: FileData,
role: Role,
settings: &Settings,
) -> StreamResponseResult
pub async fn send_file_stream( &mut self, file_data: FileData, role: Role, settings: &Settings, ) -> StreamResponseResult
Sends a file to the Gemini API and returns a stream of responses.
Sourcepub async fn send_blob_stream(
&mut self,
blob: Blob,
role: Role,
settings: &Settings,
) -> StreamResponseResult
pub async fn send_blob_stream( &mut self, blob: Blob, role: Role, settings: &Settings, ) -> StreamResponseResult
Sends a blob to the Gemini API and returns a stream of responses.
Sourcepub async fn send_message_with_file_stream(
&mut self,
message: &str,
file_data: FileData,
role: Role,
settings: &Settings,
) -> StreamResponseResult
pub async fn send_message_with_file_stream( &mut self, message: &str, file_data: FileData, role: Role, settings: &Settings, ) -> StreamResponseResult
Sends a message with an attached file to the Gemini API and returns a stream of responses.
Sourcepub async fn send_message_with_blob_stream(
&mut self,
message: &str,
blob: Blob,
role: Role,
settings: &Settings,
) -> StreamResponseResult
pub async fn send_message_with_blob_stream( &mut self, message: &str, blob: Blob, role: Role, settings: &Settings, ) -> StreamResponseResult
Sends a message with an attached blob to the Gemini API and returns a stream of responses.