j1-template 2024.1.5 → 2024.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (195) hide show
  1. checksums.yaml +4 -4
  2. data/_includes/themes/j1/layouts/content_generator_page.html +0 -34
  3. data/_includes/themes/j1/modules/searcher/generator.html +4 -1
  4. data/_includes/themes/j1/modules/searcher/procedures/topsearch.proc +59 -56
  5. data/assets/data/authclient.html +1 -8
  6. data/assets/data/banner.html +1 -7
  7. data/assets/data/fab.html +2 -13
  8. data/assets/data/footer.html +0 -3
  9. data/assets/data/galeries.html +2 -13
  10. data/assets/data/gemini-ui.html +74 -21
  11. data/assets/data/iframes.html +1 -4
  12. data/assets/data/masonry.html +1 -13
  13. data/assets/data/masterslider.html +10 -21
  14. data/assets/data/menu.html +6 -14
  15. data/assets/data/mmenu.html +6 -5
  16. data/assets/data/mmenu_toc.html +2 -1
  17. data/assets/data/panel.html +4 -11
  18. data/assets/data/particles.yml +8 -8
  19. data/assets/data/quicklinks.html +4 -23
  20. data/assets/data/rtext_resizer.html +3 -1
  21. data/assets/data/slick.html +9 -11
  22. data/assets/data/translator.html +0 -1
  23. data/assets/themes/j1/adapter/js/advertising.js +143 -182
  24. data/assets/themes/j1/adapter/js/algolia.js +61 -54
  25. data/assets/themes/j1/adapter/js/analytics.js +68 -52
  26. data/assets/themes/j1/adapter/js/asciidoctor.js +32 -20
  27. data/assets/themes/j1/adapter/js/attic.js +75 -69
  28. data/assets/themes/j1/adapter/js/bmd.js +44 -26
  29. data/assets/themes/j1/adapter/js/carousel.js +117 -92
  30. data/assets/themes/j1/adapter/js/chatbot.js +77 -35
  31. data/assets/themes/j1/adapter/js/clipboard.js +67 -49
  32. data/assets/themes/j1/adapter/js/comments.js +93 -70
  33. data/assets/themes/j1/adapter/js/cookieConsent.js +157 -159
  34. data/assets/themes/j1/adapter/js/customFunctions.js +52 -35
  35. data/assets/themes/j1/adapter/js/customModule.js +61 -50
  36. data/assets/themes/j1/adapter/js/docsearch.js +55 -34
  37. data/assets/themes/j1/adapter/js/dropdowns.js +66 -52
  38. data/assets/themes/j1/adapter/js/fab.js +124 -109
  39. data/assets/themes/j1/adapter/js/gallery.js +68 -49
  40. data/assets/themes/j1/adapter/js/gemini.js +961 -301
  41. data/assets/themes/j1/adapter/js/iconPicker.js +76 -54
  42. data/assets/themes/j1/adapter/js/iconPickerPage.js +279 -0
  43. data/assets/themes/j1/adapter/js/iframer.js +84 -63
  44. data/assets/themes/j1/adapter/js/j1.js +605 -542
  45. data/assets/themes/j1/adapter/js/lazyLoader.js +43 -24
  46. data/assets/themes/j1/adapter/js/lightbox.js +53 -52
  47. data/assets/themes/j1/adapter/js/logger.js +78 -66
  48. data/assets/themes/j1/adapter/js/lunr.js +684 -86
  49. data/assets/themes/j1/adapter/js/masonry.js +84 -68
  50. data/assets/themes/j1/adapter/js/masterslider.js +136 -137
  51. data/assets/themes/j1/adapter/js/mmenu.js +102 -66
  52. data/assets/themes/j1/adapter/js/navigator.js +291 -356
  53. data/assets/themes/j1/adapter/js/particles.js +62 -40
  54. data/assets/themes/j1/adapter/js/rangeSlider.js +66 -48
  55. data/assets/themes/j1/adapter/js/rouge.js +63 -44
  56. data/assets/themes/j1/adapter/js/rtable.js +56 -40
  57. data/assets/themes/j1/adapter/js/rtextResizer.js +57 -44
  58. data/assets/themes/j1/adapter/js/scroller.js +170 -133
  59. data/assets/themes/j1/adapter/js/slick.js +99 -97
  60. data/assets/themes/j1/adapter/js/slimSelect.js +288 -0
  61. data/assets/themes/j1/adapter/js/speak2me.js +124 -128
  62. data/assets/themes/j1/adapter/js/themeToggler.js +118 -97
  63. data/assets/themes/j1/adapter/js/{themer.js → themes.js} +144 -113
  64. data/assets/themes/j1/adapter/js/toccer.js +88 -54
  65. data/assets/themes/j1/adapter/js/translator.js +74 -70
  66. data/assets/themes/j1/adapter/js/waves.js +75 -58
  67. data/assets/themes/j1/core/css/themes/unolight/bootstrap.css +29 -11
  68. data/assets/themes/j1/core/css/themes/unolight/bootstrap.min.css +2 -2
  69. data/assets/themes/j1/core/js/template.js +474 -420
  70. data/assets/themes/j1/core/js/template.min.js +7 -7
  71. data/assets/themes/j1/core/js/template.min.js.map +1 -1
  72. data/assets/themes/j1/modules/carousel/css/theme/uno.css +4 -4
  73. data/assets/themes/j1/modules/carousel/css/theme/uno.min.css +1 -1
  74. data/assets/themes/j1/modules/clipboard/js/clipboard.js +0 -1
  75. data/assets/themes/j1/modules/cookieConsent/js/cookieConsent.js +27 -21
  76. data/assets/themes/j1/modules/iconPicker/css/theme/uno.css +58 -0
  77. data/assets/themes/j1/modules/iconPicker/css/theme/uno.min.css +16 -0
  78. data/assets/themes/j1/modules/iconPicker/js/universal-icon-picker.0.js +493 -0
  79. data/assets/themes/j1/modules/iconPicker/js/universal-icon-picker.js +7 -7
  80. data/assets/themes/j1/modules/js-cookies/js/js.cookie.js +147 -0
  81. data/assets/themes/j1/modules/js-cookies/js/js.cookie.min.js +2 -0
  82. data/assets/themes/j1/modules/lightGallery/js/plugins/lg-video.js +4 -4
  83. data/assets/themes/j1/modules/lightGallery/js/plugins/lg-video.min.js +2 -10
  84. data/assets/themes/j1/modules/lunr/css/j1.css +12 -6
  85. data/assets/themes/j1/modules/lunr/css/j1.min.css +1 -1
  86. data/assets/themes/j1/modules/lunr/js/j1.js +46 -43
  87. data/assets/themes/j1/modules/lunr/js/j1.min.js +1 -1
  88. data/assets/themes/j1/modules/masterslider/js/masterslider.js +1 -1
  89. data/assets/themes/j1/modules/scroller/js/scroller.js +64 -74
  90. data/assets/themes/j1/modules/scroller/js/scroller.min.js +1 -1
  91. data/assets/themes/j1/modules/slick/slider/css/theme/uno.css +4 -4
  92. data/assets/themes/j1/modules/slick/slider/css/theme/uno.min.css +1 -1
  93. data/assets/themes/j1/modules/slimSelect/js/select.js +1865 -1821
  94. data/assets/themes/j1/modules/slimSelect/js/select.min.js +2 -1
  95. data/assets/themes/j1/modules/themeSwitcher/js/switcher.js +87 -89
  96. data/assets/themes/j1/modules/themeSwitcher/js/switcher.min.js +1 -1
  97. data/assets/themes/j1/modules/videojs/js/plugins/vm/api/player.min.js +5 -7
  98. data/assets/themes/j1/modules/videojs/js/plugins/vm/api/v2.20.1/player.min.js +23 -0
  99. data/lib/j1/version.rb +1 -1
  100. data/lib/starter_web/Gemfile +2 -2
  101. data/lib/starter_web/README.md +5 -5
  102. data/lib/starter_web/_config.yml +1 -1
  103. data/lib/starter_web/_data/blocks/_panel.yml +775 -0
  104. data/lib/starter_web/_data/blocks/panel.yml +53 -53
  105. data/lib/starter_web/_data/j1_config.yml +3 -2
  106. data/lib/starter_web/_data/layouts/default.yml +0 -2
  107. data/lib/starter_web/_data/modules/_scroller.yml +102 -0
  108. data/lib/starter_web/_data/modules/carousel.yml +3 -3
  109. data/lib/starter_web/_data/modules/defaults/attics.yml +5 -5
  110. data/lib/starter_web/_data/modules/defaults/docsearch.yml +1 -1
  111. data/lib/starter_web/_data/modules/defaults/gemini.yml +204 -46
  112. data/lib/starter_web/_data/modules/defaults/{iconPicker.yml → icon_picker.yml} +6 -12
  113. data/lib/starter_web/_data/modules/defaults/lunr.yml +20 -5
  114. data/lib/starter_web/_data/modules/defaults/masterslider.yml +4 -4
  115. data/lib/starter_web/_data/modules/defaults/navigator.yml +20 -24
  116. data/lib/starter_web/_data/modules/defaults/particles.yml +3 -3
  117. data/lib/starter_web/_data/modules/defaults/slim_select.yml +54 -0
  118. data/lib/starter_web/_data/modules/defaults/{themer.yml → themes.yml} +10 -10
  119. data/lib/starter_web/_data/modules/defaults/toccer.yml +1 -1
  120. data/lib/starter_web/_data/modules/gallery.yml +33 -38
  121. data/lib/starter_web/_data/modules/gemini.yml +42 -3
  122. data/lib/starter_web/_data/modules/{iconPicker.yml → icon_picker.yml} +31 -3
  123. data/lib/starter_web/_data/modules/lunr.yml +12 -1
  124. data/lib/starter_web/_data/modules/masonry.yml +37 -38
  125. data/lib/starter_web/_data/modules/masterslider.yml +78 -95
  126. data/lib/starter_web/_data/modules/navigator_menu.yml +12 -20
  127. data/lib/starter_web/_data/modules/particles.yml +3 -3
  128. data/lib/starter_web/_data/modules/scroller.yml +3 -3
  129. data/lib/starter_web/_data/modules/slim_select.yml +110 -0
  130. data/lib/starter_web/_data/modules/{themer.yml → themes.yml} +4 -4
  131. data/lib/starter_web/_data/resources.yml +83 -47
  132. data/lib/starter_web/_data/templates/feed.xml +1 -1
  133. data/lib/starter_web/_includes/attributes.asciidoc +354 -355
  134. data/lib/starter_web/_plugins/asciidoctor/gemini-ui-block.rb +1 -1
  135. data/lib/starter_web/_plugins/asciidoctor/slim-select-block.rb +45 -0
  136. data/lib/starter_web/_plugins/index/lunr.rb +1 -1
  137. data/lib/starter_web/collections/asciidoc_skeletons/simple-post/_posts/yyyy-mm-dd-your-post-name.asciidoc +5 -2
  138. data/lib/starter_web/collections/posts/public/featured/_posts/0000-00-00-welcome-to-j1.adoc.erb +3 -3
  139. data/lib/starter_web/collections/posts/public/featured/_posts/2021-01-01-about-cookies.adoc +9 -9
  140. data/lib/starter_web/collections/posts/public/featured/_posts/2021-02-01-static-site-generators.adoc +4 -4
  141. data/lib/starter_web/collections/posts/public/featured/_posts/2022-02-01-about-j1.adoc +3 -2
  142. data/lib/starter_web/collections/posts/public/featured/_posts/2023-10-18-url-types.adoc +12 -12
  143. data/lib/starter_web/package.json +1 -1
  144. data/lib/starter_web/pages/public/about/features.adoc +1 -1
  145. data/lib/starter_web/pages/public/about/reporting_issues.adoc +1 -0
  146. data/lib/starter_web/pages/public/asciidoc_skeletons/documentation/_includes/attributes.asciidoc +44 -44
  147. data/lib/starter_web/pages/public/asciidoc_skeletons/documentation/documentation.adoc +1 -0
  148. data/lib/starter_web/pages/public/asciidoc_skeletons/multi-document/_includes/attributes.asciidoc +12 -12
  149. data/lib/starter_web/pages/public/blog/navigator/archive/allview.html +1 -1
  150. data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/attributes.asciidoc +42 -28
  151. data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/highlghter_rouge.adoc +1 -0
  152. data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/lunr_search.adoc +1 -0
  153. data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/present_audio_video.adoc +18 -2
  154. data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/present_images.adoc +43 -50
  155. data/lib/starter_web/pages/public/legal/en/100_copyright.adoc +6 -11
  156. data/lib/starter_web/pages/public/legal/en/200_impress.adoc +4 -11
  157. data/lib/starter_web/pages/public/legal/en/300_privacy.adoc +5 -12
  158. data/lib/starter_web/pages/public/legal/en/400_comment_policy.adoc +5 -10
  159. data/lib/starter_web/pages/public/tools/previewer/_includes/attributes.asciidoc +10 -9
  160. data/lib/starter_web/pages/public/tools/previewer/preview_bootstrap_theme.adoc +77 -75
  161. metadata +52 -46
  162. data/lib/starter_web/pages/public/manuals/integrations/gemini/_includes/attributes.asciidoc +0 -47
  163. data/lib/starter_web/pages/public/manuals/integrations/gemini/_includes/documents/preview_google_adsense.asciidoc +0 -448
  164. data/lib/starter_web/pages/public/manuals/integrations/gemini/_includes/documents/readme +0 -0
  165. data/lib/starter_web/pages/public/manuals/integrations/gemini/_includes/tables/readme +0 -0
  166. data/lib/starter_web/pages/public/manuals/integrations/gemini/gemini.adoc +0 -525
  167. data/lib/starter_web/pages/public/manuals/integrations/gemini/security.asccidoc +0 -274
  168. data/lib/starter_web/pages/public/manuals/integrations/gemini/security.hrml +0 -560
  169. /data/lib/starter_web/pages/public/{legal/learn → learn}/bookshelf/article_previewer/viewer_biography.adoc +0 -0
  170. /data/lib/starter_web/pages/public/{legal/learn → learn}/bookshelf/article_previewer/viewer_fantasy.adoc +0 -0
  171. /data/lib/starter_web/pages/public/{legal/learn → learn}/bookshelf/article_previewer/viewer_romance.adoc +0 -0
  172. /data/lib/starter_web/pages/public/{legal/learn → learn}/bookshelf/jekyll_collections.adoc +0 -0
  173. /data/lib/starter_web/pages/public/{legal/learn → learn}/bookshelf/viewer_all_books.adoc +0 -0
  174. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/100_gistblock.asciidoc +0 -0
  175. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/410_bottom_info.asciidoc +0 -0
  176. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/410_bottom_left_warning.asciidoc +0 -0
  177. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/410_bottom_right_danger.asciidoc +0 -0
  178. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/410_central_success.asciidoc +0 -0
  179. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/410_full_height_left_info.asciidoc +0 -0
  180. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/410_full_height_right_success.asciidoc +0 -0
  181. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/410_table_bs_modal_examples.asciidoc +0 -0
  182. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/410_top_info.asciidoc +0 -0
  183. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/410_top_left_info.asciidoc +0 -0
  184. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/410_top_right_success.asciidoc +0 -0
  185. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/419_advanced_modals_demo.asciidoc +0 -0
  186. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/tables/bs_modal_examples.asciidoc +0 -0
  187. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/themes_bootstrap.asciidoc +0 -0
  188. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/themes_rouge.asciidoc +0 -0
  189. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/asciidoc_extensions.adoc +0 -0
  190. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/bootstrap_themes.adoc +0 -0
  191. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/icon_fonts.adoc +0 -0
  192. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/modal_extentions.adoc +0 -0
  193. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/responsive_tables.adoc +0 -0
  194. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/typography.adoc +0 -0
  195. /data/lib/starter_web/pages/public/{legal/learn → learn}/where_to_go.adoc +0 -0
@@ -1,525 +0,0 @@
1
- ---
2
- title: Google Gemini
3
- title_extention: Gemini API Integration for J1 Template
4
- tagline: User Guide for J1 Template
5
-
6
- date: 2022-08-14
7
-
8
- description: >
9
- Google Gemini refers to a family of large language models (LLMs)
10
- developed by Google DeepMind. It was announced on December 6, 2023,
11
- and is seen as the successor to "LaMDA" and "PaLM 2".
12
- keywords: >
13
- Jekyll, Theme, JekyllOne, Info, Google,
14
- Gemini, Manual
15
-
16
- categories: [ Manual, Module ]
17
- tags: [ Google, Gemini ]
18
-
19
- image:
20
- path: /assets/images/modules/attics/1920x1280/build-with-gemini.jpg
21
- width: 1920
22
- height: 1280
23
-
24
- tts: true
25
- comments: false
26
- exclude_from_search: false
27
- regenerate: false
28
- permalink: /pages/public/manuals/integrations/google/gemini/
29
-
30
- resources: [
31
- animate,
32
- clipboard, rouge
33
- ]
34
- resource_options:
35
- - attic:
36
- slides:
37
- - url: /assets/images/modules/attics/1920x1280/build-with-gemini.jpg
38
- alt: Build with Gemini
39
- # badge:
40
- # type: unsplash
41
- # author: Eleni Afiontzi
42
- # href: //unsplash.com/de/@eleniafiontzi
43
- ---
44
-
45
- // Page Initializer
46
- // =============================================================================
47
- // Enable the Liquid Preprocessor
48
- :page-liquid:
49
-
50
- // Set (local) page attributes here
51
- // -----------------------------------------------------------------------------
52
- // :page--attr: <attr-value>
53
- :images-dir: {imagesdir}/pages/roundtrip/100_present_images
54
-
55
- // Load Liquid procedures
56
- // -----------------------------------------------------------------------------
57
- {% capture load_attributes %}themes/{{site.template.name}}/procedures/global/attributes_loader.proc{%endcapture%}
58
-
59
- // Load page attributes
60
- // -----------------------------------------------------------------------------
61
- {% include {{load_attributes}} scope="all" %}
62
-
63
-
64
- // Page content
65
- // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
66
-
67
- // Include sub-documents (if any)
68
- // -----------------------------------------------------------------------------
69
- [role="dropcap"]
70
- Google Gemini refers to a family of large language models (LLMs) developed by
71
- Google DeepMind. It was announced on December 6, 2023, and is seen as the
72
- successor to LaMDA and PaLM 2.
73
-
74
- The Gemini family consists of three models:
75
-
76
- Gemini Ultra::
77
- The largest and most capable model. It excels at multimodal tasks, which
78
- involve understanding and generating text, code, and other forms of data.
79
-
80
- Gemini Pro::
81
- A smaller model, designed for a balance of performance and efficiency. It
82
- is well-suited for tasks such as question answering, summarization, and
83
- translation.
84
-
85
- Gemini Nano::
86
- The smallest model, optimized for mobile and edge devices. It can still
87
- perform basic language tasks such as text generation and translation.
88
-
89
-
90
- Gemini is still under development, but it has already achieved impressive
91
- results on a range of benchmarks. For example, Gemini Ultra achieved a
92
- state-of-the-art score of 59.4% on the new MMMU benchmark, which consists
93
- of multimodal tasks spanning different domains requiring deliberate reasoning.
94
-
95
- Google is making Gemini models available through Google AI Studio and
96
- Google Cloud Vertex AI, so developers can integrate them into their own
97
- applications. The company is also releasing a limited number of Gemini 1.5
98
- Pro models for early testing.
99
-
100
- [role="mt-5"]
101
- == Gemini Pro
102
-
103
- The first version of Gemini Pro is now accessible via the Gemini API and
104
- here’s more about it:
105
-
106
- * Gemini Pro outperforms other similarly-sized models on research
107
- benchmarks.
108
- * Today’s version comes with a 32K context window for text, and future
109
- versions will have a larger context window.
110
- * It’s free to use right now, within limits, and it will be competitively
111
- priced.
112
- * It comes with a range of features: function calling, embeddings, semantic
113
- retrieval and custom knowledge grounding, and chat functionality.
114
- * It supports 38 languages across 180+ countries and territories worldwide.
115
-
116
- In today’s release, Gemini Pro accepts text as input and generates text as##
117
- output. It is also made a dedicated Gemini Pro Vision multimodal endpoint
118
- available today that accepts text and imagery as input, with text output.
119
-
120
- SDKs are available for Gemini Pro to help you build apps that run anywhere.
121
- Python, Android (Kotlin), Node.js, Swift and JavaScript are all supported.
122
-
123
-
124
- [role="mt-5"]
125
- == Google AI Studio
126
- // https://ai.google.dev/docs
127
-
128
- link://ai.google.dev/[Google AI Studio, {browser-window--new}] is a free,
129
- web-based developer tool that enables you to quickly develop prompts and
130
- then get an API key to use in your app development.
131
-
132
- You can sign into Google AI Studio with your Google account and take
133
- advantage of the free quota, which allows 60 requests per minute; 20x
134
- more than other free offerings. When you’re ready, you can simply click
135
- on “Get code” to transfer your work to your IDE of choice, or use one of
136
- the quickstart templates available in Android Studio, Colab or Project IDX.
137
-
138
- To help us improve product quality, when you use the free quota, your API
139
- and Google AI Studio input and output may be accessible to trained reviewers.
140
- This data is de-identified from your Google account and API key.
141
-
142
-
143
- [role="mt-5"]
144
- == Safety settings
145
-
146
- This guide describes the adjustable safety settings available for the
147
- Gemini API. During the prototyping stage, you can adjust safety settings
148
- on 4 dimensions to quickly assess if your application requires more or
149
- less restrictive configuration.
150
-
151
- By default, safety settings block
152
- content (including prompts) with medium or higher probability of being
153
- unsafe across any dimension. This baseline safety is designed to work
154
- for most use cases, so you should only adjust your safety settings if
155
- it's consistently required for your application.
156
-
157
- [NOTE]
158
- ====
159
- Adjusting to lower safety settings will trigger a more indepth
160
- review process of your application.
161
- ====
162
-
163
- [role="mt-4"]
164
- === Safety filters
165
-
166
- In addition to the adjustable safety filters, the Gemini API has
167
- built-in protections against core harms, such as content that endangers
168
- child safety. These types of harm are always blocked and cannot be
169
- adjusted.
170
-
171
- The adjustable safety filters cover the following categories:
172
-
173
- * Harassment
174
- * Hate speech
175
- * Sexually explicit
176
- * Dangerous
177
-
178
- These settings allow the developer to determine what is appropriate for
179
- your use case. For example, if you're building a video game dialogue,
180
- you may deem it acceptable to allow more content rated as dangerous due
181
- to the nature of the game. Here are a few other example use cases that
182
- may need some flexibility in these safety settings:
183
-
184
- [cols="4a, 8a", options="header", width="100%", role="rtable mt-3 mb-5"]
185
- |===
186
- |Use Case |Category
187
-
188
- |Anti-Harassment Training App
189
- |Hate speech, Sexually explicit
190
-
191
- |Screenplay Writer
192
- |Sexually explicit, Dangerous
193
-
194
- |Toxicity classifier
195
- |Harassment, Dangerous
196
-
197
- |===
198
-
199
- [role="mt-4"]
200
- ==== Probability versus severity
201
-
202
- The Gemini API blocks content based on the *probability* of content
203
- being unsafe and *not* the severity. This is important to consider
204
- because some content can have low probability of being unsafe even
205
- though the severity of harm could still be high. For example, comparing
206
- the sentences:
207
-
208
- . The robot punched me.
209
- . The robot slashed me up.
210
-
211
- Sentence 1 might result in a higher probability of being unsafe but you
212
- might consider sentence 2 to be a higher severity in terms of violence.
213
-
214
- Given this, it is important for each developer to carefully test and
215
- consider what the appropriate level of blocking is needed to support
216
- their key use cases while minimizing harm to end users.
217
-
218
- [role="mt-4"]
219
- ==== Safety Settings
220
-
221
- Safety settings are part of the request you send to the text service. It
222
- can be adjusted for each request you make to the API. The following
223
- table lists the categories that you can set and describes the type of
224
- harm that each category encompasses.
225
-
226
- [cols="4a, 8a", options="header", width="100%", role="rtable mt-3 mb-5"]
227
- |===
228
- |Categories |Descriptions
229
-
230
- |Harassment
231
- |Negative or harmful comments targeting identity and/or
232
- protected attributes.
233
-
234
- |Hate speech
235
- |Content that is rude, disrespectful, or profane.
236
-
237
- |Sexually explicit
238
- |Contains references to sexual acts or other lewd
239
- content.
240
-
241
- |Dangerous
242
- |Promotes, facilitates, or encourages harmful acts.
243
-
244
- |===
245
-
246
- These definitions are in the
247
- link://ai.google.dev/api/rest/v1/HarmCategory[API reference, {browser-window--new}]
248
- as well. The Gemini models only support `HARM_CATEGORY_HARASSMENT`,
249
- `HARM_CATEGORY_HATE_SPEECH`, `HARM_CATEGORY_SEXUALLY_EXPLICIT`, and
250
- `HARM_CATEGORY_DANGEROUS_CONTENT`.
251
-
252
- The following table describes the block settings you can adjust for each
253
- category. For example, if you set the block setting to *Block few* for
254
- the *Hate speech* category, everything that has a high probability of
255
- being hate speech content is blocked. But anything with a lower
256
- probability is allowed.
257
-
258
- If not set, the default block setting is *Block some* for all
259
- categories.
260
-
261
- [cols="4a, 8a", options="header", width="100%", role="rtable mt-3 mb-5"]
262
- |===
263
- |Threshold (API) |Description
264
-
265
- |BLOCK_NONE
266
- |Always show regardless of probability of unsafe content
267
-
268
- |BLOCK_ONLY_HIGH
269
- |Block when high probability of unsafe content
270
-
271
- |BLOCK_MEDIUM_AND_ABOVE
272
- |Block when medium or high probability of unsafe content
273
-
274
- |BLOCK_LOW_AND_ABOVE
275
- |Block when low, medium or high
276
- probability of unsafe content
277
-
278
- |HARM_BLOCK_THRESHOLD_UNSPECIFIED
279
- |Threshold is unspecified, block using default threshold
280
-
281
- |===
282
-
283
- You can set these settings for each request you make to the text
284
- service. See the
285
- link://ai.google.dev/api/rest/v1/SafetySetting#harmblockthreshold[HarmBlockThreshold, {browser-window--new}]
286
- API reference for details.
287
-
288
- [role="mt-4"]
289
- ==== Safety feedback
290
-
291
- link://ai.google.dev/api/rest/v1/models/generateContent[generateContent, {browser-window--new}]
292
- returns a
293
- link //ai.google.dev/api/rest/v1/GenerateContentResponse[GenerateContentResponse, {browser-window--new}]
294
- which includes safety feedback.
295
-
296
- Prompt feedback is included in
297
- link://ai.google.dev/api/rest/v1/GenerateContentResponse#PromptFeedback[promptFeedback, {browser-window--new}].
298
- If
299
- link://ai.google.dev/api/rest/v1/GenerateContentResponse#blockreason[promptFeedback.blockReason, {browser-window--new}]
300
- is set, then the content of the prompt was blocked.
301
-
302
- Response candidate feedback is included in
303
- link://ai.google.dev/api/rest/v1/GenerateContentResponse#FinishReason[finishReason, {browser-window--new}]
304
- and
305
- link://ai.google.dev/api/rest/v1/GenerateContentResponse#safetyrating[safetyRatings, {browser-window--new}].
306
-
307
- If response content was blocked and the `finishReason` was `SAFETY`, you
308
- can inspect `safetyRatings` for more details. The safety rating includes
309
- the category and the probability of the harm classification. The content
310
- that was blocked is not returned.
311
-
312
- The probability returned correspond to the block confidence levels as
313
- shown in the following table:
314
-
315
- [cols="4a, 8a", options="header", width="100%", role="rtable mt-3 mb-5"]
316
- |===
317
- |Probability |Description
318
-
319
- |NEGLIGIBLE
320
- |Content has a negligible probability of being unsafe
321
-
322
- |LOW
323
- |Content has a low probability of being unsafe
324
-
325
- |MEDIUM
326
- |Content has a medium probability of being unsafe
327
-
328
- |HIGH
329
- |Content has a high probability of being unsafe
330
-
331
- |===
332
-
333
- For example, if the content was blocked due to the harassment category
334
- having a high probability, the safety rating returned would have
335
- category equal to `HARASSMENT` and harm probability set to `HIGH`.
336
-
337
- [role="mt-4"]
338
- === Safety settings in Google AI Studio
339
-
340
- You can also adjust safety settings in Google AI Studio, but you cannot
341
- turn them off. To do so, in the *Run settings*, click *Edit safety
342
- settings*:
343
-
344
- And use the knobs to adjust each setting:
345
-
346
-
347
- A [.material-icons]#warning# *No Content* message appears if the content
348
- is blocked. To see more details, hold the pointer over *No Content* and
349
- click [.material-icons]#warning# *Safety*.
350
-
351
- [role="mt-4"]
352
- === Code examples
353
-
354
- This section shows how to use the safety settings in code using the
355
- python client library.
356
-
357
- [role="mt-4"]
358
- ==== Request example
359
-
360
- The following is a python code snippet showing how to set safety
361
- settings in your `GenerateContent` call. This sets the harm categories
362
- `Harassment` and `Hate speech` to `BLOCK_LOW_AND_ABOVE` which blocks any
363
- content that has a low or higher probability of being harassment or hate
364
- speech.
365
-
366
- [source, js]
367
- ----
368
- import { GoogleGenerativeAI } from "//esm.run/@google/generative-ai";
369
-
370
- import { HarmCategory, HarmBlockThreshold } from "//esm.run/@google/generative-ai";
371
- const safetySettings = [
372
- {
373
- category: HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT,
374
- threshold: HarmBlockThreshold.BLOCK_MEDIUM_AND_ABOVE
375
- },
376
- {
377
- category: HarmCategory.HARM_CATEGORY_HARASSMENT,
378
- threshold: HarmBlockThreshold.BLOCK_ONLY_HIGH
379
- },
380
- {
381
- category: HarmCategory.HARM_CATEGORY_HATE_SPEECH,
382
- threshold: HarmBlockThreshold.BLOCK_ONLY_HIGH
383
- },
384
- {
385
- category: HarmCategory.HARM_CATEGORY_SEXUALLY_EXPLICIT,
386
- threshold: HarmBlockThreshold.BLOCK_NONE
387
- }
388
- ];
389
-
390
- const model = genAI.getGenerativeModel({
391
- model: "gemini-pro",
392
- safetySettings
393
- });
394
-
395
- ----
396
-
397
- [role="mt-4"]
398
- ==== Response example
399
-
400
- The following shows a code snippet for parsing the safety feedback from
401
- the response.
402
-
403
- [source, python]
404
- ----
405
- try:
406
-   print(response.text)
407
- except ValueError:
408
-   # If the response doesn't contain text, check if the prompt was blocked.
409
-   print(response.prompt_feedback)
410
-   # Also check the finish reason to see if the response was blocked.
411
-   print(response.candidates[0].finish_reason)
412
-   # If the finish reason was SAFETY, the safety ratings have more details.
413
-   print(response.candidates[0].safety_ratings)
414
- ----
415
-
416
- [role="mt-4"]
417
- === Next steps
418
-
419
- * See the link://ai.google.dev/api/[API reference, {browser-window--new}]
420
- to learn more about the full API.
421
- * Review the link://ai.google.dev/docs/safety_setting_gemini[safety guidance, {browser-window--new}]
422
- for a general look at safety considerations when developing with LLMs.
423
- * Learn more about assessing probability versus severity from the
424
- link://developers.perspectiveapi.com/s/about-the-api-score[Jigsaw team, {browser-window--new}]
425
- * Learn more about the products that contribute to safety solutions
426
- like the
427
- link://medium.com/jigsaw/reducing-toxicity-in-large-language-models-with-perspective-api-c31c39b7a4d7[Perspective API, {browser-window--new}].
428
- * You can use these safety settings to create a toxicity classifier.
429
- See the
430
- link://ai.google.dev/examples/train_text_classifier_embeddings[classification example, {browser-window--new}]
431
- to get started.
432
-
433
- [role="mt-5"]
434
- == Train a Google Gemini bot using the API interface
435
-
436
- . Set Up a Google Cloud Project
437
-
438
- * Create a Google Cloud project if you don't already have one.
439
- * Enable the Dialogflow API and the Gemini API.
440
- * Create a service account with the "Dialogflow API Admin" and "Gemini API Admin" roles.
441
- * Generate a private key for the service account.
442
-
443
- [start=2]
444
- . Create a Gemini Agent
445
-
446
- * Go to the Gemini console and click "Create Agent".
447
- * Enter a name and description for your agent.
448
- * Select the language for your agent.
449
- * Click "Create".
450
- * Link Your Dialogflow Agent to Your Gemini Agent
451
-
452
- [start=3]
453
- . Go to the Dialogflow console and open your agent.
454
-
455
- * Click the "Integrations" tab.
456
- * Click "Add Integration".
457
- * Select "Gemini" from the list of integrations.
458
- * Enter the Gemini API endpoint and your service account's private key.
459
- * Click "Link".
460
-
461
- [start=4]
462
- . Train Your Gemini Bot
463
-
464
- * Open the Gemini console and go to the "Training" tab.
465
- * Click "Create Training Run".
466
- * Select your agent from the dropdown list.
467
- * Enter a name for the training run.
468
- * Select the training data to use.
469
- * Click "Start Training".
470
-
471
- [start=5]
472
- . Test the Agent
473
-
474
- * Click "Test" in the top right corner of the Dialogflow Console.
475
- * Type in a message and press "Enter."
476
- * The agent will generate a response based on the training data.
477
-
478
- [start=6]
479
- . Deploy the Agent to Gemini
480
-
481
- * Click the "Deploy" button in the top right corner of the Dialogflow Console.
482
- * Select "Gemini" as the deployment target.
483
- * Click "Deploy."
484
-
485
- [role="mt-4"]
486
- === Monitor the Training Process
487
-
488
- The training process will take some time. You can monitor the progress in the Gemini console.
489
- Once the training is complete, you will receive an email notification.
490
- Deploy Your Gemini Bot
491
-
492
- Once the training is complete, you can deploy your bot to your website or mobile app.
493
- To do this, you will need to generate a deployment token from the Gemini console.
494
- Follow the instructions in the Gemini documentation to deploy your bot.
495
- Test Your Bot
496
-
497
- [role="mt-4"]
498
- === Test the bot
499
-
500
- Once your bot is deployed, you can test it by sending it messages.
501
- You can use the Gemini console or the Gemini API to send messages to your bot.
502
- Evaluate the bot's responses to ensure that it is functioning as expected.
503
- Maintain and Update Your Bot
504
-
505
- Over time, you may need to maintain and update your bot.
506
- This may involve retraining the bot with new data or fixing bugs.
507
- You can use the Gemini console or the Gemini API to manage your bot.
508
- By following these steps, you can train, deploy, and maintain a Google Gemini bot using the API interface.
509
-
510
- [role="mt-5"]
511
- == What's next
512
-
513
- Prompt design is the process of creating prompts that elicit the desired
514
- response from language models. Writing well structured prompts is an essential
515
- part of ensuring accurate, high quality responses from a language model.
516
- Learn about link://ai.google.dev/docs/prompt_best_practices[best practices for prompt writing, {browser-window--new}].
517
-
518
- Gemini offers several model variations to meet the needs of different use
519
- cases, such as input types and complexity, implementations for chat or other
520
- dialog language tasks, and size constraints. Learn about the
521
- link://ai.google.dev/models/gemini[available Gemini models, {browser-window--new}].
522
-
523
- Gemini offers options for
524
- link://ai.google.dev/docs/increase_quota[requesting rate limit increases, {browser-window--new}].
525
- The rate limit for Gemini Pro models is 60 requests per minute (RPM).