• Returns a reference to a model that can be used in generate calls.

    await ai.generate({
    prompt: 'hi',
    model: gemini('gemini-1.5-flash')
    });

    Parameters

    • version: GeminiVersionString
    • options: {
          functionCallingConfig?: {
              allowedFunctionNames?: string[];
              mode?: "MODE_UNSPECIFIED" | "AUTO" | "ANY" | "NONE";
          };
          googleSearchRetrieval?: { disableAttribution?: boolean };
          location?: string;
          maxOutputTokens?: number;
          safetySettings?: { category: HarmCategory; threshold: HarmBlockThreshold }[];
          stopSequences?: string[];
          temperature?: number;
          topK?: number;
          topP?: number;
          version?: string;
          vertexRetrieval?: {
              datastore: {
                  dataStoreId: string;
                  location?: string;
                  projectId?: string;
              };
              disableAttribution?: boolean;
          };
      } = {}
      • OptionalfunctionCallingConfig?: {
            allowedFunctionNames?: string[];
            mode?: "MODE_UNSPECIFIED" | "AUTO" | "ANY" | "NONE";
        }

        Function calling options.

        E.g. forced tool call:

          config: {
        functionCallingConfig: {
        mode: 'ANY',
        }
        }
      • OptionalgoogleSearchRetrieval?: { disableAttribution?: boolean }

        Google Search retrieval options.

          config: {
        googleSearchRetrieval: {
        disableAttribution: true,
        }
        }
      • Optionallocation?: string

        GCP region (e.g. us-central1)

      • OptionalmaxOutputTokens?: number
      • OptionalsafetySettings?: { category: HarmCategory; threshold: HarmBlockThreshold }[]

        Safety filter settings. See: https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/configure-safety-filters#configurable-filters

        E.g.

        config: {
        safetySettings: [
        {
        category: 'HARM_CATEGORY_HATE_SPEECH',
        threshold: 'BLOCK_LOW_AND_ABOVE',
        },
        {
        category: 'HARM_CATEGORY_DANGEROUS_CONTENT',
        threshold: 'BLOCK_MEDIUM_AND_ABOVE',
        },
        {
        category: 'HARM_CATEGORY_HARASSMENT',
        threshold: 'BLOCK_ONLY_HIGH',
        },
        {
        category: 'HARM_CATEGORY_SEXUALLY_EXPLICIT',
        threshold: 'BLOCK_NONE',
        },
        ],
        }
      • OptionalstopSequences?: string[]
      • Optionaltemperature?: number
      • OptionaltopK?: number
      • OptionaltopP?: number
      • Optionalversion?: string
      • OptionalvertexRetrieval?: {
            datastore: {
                dataStoreId: string;
                location?: string;
                projectId?: string;
            };
            disableAttribution?: boolean;
        }

        Vertex retrieval options.

        E.g.

          config: {
        vertexRetrieval: {
        datastore: {
        projectId: 'your-cloud-project',
        location: 'us-central1',
        collection: 'your-collection',
        },
        disableAttribution: true,
        }
        }

    Returns ModelReference<typeof GeminiConfigSchema>