createAIModel static method

Future<AIModel> createAIModel(
  1. AiModelType aiModelType,
  2. String apiKey
)

Create an AI Model based on the type and API key

Implementation

static Future<AIModel> createAIModel(
  AiModelType aiModelType,
  String apiKey,
) async {
  AIModel aiModel;

  if (aiModelType == AiModelType.gemini) {
    GeminiAI gAI = GeminiAI();
    gAI.setApiKey(apiKey);
    aiModel = gAI;
  } else {
    throw Exception('Invalid AI Model Type');
  }

  return aiModel;
}