generativeModel method

GenerativeModel generativeModel({
  1. required String model,
  2. List<SafetySetting>? safetySettings,
  3. GenerationConfig? generationConfig,
  4. List<Tool>? tools,
  5. ToolConfig? toolConfig,
  6. Content? systemInstruction,
  7. Client? httpClient,
})

Create a GenerativeModel backed by the generative model named model.

The model argument can be a model name (such as 'gemini-pro') or a model code (such as 'models/gemini-pro'). There is no creation time check for whether the model string identifies a known and supported model. If not, attempts to generate content will fail.

The optional safetySettings and generationConfig can be used to control and guide the generation. See SafetySetting and GenerationConfig for details.

The optional httpClient can be used to customize HTTP request handling, such as adding support for cancelling in-flight requests.

Implementation

GenerativeModel generativeModel({
  required String model,
  List<SafetySetting>? safetySettings,
  GenerationConfig? generationConfig,
  List<Tool>? tools,
  ToolConfig? toolConfig,
  Content? systemInstruction,
  http.Client? httpClient,
}) {
  return createGenerativeModel(
    model: model,
    app: app,
    appCheck: appCheck,
    useVertexBackend: _useVertexBackend,
    auth: auth,
    location: location,
    safetySettings: safetySettings,
    generationConfig: generationConfig,
    tools: tools,
    toolConfig: toolConfig,
    systemInstruction: systemInstruction,
    useLimitedUseAppCheckTokens: useLimitedUseAppCheckTokens,
    httpClient: httpClient,
  );
}