From 48e966791136d991fed7d83cd2bc8a1f5d682f0c Mon Sep 17 00:00:00 2001 From: Jinhwan Kim Date: Wed, 18 Dec 2024 13:02:06 +0900 Subject: [PATCH] docs: gemini_audio in README version updated as 0.6.2 --- DESCRIPTION | 2 +- README.md | 17 +++++++++++++++-- docs/index.html | 18 +++++++++++++++--- docs/pkgdown.yml | 2 +- docs/reference/index.html | 6 ++++++ docs/search.json | 2 +- docs/sitemap.xml | 1 + 7 files changed, 40 insertions(+), 8 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 08819f6..b48e719 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: gemini.R Title: Interface for 'Google Gemini' API -Version: 0.6.1 +Version: 0.6.2 Authors@R: c( person("Jinhwan", "Kim", , "hwanistic@gmail.com", role = c("aut", "cre", "cph"), comment = c(ORCID = "0009-0009-3217-2417")), person("Maciej", "Nasinski", role = "ctb")) diff --git a/README.md b/README.md index 74e1111..8637b7c 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![gemini.R status badge](https://jhk0530.r-universe.dev/badges/gemini.R)](https://jhk0530.r-universe.dev/gemini.R) -![Alt](https://repobeats.axiom.co/api/embed/bc0595c11e22d5380cf10a646bc6049db9e5fc44.svg "Repobeats analytics image") + R package to use Google's gemini via API on R @@ -51,7 +51,6 @@ gemini("Explain about the gemini in astrology in one line") #### gemini with image ``` r - # uses default prompt as "Explain this image" # uses included image of gemini.R package gemini_image(image = system.file("docs/reference/figures/image.png", package = "gemini.R")) @@ -64,6 +63,20 @@ gemini_image(image = system.file("docs/reference/figures/image.png", package = " ``` +#### gemini with audio + +``` r +# use default prompt as "Describe this audio" +# uses included audio of gemini.R package +gemini_audio(audio = system.file("docs/reference/helloworld.mp3", package = "gemini.R")) + +# text +# "The audio contains a clear, crisp recording of a person saying \"Hello world\". +# Following the phrase is a distinct, repeated percussive sound, possibly a rhythmic +# tapping or clicking noise. The sound is consistent and mechanical in nature.\n" + +``` + #### gemini with image via Shiny To use `gemini_image` function, image file required. diff --git a/docs/index.html b/docs/index.html index 332d2a2..8ba414c 100644 --- a/docs/index.html +++ b/docs/index.html @@ -97,8 +97,7 @@

gemini with textgemini with image

-
-# uses default prompt as "Explain this image"
+# uses default prompt as "Explain this image"
 # uses included image of gemini.R package
 gemini_image(image = system.file("docs/reference/figures/image.png", package = "gemini.R"))
 
@@ -109,10 +108,23 @@ 

gemini with image# dark blue color. The image is taken from a top-down perspective."

+

gemini with audio +

+
+# use default prompt as "Describe this audio"
+# uses included audio of gemini.R package
+gemini_audio(audio = system.file("docs/reference/helloworld.mp3", package = "gemini.R"))
+
+# text
+# "The audio contains a clear, crisp recording of a person saying \"Hello world\".  
+# Following the phrase is a distinct, repeated percussive sound, possibly a rhythmic 
+# tapping or clicking noise. The sound is consistent and mechanical in nature.\n"
+
+

gemini with image via Shiny

To use gemini_image function, image file required. and I recommend to use shiny app with fileInput function.

-
+
 library(shiny)
 library(gemini.R)
 
diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml
index a012cb0..cc51cb7 100644
--- a/docs/pkgdown.yml
+++ b/docs/pkgdown.yml
@@ -2,7 +2,7 @@ pandoc: '3.3'
 pkgdown: 2.1.1
 pkgdown_sha: ~
 articles: {}
-last_built: 2024-12-10T08:59Z
+last_built: 2024-12-18T04:01Z
 urls:
   reference: https://github.com/jhk0530/gemini.R/reference
   article: https://github.com/jhk0530/gemini.R/articles
diff --git a/docs/reference/index.html b/docs/reference/index.html
index b5030b6..b90fc9a 100644
--- a/docs/reference/index.html
+++ b/docs/reference/index.html
@@ -56,6 +56,12 @@ 

All functionsgemini_audio() + + +
Analyze audio using Gemini
+
+ gemini_chat()
diff --git a/docs/search.json b/docs/search.json index af98bae..95d7ca3 100644 --- a/docs/search.json +++ b/docs/search.json @@ -1 +1 @@ -[{"path":"https://github.com/jhk0530/gemini.R/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2024 Jinhwan Kim Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"https://github.com/jhk0530/gemini.R/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Jinhwan Kim. Author, maintainer, copyright holder. Maciej Nasinski. Contributor.","code":""},{"path":"https://github.com/jhk0530/gemini.R/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Kim J (2024). gemini.R: Interface 'Google Gemini' API. R package version 0.6.1, https://github.com/jhk0530/gemini.R.","code":"@Manual{, title = {gemini.R: Interface for 'Google Gemini' API}, author = {Jinhwan Kim}, year = {2024}, note = {R package version 0.6.1}, url = {https://github.com/jhk0530/gemini.R}, }"},{"path":"https://github.com/jhk0530/gemini.R/index.html","id":"geminir-","dir":"","previous_headings":"","what":"Interface for Google Gemini API","title":"Interface for Google Gemini API","text":"R package use Google’s gemini via API R","code":""},{"path":[]},{"path":"https://github.com/jhk0530/gemini.R/index.html","id":"from-cran","dir":"","previous_headings":"Installation","what":"From CRAN","title":"Interface for Google Gemini API","text":"","code":"install.packages(\"gemini.R\")"},{"path":"https://github.com/jhk0530/gemini.R/index.html","id":"from-r-universe-development-version","dir":"","previous_headings":"Installation","what":"From R-universe (development version)","title":"Interface for Google Gemini API","text":"","code":"install.packages(\"gemini.R\", repos = c(\"https://jhk0530.r-universe.dev\", \"https://cloud.r-project.org\") )"},{"path":"https://github.com/jhk0530/gemini.R/index.html","id":"from-github-development-version","dir":"","previous_headings":"Installation","what":"From Github (development version)","title":"Interface for Google Gemini API","text":"","code":"# install.packages(\"pak\") pak::pak(\"jhk0530/gemini.R\")"},{"path":[]},{"path":"https://github.com/jhk0530/gemini.R/index.html","id":"gemini-with-text","dir":"","previous_headings":"Usage","what":"gemini with text","title":"Interface for Google Gemini API","text":"","code":"library(gemini.R) setAPI(\"your API key\") # check https://makersuite.google.com/app/apikey gemini(\"Explain about the gemini in astrology in one line\") # text # \"Gemini, the third astrological sign, is associated with # communication, adaptability, and a thirst for knowledge.\""},{"path":"https://github.com/jhk0530/gemini.R/index.html","id":"gemini-with-image","dir":"","previous_headings":"Usage","what":"gemini with image","title":"Interface for Google Gemini API","text":"","code":"# uses default prompt as \"Explain this image\" # uses included image of gemini.R package gemini_image(image = system.file(\"docs/reference/figures/image.png\", package = \"gemini.R\")) # text # \" The image shows a table with a white tablecloth. On the table are two cups of coffee, # a bowl of blueberries, and five scones. The scones are covered in blueberries and have # a crumbly texture. There are also some pink flowers on the table. The background is a # dark blue color. The image is taken from a top-down perspective.\""},{"path":"https://github.com/jhk0530/gemini.R/index.html","id":"gemini-with-image-via-shiny","dir":"","previous_headings":"Usage","what":"gemini with image via Shiny","title":"Interface for Google Gemini API","text":"use gemini_image function, image file required. recommend use shiny app fileInput function.","code":"library(shiny) library(gemini.R) setAPI(\"YOUR KEY\") ui <- fluidPage( sidebarLayout( NULL, mainPanel( fileInput( inputId = \"file\", label = \"Choose file to upload\", ), imageOutput(outputId = \"image1\"), textInput( inputId = \"prompt\", label = \"Prompt\", placeholder = \"Enter Prompts Here\" ), actionButton(\"goButton\", \"Ask to gemini\"), textOutput(\"text1\") ) ) ) server <- function(input, output) { observeEvent(input$file, { path <- input$file$datapath output$image1 <- renderImage({ list( src = path ) }, deleteFile = FALSE) }) observeEvent(input$goButton, { output$text1 <- renderText({ gemini_image(input$prompt, input$file$datapath) }) }) } shinyApp(ui = ui, server = server)"},{"path":"https://github.com/jhk0530/gemini.R/index.html","id":"gemini-for-roxygen-documentation-addin","dir":"","previous_headings":"Usage","what":"gemini for roxygen documentation (Addin)","title":"Interface for Google Gemini API","text":"may customize keyboard shortcut feature.","code":""},{"path":"https://github.com/jhk0530/gemini.R/index.html","id":"terms","dir":"","previous_headings":"","what":"Terms","title":"Interface for Google Gemini API","text":"use API, recommend check least following. - Google Cloud Platform Terms Service - Gemini API Additional Terms Service may terms conditions need check. app uses API compliant Google Terms Service. [!note] image Google AI Developers ’ve got many inspiration Deepanshu Bhalla’s article","code":""},{"path":"https://github.com/jhk0530/gemini.R/reference/addHistory.html","id":null,"dir":"Reference","previous_headings":"","what":"Add history for chating context — addHistory","title":"Add history for chating context — addHistory","text":"Add history chating context","code":""},{"path":"https://github.com/jhk0530/gemini.R/reference/addHistory.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add history for chating context — addHistory","text":"","code":"addHistory(history, role = NULL, item = NULL)"},{"path":"https://github.com/jhk0530/gemini.R/reference/addHistory.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add history for chating context — addHistory","text":"history history chat role role chat: \"user\" \"model\" item item chat: \"prompt\" \"output\"","code":""},{"path":"https://github.com/jhk0530/gemini.R/reference/addHistory.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add history for chating context — addHistory","text":"history chat","code":""},{"path":"https://github.com/jhk0530/gemini.R/reference/gemini.html","id":null,"dir":"Reference","previous_headings":"","what":"Generate text from text with Gemini — gemini","title":"Generate text from text with Gemini — gemini","text":"Generate text text Gemini","code":""},{"path":"https://github.com/jhk0530/gemini.R/reference/gemini.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Generate text from text with Gemini — gemini","text":"","code":"gemini(prompt, model = \"1.5-flash\", temperature = 0.5, maxOutputTokens = 1024)"},{"path":"https://github.com/jhk0530/gemini.R/reference/gemini.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Generate text from text with Gemini — gemini","text":"prompt prompt generate text model model use. Options '1.5-flash', '1.5-pro', '1.0-pro'. Default '1.5-flash' see https://ai.google.dev/gemini-api/docs/models/gemini temperature temperature use. Default 0.5 value 0 2 see https://ai.google.dev/gemini-api/docs/models/generative-models#model-parameters maxOutputTokens maximum number tokens generate. Default 1024 100 tokens correspond roughly 60-80 words.","code":""},{"path":"https://github.com/jhk0530/gemini.R/reference/gemini.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Generate text from text with Gemini — gemini","text":"Generated text","code":""},{"path":[]},{"path":"https://github.com/jhk0530/gemini.R/reference/gemini.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Generate text from text with Gemini — gemini","text":"","code":"if (FALSE) { # \\dontrun{ library(gemini.R) setAPI(\"YOUR_API_KEY\") gemini(\"Explain dplyr's mutate function\") } # }"},{"path":"https://github.com/jhk0530/gemini.R/reference/gemini_chat.html","id":null,"dir":"Reference","previous_headings":"","what":"Multi-turn conversations (chat) — gemini_chat","title":"Multi-turn conversations (chat) — gemini_chat","text":"Generate text text Gemini","code":""},{"path":"https://github.com/jhk0530/gemini.R/reference/gemini_chat.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Multi-turn conversations (chat) — gemini_chat","text":"","code":"gemini_chat( prompt, history = list(), model = \"1.5-flash\", temperature = 0.5, maxOutputTokens = 1024 )"},{"path":"https://github.com/jhk0530/gemini.R/reference/gemini_chat.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Multi-turn conversations (chat) — gemini_chat","text":"prompt prompt generate text history history object keep track conversation model model use. Options '1.5-flash', '1.5-pro', '1.0-pro'. Default '1.5-flash' see https://ai.google.dev/gemini-api/docs/models/gemini temperature temperature use. Default 0.5 value 0 2 see https://ai.google.dev/gemini-api/docs/models/generative-models#model-parameters maxOutputTokens maximum number tokens generate. Default 1024 100 tokens correspond roughly 60-80 words.","code":""},{"path":"https://github.com/jhk0530/gemini.R/reference/gemini_chat.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Multi-turn conversations (chat) — gemini_chat","text":"Generated text","code":""},{"path":[]},{"path":"https://github.com/jhk0530/gemini.R/reference/gemini_chat.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Multi-turn conversations (chat) — gemini_chat","text":"","code":"if (FALSE) { # \\dontrun{ library(gemini.R) setAPI(\"YOUR_API_KEY\") chats <- gemini_chat(\"Pretend you're a snowman and stay in character for each\") print(chats$outputs) chats <- gemini_chat(\"What's your favorite season of the year?\", chats$history) print(chats$outputs) chats <- gemini_chat(\"How do you think about summer?\", chats$history) print(chats$outputs) } # }"},{"path":"https://github.com/jhk0530/gemini.R/reference/gemini_image.html","id":null,"dir":"Reference","previous_headings":"","what":"Generate text from text and image with Gemini — gemini_image","title":"Generate text from text and image with Gemini — gemini_image","text":"Generate text text image Gemini","code":""},{"path":"https://github.com/jhk0530/gemini.R/reference/gemini_image.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Generate text from text and image with Gemini — gemini_image","text":"","code":"gemini_image( image = NULL, prompt = \"Explain this image\", model = \"1.5-flash\", temperature = 0.5, maxOutputTokens = 1024, type = \"png\" )"},{"path":"https://github.com/jhk0530/gemini.R/reference/gemini_image.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Generate text from text and image with Gemini — gemini_image","text":"image image generate text prompt prompt generate text, Default \"Explain image\" model model use. Options '1.5-flash', '1.5-pro'. Default '1.5-flash' see https://ai.google.dev/gemini-api/docs/models/gemini temperature temperature use. Default 0.5 value 0 2 see https://ai.google.dev/gemini-api/docs/models/generative-models#model-parameters maxOutputTokens maximum number tokens generate. Default 1024 100 tokens correspond roughly 60-80 words. type type image. Options 'png', 'jpeg', 'webp', 'heic', 'heif'. Default 'png'","code":""},{"path":"https://github.com/jhk0530/gemini.R/reference/gemini_image.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Generate text from text and image with Gemini — gemini_image","text":"Generated text","code":""},{"path":[]},{"path":"https://github.com/jhk0530/gemini.R/reference/gemini_image.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Generate text from text and image with Gemini — gemini_image","text":"","code":"if (FALSE) { # \\dontrun{ library(gemini.R) setAPI(\"YOUR_API_KEY\") gemini_image(image = system.file(\"docs/reference/figures/image.png\", package = \"gemini.R\")) } # }"},{"path":"https://github.com/jhk0530/gemini.R/reference/gen_docs.html","id":null,"dir":"Reference","previous_headings":"","what":"Generate Roxygen Documentation — gen_docs","title":"Generate Roxygen Documentation — gen_docs","text":"Generates Roxygen2 documentation R function based currently selected code.","code":""},{"path":"https://github.com/jhk0530/gemini.R/reference/gen_docs.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Generate Roxygen Documentation — gen_docs","text":"","code":"gen_docs(prompt = NULL)"},{"path":"https://github.com/jhk0530/gemini.R/reference/gen_docs.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Generate Roxygen Documentation — gen_docs","text":"prompt character string specifying additional instructions LLM. Defaults prompt requesting Roxygen2 documentation without original code.","code":""},{"path":"https://github.com/jhk0530/gemini.R/reference/gen_docs.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Generate Roxygen Documentation — gen_docs","text":"character string containing generated Roxygen2 documentation.","code":""},{"path":"https://github.com/jhk0530/gemini.R/reference/setAPI.html","id":null,"dir":"Reference","previous_headings":"","what":"Set API key — setAPI","title":"Set API key — setAPI","text":"Set API key environment variable","code":""},{"path":"https://github.com/jhk0530/gemini.R/reference/setAPI.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Set API key — setAPI","text":"","code":"setAPI(api_key)"},{"path":"https://github.com/jhk0530/gemini.R/reference/setAPI.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Set API key — setAPI","text":"api_key API key set","code":""},{"path":"https://github.com/jhk0530/gemini.R/reference/setAPI.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Set API key — setAPI","text":"return value, called side effects.","code":""},{"path":"https://github.com/jhk0530/gemini.R/reference/setAPI.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Set API key — setAPI","text":"Please aware agree terms service API provider. app uses API key subject terms service. Also, please aware API key sensitive information.","code":""},{"path":[]},{"path":"https://github.com/jhk0530/gemini.R/reference/setAPI.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Set API key — setAPI","text":"","code":"if (FALSE) { # \\dontrun{ setAPI(\"my_api_key\") } # }"},{"path":[]},{"path":[]},{"path":"https://github.com/jhk0530/gemini.R/news/index.html","id":"id_040-0-5-1","dir":"Changelog","previous_headings":"","what":"0.4.0","title":"gemini.R 0.5.1","text":"Updated use httr2 setAPI now shows last 4 words API key confirmation. cat updated using cli better readability console. gemini_image() takes default prompt “Explain image” example image flower. See ?gemini_image","code":""},{"path":"https://github.com/jhk0530/gemini.R/news/index.html","id":"id_030-0-5-1","dir":"Changelog","previous_headings":"","what":"0.3.0","title":"gemini.R 0.5.1","text":"R CMD CHECK longer shows NOTEs WARNINGs. use R-hub check multiple platforms github action","code":""},{"path":[]},{"path":"https://github.com/jhk0530/gemini.R/news/index.html","id":"whats-changed-0-5-1","dir":"Changelog","previous_headings":"0.2.0","what":"What’s changed","title":"gemini.R 0.5.1","text":"Added Multi-turn conversation Chat 💬. See gemini_chat Slight change function documentation. Now generates message inform setAPI API key exist yet.","code":""}] +[{"path":"https://github.com/jhk0530/gemini.R/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2024 Jinhwan Kim Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"https://github.com/jhk0530/gemini.R/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Jinhwan Kim. Author, maintainer, copyright holder. Maciej Nasinski. Contributor.","code":""},{"path":"https://github.com/jhk0530/gemini.R/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Kim J (2024). gemini.R: Interface 'Google Gemini' API. R package version 0.6.1, https://github.com/jhk0530/gemini.R.","code":"@Manual{, title = {gemini.R: Interface for 'Google Gemini' API}, author = {Jinhwan Kim}, year = {2024}, note = {R package version 0.6.1}, url = {https://github.com/jhk0530/gemini.R}, }"},{"path":"https://github.com/jhk0530/gemini.R/index.html","id":"geminir-","dir":"","previous_headings":"","what":"Interface for Google Gemini API","title":"Interface for Google Gemini API","text":"R package use Google’s gemini via API R","code":""},{"path":[]},{"path":"https://github.com/jhk0530/gemini.R/index.html","id":"from-cran","dir":"","previous_headings":"Installation","what":"From CRAN","title":"Interface for Google Gemini API","text":"","code":"install.packages(\"gemini.R\")"},{"path":"https://github.com/jhk0530/gemini.R/index.html","id":"from-r-universe-development-version","dir":"","previous_headings":"Installation","what":"From R-universe (development version)","title":"Interface for Google Gemini API","text":"","code":"install.packages(\"gemini.R\", repos = c(\"https://jhk0530.r-universe.dev\", \"https://cloud.r-project.org\") )"},{"path":"https://github.com/jhk0530/gemini.R/index.html","id":"from-github-development-version","dir":"","previous_headings":"Installation","what":"From Github (development version)","title":"Interface for Google Gemini API","text":"","code":"# install.packages(\"pak\") pak::pak(\"jhk0530/gemini.R\")"},{"path":[]},{"path":"https://github.com/jhk0530/gemini.R/index.html","id":"gemini-with-text","dir":"","previous_headings":"Usage","what":"gemini with text","title":"Interface for Google Gemini API","text":"","code":"library(gemini.R) setAPI(\"your API key\") # check https://makersuite.google.com/app/apikey gemini(\"Explain about the gemini in astrology in one line\") # text # \"Gemini, the third astrological sign, is associated with # communication, adaptability, and a thirst for knowledge.\""},{"path":"https://github.com/jhk0530/gemini.R/index.html","id":"gemini-with-image","dir":"","previous_headings":"Usage","what":"gemini with image","title":"Interface for Google Gemini API","text":"","code":"# uses default prompt as \"Explain this image\" # uses included image of gemini.R package gemini_image(image = system.file(\"docs/reference/figures/image.png\", package = \"gemini.R\")) # text # \" The image shows a table with a white tablecloth. On the table are two cups of coffee, # a bowl of blueberries, and five scones. The scones are covered in blueberries and have # a crumbly texture. There are also some pink flowers on the table. The background is a # dark blue color. The image is taken from a top-down perspective.\""},{"path":"https://github.com/jhk0530/gemini.R/index.html","id":"gemini-with-audio","dir":"","previous_headings":"Usage","what":"gemini with audio","title":"Interface for Google Gemini API","text":"","code":"# use default prompt as \"Describe this audio\" # uses included audio of gemini.R package gemini_audio(audio = system.file(\"docs/reference/helloworld.mp3\", package = \"gemini.R\")) # text # \"The audio contains a clear, crisp recording of a person saying \\\"Hello world\\\". # Following the phrase is a distinct, repeated percussive sound, possibly a rhythmic # tapping or clicking noise. The sound is consistent and mechanical in nature.\\n\""},{"path":"https://github.com/jhk0530/gemini.R/index.html","id":"gemini-with-image-via-shiny","dir":"","previous_headings":"Usage","what":"gemini with image via Shiny","title":"Interface for Google Gemini API","text":"use gemini_image function, image file required. recommend use shiny app fileInput function.","code":"library(shiny) library(gemini.R) setAPI(\"YOUR KEY\") ui <- fluidPage( sidebarLayout( NULL, mainPanel( fileInput( inputId = \"file\", label = \"Choose file to upload\", ), imageOutput(outputId = \"image1\"), textInput( inputId = \"prompt\", label = \"Prompt\", placeholder = \"Enter Prompts Here\" ), actionButton(\"goButton\", \"Ask to gemini\"), textOutput(\"text1\") ) ) ) server <- function(input, output) { observeEvent(input$file, { path <- input$file$datapath output$image1 <- renderImage({ list( src = path ) }, deleteFile = FALSE) }) observeEvent(input$goButton, { output$text1 <- renderText({ gemini_image(input$prompt, input$file$datapath) }) }) } shinyApp(ui = ui, server = server)"},{"path":"https://github.com/jhk0530/gemini.R/index.html","id":"gemini-for-roxygen-documentation-addin","dir":"","previous_headings":"Usage","what":"gemini for roxygen documentation (Addin)","title":"Interface for Google Gemini API","text":"may customize keyboard shortcut feature.","code":""},{"path":"https://github.com/jhk0530/gemini.R/index.html","id":"terms","dir":"","previous_headings":"","what":"Terms","title":"Interface for Google Gemini API","text":"use API, recommend check least following. - Google Cloud Platform Terms Service - Gemini API Additional Terms Service may terms conditions need check. app uses API compliant Google Terms Service. [!note] image Google AI Developers ’ve got many inspiration Deepanshu Bhalla’s article","code":""},{"path":"https://github.com/jhk0530/gemini.R/reference/addHistory.html","id":null,"dir":"Reference","previous_headings":"","what":"Add history for chating context — addHistory","title":"Add history for chating context — addHistory","text":"Add history chating context","code":""},{"path":"https://github.com/jhk0530/gemini.R/reference/addHistory.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add history for chating context — addHistory","text":"","code":"addHistory(history, role = NULL, item = NULL)"},{"path":"https://github.com/jhk0530/gemini.R/reference/addHistory.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add history for chating context — addHistory","text":"history history chat role role chat: \"user\" \"model\" item item chat: \"prompt\" \"output\"","code":""},{"path":"https://github.com/jhk0530/gemini.R/reference/addHistory.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add history for chating context — addHistory","text":"history chat","code":""},{"path":"https://github.com/jhk0530/gemini.R/reference/gemini.html","id":null,"dir":"Reference","previous_headings":"","what":"Generate text from text with Gemini — gemini","title":"Generate text from text with Gemini — gemini","text":"Generate text text Gemini","code":""},{"path":"https://github.com/jhk0530/gemini.R/reference/gemini.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Generate text from text with Gemini — gemini","text":"","code":"gemini(prompt, model = \"1.5-flash\", temperature = 0.5, maxOutputTokens = 1024)"},{"path":"https://github.com/jhk0530/gemini.R/reference/gemini.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Generate text from text with Gemini — gemini","text":"prompt prompt generate text model model use. Options '1.5-flash', '1.5-pro', '1.0-pro'. Default '1.5-flash' see https://ai.google.dev/gemini-api/docs/models/gemini temperature temperature use. Default 0.5 value 0 2 see https://ai.google.dev/gemini-api/docs/models/generative-models#model-parameters maxOutputTokens maximum number tokens generate. Default 1024 100 tokens correspond roughly 60-80 words.","code":""},{"path":"https://github.com/jhk0530/gemini.R/reference/gemini.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Generate text from text with Gemini — gemini","text":"Generated text","code":""},{"path":[]},{"path":"https://github.com/jhk0530/gemini.R/reference/gemini.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Generate text from text with Gemini — gemini","text":"","code":"if (FALSE) { # \\dontrun{ library(gemini.R) setAPI(\"YOUR_API_KEY\") gemini(\"Explain dplyr's mutate function\") } # }"},{"path":"https://github.com/jhk0530/gemini.R/reference/gemini_audio.html","id":null,"dir":"Reference","previous_headings":"","what":"Analyze audio using Gemini — gemini_audio","title":"Analyze audio using Gemini — gemini_audio","text":"function sends audio Gemini API returns text description.","code":""},{"path":"https://github.com/jhk0530/gemini.R/reference/gemini_audio.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Analyze audio using Gemini — gemini_audio","text":"","code":"gemini_audio( audio = NULL, prompt = \"Describe this audio\", model = \"1.5-flash\", temperature = 0.5, maxOutputTokens = 1024 )"},{"path":"https://github.com/jhk0530/gemini.R/reference/gemini_audio.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Analyze audio using Gemini — gemini_audio","text":"audio Path audio file (default: uses sample file). Must MP3. prompt string describing audio. model Gemini model use (\"1.5-flash\" \"1.5-pro\"). Defaults \"1.5-flash\". temperature Controls randomness generated text (0-2). Defaults 0.5. maxOutputTokens maximum number tokens generated text. Defaults 1024.","code":""},{"path":"https://github.com/jhk0530/gemini.R/reference/gemini_audio.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Analyze audio using Gemini — gemini_audio","text":"character vector containing Gemini API's response.","code":""},{"path":"https://github.com/jhk0530/gemini.R/reference/gemini_audio.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Analyze audio using Gemini — gemini_audio","text":"","code":"if (FALSE) { # \\dontrun{ library(gemini.R) setAPI(\"YOUR_API_KEY\") gemini_image(audio = system.file(\"docs/reference/helloworld.mp3\", package = \"gemini.R\")) } # }"},{"path":"https://github.com/jhk0530/gemini.R/reference/gemini_chat.html","id":null,"dir":"Reference","previous_headings":"","what":"Multi-turn conversations (chat) — gemini_chat","title":"Multi-turn conversations (chat) — gemini_chat","text":"Generate text text Gemini","code":""},{"path":"https://github.com/jhk0530/gemini.R/reference/gemini_chat.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Multi-turn conversations (chat) — gemini_chat","text":"","code":"gemini_chat( prompt, history = list(), model = \"1.5-flash\", temperature = 0.5, maxOutputTokens = 1024 )"},{"path":"https://github.com/jhk0530/gemini.R/reference/gemini_chat.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Multi-turn conversations (chat) — gemini_chat","text":"prompt prompt generate text history history object keep track conversation model model use. Options '1.5-flash', '1.5-pro', '1.0-pro'. Default '1.5-flash' see https://ai.google.dev/gemini-api/docs/models/gemini temperature temperature use. Default 0.5 value 0 2 see https://ai.google.dev/gemini-api/docs/models/generative-models#model-parameters maxOutputTokens maximum number tokens generate. Default 1024 100 tokens correspond roughly 60-80 words.","code":""},{"path":"https://github.com/jhk0530/gemini.R/reference/gemini_chat.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Multi-turn conversations (chat) — gemini_chat","text":"Generated text","code":""},{"path":[]},{"path":"https://github.com/jhk0530/gemini.R/reference/gemini_chat.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Multi-turn conversations (chat) — gemini_chat","text":"","code":"if (FALSE) { # \\dontrun{ library(gemini.R) setAPI(\"YOUR_API_KEY\") chats <- gemini_chat(\"Pretend you're a snowman and stay in character for each\") print(chats$outputs) chats <- gemini_chat(\"What's your favorite season of the year?\", chats$history) print(chats$outputs) chats <- gemini_chat(\"How do you think about summer?\", chats$history) print(chats$outputs) } # }"},{"path":"https://github.com/jhk0530/gemini.R/reference/gemini_image.html","id":null,"dir":"Reference","previous_headings":"","what":"Generate text from text and image with Gemini — gemini_image","title":"Generate text from text and image with Gemini — gemini_image","text":"Generate text text image Gemini","code":""},{"path":"https://github.com/jhk0530/gemini.R/reference/gemini_image.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Generate text from text and image with Gemini — gemini_image","text":"","code":"gemini_image( image = NULL, prompt = \"Explain this image\", model = \"1.5-flash\", temperature = 0.5, maxOutputTokens = 1024, type = \"png\" )"},{"path":"https://github.com/jhk0530/gemini.R/reference/gemini_image.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Generate text from text and image with Gemini — gemini_image","text":"image image generate text prompt prompt generate text, Default \"Explain image\" model model use. Options '1.5-flash', '1.5-pro'. Default '1.5-flash' see https://ai.google.dev/gemini-api/docs/models/gemini temperature temperature use. Default 0.5 value 0 2 see https://ai.google.dev/gemini-api/docs/models/generative-models#model-parameters maxOutputTokens maximum number tokens generate. Default 1024 100 tokens correspond roughly 60-80 words. type type image. Options 'png', 'jpeg', 'webp', 'heic', 'heif'. Default 'png'","code":""},{"path":"https://github.com/jhk0530/gemini.R/reference/gemini_image.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Generate text from text and image with Gemini — gemini_image","text":"Generated text","code":""},{"path":[]},{"path":"https://github.com/jhk0530/gemini.R/reference/gemini_image.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Generate text from text and image with Gemini — gemini_image","text":"","code":"if (FALSE) { # \\dontrun{ library(gemini.R) setAPI(\"YOUR_API_KEY\") gemini_image(image = system.file(\"docs/reference/figures/image.png\", package = \"gemini.R\")) } # }"},{"path":"https://github.com/jhk0530/gemini.R/reference/gen_docs.html","id":null,"dir":"Reference","previous_headings":"","what":"Generate Roxygen Documentation — gen_docs","title":"Generate Roxygen Documentation — gen_docs","text":"Generates Roxygen2 documentation R function based currently selected code.","code":""},{"path":"https://github.com/jhk0530/gemini.R/reference/gen_docs.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Generate Roxygen Documentation — gen_docs","text":"","code":"gen_docs(prompt = NULL)"},{"path":"https://github.com/jhk0530/gemini.R/reference/gen_docs.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Generate Roxygen Documentation — gen_docs","text":"prompt character string specifying additional instructions LLM. Defaults prompt requesting Roxygen2 documentation without original code.","code":""},{"path":"https://github.com/jhk0530/gemini.R/reference/gen_docs.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Generate Roxygen Documentation — gen_docs","text":"character string containing generated Roxygen2 documentation.","code":""},{"path":"https://github.com/jhk0530/gemini.R/reference/setAPI.html","id":null,"dir":"Reference","previous_headings":"","what":"Set API key — setAPI","title":"Set API key — setAPI","text":"Set API key environment variable","code":""},{"path":"https://github.com/jhk0530/gemini.R/reference/setAPI.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Set API key — setAPI","text":"","code":"setAPI(api_key)"},{"path":"https://github.com/jhk0530/gemini.R/reference/setAPI.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Set API key — setAPI","text":"api_key API key set","code":""},{"path":"https://github.com/jhk0530/gemini.R/reference/setAPI.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Set API key — setAPI","text":"return value, called side effects.","code":""},{"path":"https://github.com/jhk0530/gemini.R/reference/setAPI.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Set API key — setAPI","text":"Please aware agree terms service API provider. app uses API key subject terms service. Also, please aware API key sensitive information.","code":""},{"path":[]},{"path":"https://github.com/jhk0530/gemini.R/reference/setAPI.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Set API key — setAPI","text":"","code":"if (FALSE) { # \\dontrun{ setAPI(\"my_api_key\") } # }"},{"path":[]},{"path":[]},{"path":"https://github.com/jhk0530/gemini.R/news/index.html","id":"id_040-0-5-1","dir":"Changelog","previous_headings":"","what":"0.4.0","title":"gemini.R 0.5.1","text":"Updated use httr2 setAPI now shows last 4 words API key confirmation. cat updated using cli better readability console. gemini_image() takes default prompt “Explain image” example image flower. See ?gemini_image","code":""},{"path":"https://github.com/jhk0530/gemini.R/news/index.html","id":"id_030-0-5-1","dir":"Changelog","previous_headings":"","what":"0.3.0","title":"gemini.R 0.5.1","text":"R CMD CHECK longer shows NOTEs WARNINGs. use R-hub check multiple platforms github action","code":""},{"path":[]},{"path":"https://github.com/jhk0530/gemini.R/news/index.html","id":"whats-changed-0-5-1","dir":"Changelog","previous_headings":"0.2.0","what":"What’s changed","title":"gemini.R 0.5.1","text":"Added Multi-turn conversation Chat 💬. See gemini_chat Slight change function documentation. Now generates message inform setAPI API key exist yet.","code":""}] diff --git a/docs/sitemap.xml b/docs/sitemap.xml index 558818b..bd11fda 100644 --- a/docs/sitemap.xml +++ b/docs/sitemap.xml @@ -9,6 +9,7 @@ https://github.com/jhk0530/gemini.R/news/index.html https://github.com/jhk0530/gemini.R/reference/addHistory.html https://github.com/jhk0530/gemini.R/reference/gemini.html +https://github.com/jhk0530/gemini.R/reference/gemini_audio.html https://github.com/jhk0530/gemini.R/reference/gemini_chat.html https://github.com/jhk0530/gemini.R/reference/gemini_image.html https://github.com/jhk0530/gemini.R/reference/gen_docs.html