pub struct Models { /* private fields */ }Implementations§
Source§impl Models
impl Models
Sourcepub async fn generate_content(
&self,
model: impl Into<String>,
contents: Vec<Content>,
) -> Result<GenerateContentResponse>
pub async fn generate_content( &self, model: impl Into<String>, contents: Vec<Content>, ) -> Result<GenerateContentResponse>
生成内容(默认配置)。
Sourcepub async fn generate_content_with_config(
&self,
model: impl Into<String>,
contents: Vec<Content>,
config: GenerateContentConfig,
) -> Result<GenerateContentResponse>
pub async fn generate_content_with_config( &self, model: impl Into<String>, contents: Vec<Content>, config: GenerateContentConfig, ) -> Result<GenerateContentResponse>
生成内容(自定义配置)。
Sourcepub async fn generate_content_with_callable_tools(
&self,
model: impl Into<String>,
contents: Vec<Content>,
config: GenerateContentConfig,
callable_tools: Vec<Box<dyn CallableTool>>,
) -> Result<GenerateContentResponse>
pub async fn generate_content_with_callable_tools( &self, model: impl Into<String>, contents: Vec<Content>, config: GenerateContentConfig, callable_tools: Vec<Box<dyn CallableTool>>, ) -> Result<GenerateContentResponse>
生成内容(自动函数调用 + callable tools)。
Sourcepub async fn generate_content_stream_with_callable_tools(
&self,
model: impl Into<String>,
contents: Vec<Content>,
config: GenerateContentConfig,
callable_tools: Vec<Box<dyn CallableTool>>,
) -> Result<Pin<Box<dyn Stream<Item = Result<GenerateContentResponse>> + Send>>>
pub async fn generate_content_stream_with_callable_tools( &self, model: impl Into<String>, contents: Vec<Content>, config: GenerateContentConfig, callable_tools: Vec<Box<dyn CallableTool>>, ) -> Result<Pin<Box<dyn Stream<Item = Result<GenerateContentResponse>> + Send>>>
生成内容(流式 + 自动函数调用)。
Sourcepub async fn generate_content_stream(
&self,
model: impl Into<String>,
contents: Vec<Content>,
config: GenerateContentConfig,
) -> Result<Pin<Box<dyn Stream<Item = Result<GenerateContentResponse>> + Send>>>
pub async fn generate_content_stream( &self, model: impl Into<String>, contents: Vec<Content>, config: GenerateContentConfig, ) -> Result<Pin<Box<dyn Stream<Item = Result<GenerateContentResponse>> + Send>>>
生成内容(流式)。
Sourcepub async fn embed_content(
&self,
model: impl Into<String>,
contents: Vec<Content>,
) -> Result<EmbedContentResponse>
pub async fn embed_content( &self, model: impl Into<String>, contents: Vec<Content>, ) -> Result<EmbedContentResponse>
生成嵌入向量(默认配置)。
Sourcepub async fn embed_content_with_config(
&self,
model: impl Into<String>,
contents: Vec<Content>,
config: EmbedContentConfig,
) -> Result<EmbedContentResponse>
pub async fn embed_content_with_config( &self, model: impl Into<String>, contents: Vec<Content>, config: EmbedContentConfig, ) -> Result<EmbedContentResponse>
生成嵌入向量(自定义配置)。
Sourcepub async fn count_tokens(
&self,
model: impl Into<String>,
contents: Vec<Content>,
) -> Result<CountTokensResponse>
pub async fn count_tokens( &self, model: impl Into<String>, contents: Vec<Content>, ) -> Result<CountTokensResponse>
计数 tokens(默认配置)。
Sourcepub async fn count_tokens_with_config(
&self,
model: impl Into<String>,
contents: Vec<Content>,
config: CountTokensConfig,
) -> Result<CountTokensResponse>
pub async fn count_tokens_with_config( &self, model: impl Into<String>, contents: Vec<Content>, config: CountTokensConfig, ) -> Result<CountTokensResponse>
计数 tokens(自定义配置)。
Sourcepub async fn compute_tokens(
&self,
model: impl Into<String>,
contents: Vec<Content>,
) -> Result<ComputeTokensResponse>
pub async fn compute_tokens( &self, model: impl Into<String>, contents: Vec<Content>, ) -> Result<ComputeTokensResponse>
计算 tokens(默认配置,仅 Vertex AI)。
Sourcepub async fn compute_tokens_with_config(
&self,
model: impl Into<String>,
contents: Vec<Content>,
config: ComputeTokensConfig,
) -> Result<ComputeTokensResponse>
pub async fn compute_tokens_with_config( &self, model: impl Into<String>, contents: Vec<Content>, config: ComputeTokensConfig, ) -> Result<ComputeTokensResponse>
计算 tokens(自定义配置,仅 Vertex AI)。
Sourcepub fn estimate_tokens_local(
&self,
contents: &[Content],
estimator: &dyn TokenEstimator,
) -> CountTokensResponse
pub fn estimate_tokens_local( &self, contents: &[Content], estimator: &dyn TokenEstimator, ) -> CountTokensResponse
本地估算 tokens(离线估算器)。
Sourcepub fn estimate_tokens_local_with_config(
&self,
contents: &[Content],
config: &CountTokensConfig,
estimator: &dyn TokenEstimator,
) -> CountTokensResponse
pub fn estimate_tokens_local_with_config( &self, contents: &[Content], config: &CountTokensConfig, estimator: &dyn TokenEstimator, ) -> CountTokensResponse
本地估算 tokens(包含 tools / system instruction / response schema)。
Sourcepub async fn count_tokens_or_estimate(
&self,
model: impl Into<String>,
contents: Vec<Content>,
config: CountTokensConfig,
estimator: Option<&dyn TokenEstimator>,
) -> Result<CountTokensResponse>
pub async fn count_tokens_or_estimate( &self, model: impl Into<String>, contents: Vec<Content>, config: CountTokensConfig, estimator: Option<&dyn TokenEstimator>, ) -> Result<CountTokensResponse>
计数 tokens(优先使用本地估算器)。
Sourcepub async fn generate_images(
&self,
model: impl Into<String>,
prompt: impl Into<String>,
config: GenerateImagesConfig,
) -> Result<GenerateImagesResponse>
pub async fn generate_images( &self, model: impl Into<String>, prompt: impl Into<String>, config: GenerateImagesConfig, ) -> Result<GenerateImagesResponse>
生成图像(Imagen)。
Sourcepub async fn edit_image(
&self,
model: impl Into<String>,
prompt: impl Into<String>,
reference_images: Vec<ReferenceImage>,
config: EditImageConfig,
) -> Result<EditImageResponse>
pub async fn edit_image( &self, model: impl Into<String>, prompt: impl Into<String>, reference_images: Vec<ReferenceImage>, config: EditImageConfig, ) -> Result<EditImageResponse>
编辑图像(仅 Vertex AI)。
Sourcepub async fn upscale_image(
&self,
model: impl Into<String>,
image: Image,
upscale_factor: impl Into<String>,
config: UpscaleImageConfig,
) -> Result<UpscaleImageResponse>
pub async fn upscale_image( &self, model: impl Into<String>, image: Image, upscale_factor: impl Into<String>, config: UpscaleImageConfig, ) -> Result<UpscaleImageResponse>
放大图像(仅 Vertex AI)。
Sourcepub async fn recontext_image(
&self,
model: impl Into<String>,
source: RecontextImageSource,
config: RecontextImageConfig,
) -> Result<RecontextImageResponse>
pub async fn recontext_image( &self, model: impl Into<String>, source: RecontextImageSource, config: RecontextImageConfig, ) -> Result<RecontextImageResponse>
Recontext 图像(Vertex AI)。
Sourcepub async fn segment_image(
&self,
model: impl Into<String>,
source: SegmentImageSource,
config: SegmentImageConfig,
) -> Result<SegmentImageResponse>
pub async fn segment_image( &self, model: impl Into<String>, source: SegmentImageSource, config: SegmentImageConfig, ) -> Result<SegmentImageResponse>
Segment 图像(Vertex AI)。
Sourcepub async fn generate_videos(
&self,
model: impl Into<String>,
source: GenerateVideosSource,
config: GenerateVideosConfig,
) -> Result<Operation>
pub async fn generate_videos( &self, model: impl Into<String>, source: GenerateVideosSource, config: GenerateVideosConfig, ) -> Result<Operation>
生成视频(Veo)。
Sourcepub async fn generate_videos_with_prompt(
&self,
model: impl Into<String>,
prompt: impl Into<String>,
config: GenerateVideosConfig,
) -> Result<Operation>
pub async fn generate_videos_with_prompt( &self, model: impl Into<String>, prompt: impl Into<String>, config: GenerateVideosConfig, ) -> Result<Operation>
生成视频(仅文本提示)。
Sourcepub async fn list(&self) -> Result<ListModelsResponse>
pub async fn list(&self) -> Result<ListModelsResponse>
列出模型(基础列表)。
Sourcepub async fn list_with_config(
&self,
config: ListModelsConfig,
) -> Result<ListModelsResponse>
pub async fn list_with_config( &self, config: ListModelsConfig, ) -> Result<ListModelsResponse>
列出模型(带配置)。
Sourcepub async fn all_with_config(
&self,
config: ListModelsConfig,
) -> Result<Vec<Model>>
pub async fn all_with_config( &self, config: ListModelsConfig, ) -> Result<Vec<Model>>
列出所有模型(带配置,自动翻页)。
Sourcepub async fn update(
&self,
model: impl Into<String>,
config: UpdateModelConfig,
) -> Result<Model>
pub async fn update( &self, model: impl Into<String>, config: UpdateModelConfig, ) -> Result<Model>
更新模型信息。
Sourcepub async fn delete(
&self,
model: impl Into<String>,
config: DeleteModelConfig,
) -> Result<DeleteModelResponse>
pub async fn delete( &self, model: impl Into<String>, config: DeleteModelConfig, ) -> Result<DeleteModelResponse>
删除模型。
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Models
impl !RefUnwindSafe for Models
impl Send for Models
impl Sync for Models
impl Unpin for Models
impl !UnwindSafe for Models
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