gemini_ask | R Documentation |
This function lets the user interact with Google's Gemini LLM Model using its API, and returns the rendered reply.
gemini_ask(
ask,
secret_key = get_creds("gemini")$api_key,
url = Sys.getenv("LARES_GEMINI_API"),
temperature = 0.5,
max_tokens = 1024,
quiet = FALSE,
...
)
gemini_image(
ask,
image,
secret_key = get_creds("gemini")$api_key,
url = Sys.getenv("LARES_GEMINI_API"),
temperature = 0.5,
max_tokens = 1024,
quiet = FALSE,
...
)
ask |
Character. Redacted prompt to ask. If multiple asks are requested, they will be concatenated with "+" into a single request. |
secret_key |
Character. Secret Key. Get yours in: platform.openai.com for OpenAI or makersuite.google.com for Gemini. |
url |
Character. Base API URL. |
temperature |
Numeric. The temperature to use for generating
the response. Default is 0.5. The lower the |
max_tokens |
Integer. The maximum number of tokens in the response. |
quiet |
Boolean. Keep quiet? If not, message will be shown. |
... |
Additional parameters. |
image |
Character. Data to be encoded/decoded. It can be a raw vector, text connection or file name. |
(Invisible) list. Content returned from API POST and processed.
Other API:
bring_api()
,
fb_accounts()
,
fb_ads()
,
fb_creatives()
,
fb_insights()
,
fb_process()
,
fb_report_check()
,
fb_rf()
,
fb_token()
,
gpt_ask()
,
li_auth()
,
li_profile()
,
queryGA()
,
slackSend()
Other LLM:
gpt_ask()
,
gpt_prompter()
## Not run:
api_key <- get_credentials()$gemini$api_key
# Open question:
gemini_ask("Can you write an R function to plot a dummy histogram?", api_key)
# Image question
image <- "man/figures/automl_map.png"
gemini_image("Can you explain this flow with more detail?", image, api_key)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.