pub struct Client { /* private fields */ }Implementations§
Source§impl Client
impl Client
Sourcepub fn builder() -> ClientBuilder
pub fn builder() -> ClientBuilder
Create a new client builder that uses environment variables as defaults.
You can override any values using the builder methods:
.with_project()- override project.with_location()- override location.with_credentials()- override credentials
Example:
// Use all env vars
let client = Client::builder().build()?;
// Override just the location
let client = Client::builder().with_location("us-central1").build()?;
// Override project and location
let client = Client::builder()
.with_project("my-project")
.with_location("us-central1")
.build()?;Sourcepub fn new() -> Result<Self, VertexAiClientError>
pub fn new() -> Result<Self, VertexAiClientError>
Create a new client using environment variables for project, location, and credentials.
Reads from:
GOOGLE_CLOUD_PROJECT(required)GOOGLE_CLOUD_LOCATION(optional, defaults to “global”)GOOGLE_CLOUD_SERVICE_ACCOUNT(optional, for service account impersonation)
Sourcepub fn from_env() -> Result<Self, VertexAiClientError>
pub fn from_env() -> Result<Self, VertexAiClientError>
Create a client using environment variables for project, location, and credentials.
This is a convenience method that calls the ProviderClient::from_env() trait method.
Reads from:
GOOGLE_CLOUD_PROJECT(required)GOOGLE_CLOUD_LOCATION(optional, defaults to “global”)GOOGLE_CLOUD_SERVICE_ACCOUNT(optional, for service account impersonation)
pub fn project(&self) -> &str
pub fn location(&self) -> &str
pub async fn get_inner(&self) -> Result<&PredictionService, VertexAiClientError>
Trait Implementations§
Source§impl CompletionClient for Client
impl CompletionClient for Client
Source§type CompletionModel = CompletionModel
type CompletionModel = CompletionModel
The type of CompletionModel used by the client.
Source§fn completion_model(&self, model: impl Into<String>) -> Self::CompletionModel
fn completion_model(&self, model: impl Into<String>) -> Self::CompletionModel
Create a completion model with the given model. Read more
Source§fn agent(&self, model: impl Into<String>) -> AgentBuilder<Self::CompletionModel>
fn agent(&self, model: impl Into<String>) -> AgentBuilder<Self::CompletionModel>
Create an agent builder with the given completion model. Read more
Source§fn extractor<T>(
&self,
model: impl Into<String>,
) -> ExtractorBuilder<Self::CompletionModel, T>
fn extractor<T>( &self, model: impl Into<String>, ) -> ExtractorBuilder<Self::CompletionModel, T>
Create an extractor builder with the given completion model.
Source§impl ProviderClient for Client
impl ProviderClient for Client
Source§impl VerifyClient for Client
impl VerifyClient for Client
Auto Trait Implementations§
impl Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnsafeUnpin for Client
impl !UnwindSafe for Client
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