Gemini

class Gemini(apiKey: String)

Represents a client for interacting with the Gemini API, providing methods to extract content, embed content, and retrieve model information.

Constructors

Link copied to clipboard
constructor(apiKey: String)

Functions

Link copied to clipboard
fun batchEmbedContents(inputJson: BatchEmbedRequest, model: String = "embedding-001"): BatchEmbedResponse

Embeds contents in batch using the embedding-001 model.

Link copied to clipboard
fun countTokens(inputJson: CountTokensRequest, model: String = "gemini-pro"): TotalTokens
Link copied to clipboard
fun embedContent(inputJson: EmbedContentRequest, model: String = "embedding-001"): EmbedResponse

Embeds content using the embedding-001 model.

Link copied to clipboard
fun generateContent(inputJson: GenerateContentRequest, model: String = "gemini-pro"): GenerateContentResponse

Generates content based on the provided input JSON using a specified model.

Link copied to clipboard
fun getContent(urlStr: String, inputJson: String? = null): String

Performs a POST request to the specified URL string with the given input JSON payload.

Link copied to clipboard

Retrieves a collection of models available in the Gemini API.