palm.connect {PaLMr}R Documentation

Set up and connect to the Google PaLM 2 text model.

Description

This function establishes a connection to the Google PaLM text model by specifying the API key, and model version.

Usage

palm.connect(version, api, proxy = FALSE)

Arguments

version

A character string representing the model version to use, either "v1beta2" or "v1beta3".

api

A character string representing the API key for accessing the Google PaLM 2 text model. The API key should be 39 characters long and must be of the "character" class.

proxy

A boolean value indicating whether to use a proxy for accessing the API URL (default is FALSE). If your local internet cannot access the APIs, set this parameter to TRUE.

Details

This function performs the necessary setup to connect to the Google PaLM 2 text model. It validates the provided API key and checks the correctness of the model version. If the input is valid, it constructs the API request and sends it to the PaLM 2 API endpoint.

If an error occurs during the API request, such as an invalid API key or input parameters, an error message is displayed. If the API request is successful, the function prints the model details to the console and returns a character vector with the API key, model version, and model type.

Value

If successful, the function returns a character vector containing the API key, model version, and proxy status. If the API response indicates an error, the function stops execution and provides an error message.

See Also

PaLMr - Documentation

Examples

## Not run: 
# Connect to the model, replace API_KEY with your api key
palm.model = palm.connect("v1beta2",
                          "API_KEY",
                          FALSE)
palm.model

## End(Not run)


[Package PaLMr version 0.2.0 Index]