GenAIListModelsAsync Method

Asynchronously retrieves a list of AI models available in Google's AI platform. This method supports pagination to fetch models in batches using the specified page size and page token, enabling efficient handling of large model datasets.

Definition

Namespace: GenerativeAI
Assembly: GenerativeAI (in GenerativeAI.dll) Version: 2.0.2+aa51399cad6d90cc71158d589a6268608b3c1893
C#
public Task<ListModelsResponse> ListModelsAsync(
	int? pageSize = null,
	string? pageToken = null,
	CancellationToken cancellationToken = default
)

Parameters

pageSize  NullableInt32  (Optional)
Optional parameter specifying the maximum number of models to retrieve per page. Defaults to null for the API's standard page size.
pageToken  String  (Optional)
Optional parameter indicating the token for the next page of results, as provided in a previous response.
cancellationToken  CancellationToken  (Optional)
Optional parameter for propagating cancellation signals, allowing the operation to be canceled if needed.

Return Value

TaskListModelsResponse
A task representing the asynchronous operation, which contains a ListModelsResponse with the retrieved models and pagination details.

See Also