/** * @license * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { Content, InputContent } from "./content"; import { HarmBlockThreshold, HarmCategory, TaskType } from "./enums"; /** * Base parameters for a number of methods. * @public */ export interface BaseParams { safetySettings?: SafetySetting[]; generationConfig?: GenerationConfig; } /** * Params passed to {@link GoogleGenerativeAI.getGenerativeModel}. * @public */ export interface ModelParams extends BaseParams { model: string; } /** * Request sent to `generateContent` endpoint. * @public */ export interface GenerateContentRequest extends BaseParams { contents: Content[]; } /** * Safety setting that can be sent as part of request parameters. * @public */ export interface SafetySetting { category: HarmCategory; threshold: HarmBlockThreshold; } /** * Config options for content-related requests * @public */ export interface GenerationConfig { candidateCount?: number; stopSequences?: string[]; maxOutputTokens?: number; temperature?: number; topP?: number; topK?: number; } /** * Params for {@link GenerativeModel.startChat}. * @public */ export interface StartChatParams extends BaseParams { history?: InputContent[]; } /** * Params for calling {@link GenerativeModel.countTokens} * @public */ export interface CountTokensRequest { contents: Content[]; } /** * Params for calling {@link GenerativeModel.embedContent} * @public */ export interface EmbedContentRequest { content: Content; taskType?: TaskType; title?: string; } /** * Params for calling {@link GenerativeModel.batchEmbedContents} * @public */ export interface BatchEmbedContentsRequest { requests: EmbedContentRequest[]; }