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>
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>
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>
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>
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>
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> + Send,
contents: Vec<Content>,
config: CountTokensConfig,
estimator: Option<&(dyn TokenEstimator + Sync)>,
) -> Result<CountTokensResponse>
pub async fn count_tokens_or_estimate( &self, model: impl Into<String> + Send, contents: Vec<Content>, config: CountTokensConfig, estimator: Option<&(dyn TokenEstimator + Sync)>, ) -> Result<CountTokensResponse>
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>
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>
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>
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>
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>
Sourcepub async fn generate_videos(
&self,
model: impl Into<String>,
source: GenerateVideosSource,
config: GenerateVideosConfig,
) -> Result<GenerateVideosOperation>
pub async fn generate_videos( &self, model: impl Into<String>, source: GenerateVideosSource, config: GenerateVideosConfig, ) -> Result<GenerateVideosOperation>
Sourcepub async fn generate_videos_with_prompt(
&self,
model: impl Into<String>,
prompt: impl Into<String>,
config: GenerateVideosConfig,
) -> Result<GenerateVideosOperation>
pub async fn generate_videos_with_prompt( &self, model: impl Into<String>, prompt: impl Into<String>, config: GenerateVideosConfig, ) -> Result<GenerateVideosOperation>
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 UnsafeUnpin 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