pub struct GeminiBuilder { /* private fields */ }
Expand description
A builder for the Gemini
client.
§Examples
§Basic usage
use gemini_rust::{GeminiBuilder, Model};
let gemini = GeminiBuilder::new("YOUR_API_KEY")
.with_model(Model::Gemini25Pro)
.build()?;
§With proxy configuration
use gemini_rust::{GeminiBuilder, Model};
use reqwest::{ClientBuilder, Proxy};
let proxy = Proxy::https("https://my.proxy")?;
let http_client = ClientBuilder::new().proxy(proxy);
let gemini = GeminiBuilder::new("YOUR_API_KEY")
.with_http_client(http_client)
.build()?;
Implementations§
Source§impl GeminiBuilder
impl GeminiBuilder
Sourcepub fn new<K: Into<String>>(key: K) -> Self
pub fn new<K: Into<String>>(key: K) -> Self
Creates a new GeminiBuilder
with the given API key.
Sourcepub fn with_model<M: Into<Model>>(self, model: M) -> Self
pub fn with_model<M: Into<Model>>(self, model: M) -> Self
Sets the model for the client.
Sourcepub fn with_http_client(self, client_builder: ClientBuilder) -> Self
pub fn with_http_client(self, client_builder: ClientBuilder) -> Self
Sets a custom reqwest::ClientBuilder
.
Sourcepub fn with_base_url(self, base_url: Url) -> Self
pub fn with_base_url(self, base_url: Url) -> Self
Sets a custom base URL for the API.
Auto Trait Implementations§
impl Freeze for GeminiBuilder
impl !RefUnwindSafe for GeminiBuilder
impl Send for GeminiBuilder
impl Sync for GeminiBuilder
impl Unpin for GeminiBuilder
impl !UnwindSafe for GeminiBuilder
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