Interface IGenerativeAI
- Namespace
- GenerativeAI
- Assembly
- GenerativeAI.dll
Represents an interface defining operations for generative AI systems, including initializing models, retrieving model details, listing available models, and accessing platform-specific adapters.
public interface IGenerativeAI
- Extension Methods
Methods
CreateEmbeddingModel(string)
Creates and initializes an embedding model for use in embedding-related AI tasks. The created model is configured with the provided model name and integrates with the underlying platform adapter.
EmbeddingModel CreateEmbeddingModel(string modelName)
Parameters
modelNamestringThe name of the embedding model to initialize, used to identify the specific AI model for embeddings.
Returns
- EmbeddingModel
An instance of EmbeddingModel initialized with the specified model name and platform configurations.
CreateGenerativeModel(string, GenerationConfig?, ICollection<SafetySetting>?, string?)
Creates and initializes a generative model capable of producing AI-generated content. The model is configured with the specified parameters to customize its behavior and ensure safety compliance when generating content.
GenerativeModel CreateGenerativeModel(string modelName, GenerationConfig? config = null, ICollection<SafetySetting>? safetyRatings = null, string? systemInstruction = null)
Parameters
modelNamestringThe name of the generative model to initialize, used to identify the specific AI model for content generation.
configGenerationConfigOptional parameter specifying the generation configuration, such as temperature, max tokens, or other customization options.
safetyRatingsICollection<SafetySetting>Optional collection of safety settings used to enforce content safety thresholds during generation.
systemInstructionstringOptional system-level instruction guiding the behavior of the generative model.
Returns
- GenerativeModel
An instance of GenerativeModel configured with the specified parameters for generative tasks.
GetModelAsync(string, CancellationToken)
Retrieves a specific AI model by its name asynchronously from the Google's AI platform.
Task<Model> GetModelAsync(string modelName, CancellationToken cancellationToken = default)
Parameters
modelNamestringThe unique name of the model to retrieve.
cancellationTokenCancellationTokenA token to monitor for cancellation requests.
Returns
- Task<Model>
A task representing the asynchronous operation, containing the requested model details as a Model object.
GetPlatformAdapter()
Retrieves the platform adapter responsible for handling platform-specific operations such as authentication, API versioning, and URL construction. The platform adapter ensures seamless integration with the underlying platform by managing necessary credentials and configurations.
IPlatformAdapter GetPlatformAdapter()
Returns
- IPlatformAdapter
An instance of IPlatformAdapter that provides methods for platform-specific functionality.
ListModelsAsync(int?, string?, CancellationToken)
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.
Task<ListModelsResponse> ListModelsAsync(int? pageSize = null, string? pageToken = null, CancellationToken cancellationToken = default)
Parameters
pageSizeint?Optional parameter specifying the maximum number of models to retrieve per page. Defaults to null for the API's standard page size.
pageTokenstringOptional parameter indicating the token for the next page of results, as provided in a previous response.
cancellationTokenCancellationTokenOptional parameter for propagating cancellation signals, allowing the operation to be canceled if needed.
Returns
- Task<ListModelsResponse>
A task representing the asynchronous operation, which contains a ListModelsResponse with the retrieved models and pagination details.