Skip to content

Commit b3c9dfa

Browse files
committed
docs: update readme
1 parent 40e20af commit b3c9dfa

33 files changed

+656
-44
lines changed

README.md

Lines changed: 56 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
[![gemini.R status badge](https://jhk0530.r-universe.dev/badges/gemini.R)](https://jhk0530.r-universe.dev/gemini.R)
77
<!-- badges: end -->
88

9-
10-
119
R package to use Google's gemini via API on R
1210

1311
## Installation
@@ -34,7 +32,9 @@ pak::pak("jhk0530/gemini.R")
3432

3533
## Usage
3634

37-
#### gemini with text
35+
### Gemini with AI Studio API
36+
37+
#### Text
3838

3939
``` r
4040
library(gemini.R)
@@ -48,7 +48,7 @@ gemini("Explain about the gemini in astrology in one line")
4848

4949
```
5050

51-
#### gemini with image
51+
#### Image
5252

5353
``` r
5454
# uses default prompt as "Explain this image"
@@ -63,7 +63,7 @@ gemini_image(image = system.file("docs/reference/figures/image.png", package = "
6363

6464
```
6565

66-
#### gemini with audio
66+
#### Audio
6767

6868
``` r
6969
# use default prompt as "Describe this audio"
@@ -77,7 +77,7 @@ gemini_audio(audio = system.file("docs/reference/helloworld.mp3", package = "gem
7777

7878
```
7979

80-
#### gemini with image via Shiny
80+
#### Image via Shiny
8181

8282
To use `gemini_image` function, image file required.
8383
and I recommend to use shiny app with `fileInput` function.
@@ -132,15 +132,63 @@ shinyApp(ui = ui, server = server)
132132
<img alt='shiny app example' src='./man/figures/shiny.png' width = '70%'>
133133
</p>
134134

135-
#### gemini for roxygen documentation (Addin)
135+
### Gemini with Vertex AI API
136+
137+
#### Text
138+
139+
```r
140+
tokens <- token.vertex("YOUR_API_KEY.json", model_id = "1.5-flash")
141+
prompt <- "What is sachins Jersy number?"
142+
143+
gemini.vertex(prompt, tokens)
144+
```
145+
146+
<p style = 'text-align:center;'>
147+
<img alt='vertex AI text example' src='./man/figures/vertex_text.png' width = '100%'>
148+
</p>
149+
150+
#### Image
151+
152+
```r
153+
tokens <- token.vertex("YOUR_API_KEY.json", model_id = "1.5-flash")
154+
155+
gemini_image.vertex(image = "YOUR_IMAGE.png", type, tokens)
156+
```
157+
<p style = 'text-align:center;'>
158+
<img alt='Most lovely cat in the world' src='./man/figures/dawn.png' width = '50%'>
159+
</p>
160+
161+
<p style = 'text-align:center;'>
162+
<img alt='vertex AI image example' src='./man/figures/vertex_image.png' width = '100%'>
163+
</p>
164+
165+
#### Audio
166+
167+
```r
168+
tokens <- token.vertex("YOUR_API_KEY.json", model_id = "1.5-flash")
169+
170+
gemini_audio.vertex(audio = "YOUR_AUDIO.mp3", tokens)
171+
```
172+
173+
- File upload to Google Cloud using API not supported.
174+
- Instead you must use uploaded file. (e.g. Google Cloud Storage)
175+
- Example sound from [soundbible](https://soundbible.com/2210-SOS-Morse-Code.html)
176+
177+
<p style = 'text-align:center;'>
178+
<img alt='vertex AI audio example' src='./man/figures/vertex_audio.png' width = '100%'>
179+
</p>
180+
181+
### Rstudio Addins
182+
183+
#### Function documentation (Roxygen)
136184

137185
<p style = 'text-align:center;'>
138186
<img alt='gen_doc example' src='./man/figures/roxygen.gif' width = '70%'>
139187
</p>
140188

141189
You may customize keyboard shortcut for this feature.
142190

143-
#### gemini for unit testing as {testthat} (Addin)
191+
#### Unit testing (testthat)
144192

145193
<p style = 'text-align:center;'>
146194
<img alt='gen_test example' src='./man/figures/testing.gif' width = '70%'>

docs/404.html

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/LICENSE-text.html

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/LICENSE.html

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/authors.html

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/deps/bootstrap-5.3.1/bootstrap.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/index.html

Lines changed: 58 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/news/index.html

Lines changed: 30 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/pkgdown.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
pandoc: '3.3'
1+
pandoc: 3.6.2
22
pkgdown: 2.1.1
33
pkgdown_sha: ~
44
articles: {}
5-
last_built: 2024-12-25T15:54Z
5+
last_built: 2025-02-06T01:59Z
66
urls:
77
reference: https://github.com/jhk0530/gemini.R/reference
88
article: https://github.com/jhk0530/gemini.R/articles

docs/reference/addHistory.html

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)