|
11 | 11 | }, |
12 | 12 | { |
13 | 13 | "cell_type": "code", |
14 | | - "execution_count": 1, |
| 14 | + "execution_count": null, |
15 | 15 | "metadata": { |
16 | 16 | "cellView": "form", |
17 | 17 | "id": "tuOe1ymfHZPu" |
|
51 | 51 | }, |
52 | 52 | { |
53 | 53 | "cell_type": "code", |
54 | | - "execution_count": 2, |
| 54 | + "execution_count": null, |
55 | 55 | "metadata": { |
56 | 56 | "id": "cZiU4TKzznh9" |
57 | 57 | }, |
58 | | - "outputs": [ |
59 | | - { |
60 | | - "name": "stdout", |
61 | | - "output_type": "stream", |
62 | | - "text": [ |
63 | | - "\u001b[33mWARNING: There was an error checking the latest version of pip.\u001b[0m\u001b[33m\n", |
64 | | - "\u001b[0m" |
65 | | - ] |
66 | | - } |
67 | | - ], |
| 58 | + "outputs": [], |
68 | 59 | "source": [ |
69 | 60 | "!pip install -U -q google-generativeai" |
70 | 61 | ] |
71 | 62 | }, |
72 | 63 | { |
73 | 64 | "cell_type": "code", |
74 | | - "execution_count": 3, |
| 65 | + "execution_count": null, |
75 | 66 | "metadata": { |
76 | 67 | "id": "kWIuwKG2_oWE" |
77 | 68 | }, |
|
121 | 112 | }, |
122 | 113 | { |
123 | 114 | "cell_type": "code", |
124 | | - "execution_count": 5, |
| 115 | + "execution_count": null, |
125 | 116 | "metadata": { |
126 | 117 | "id": "_SvYoR3WCeKr" |
127 | 118 | }, |
|
142 | 133 | }, |
143 | 134 | { |
144 | 135 | "cell_type": "code", |
145 | | - "execution_count": 6, |
| 136 | + "execution_count": null, |
146 | 137 | "metadata": { |
147 | 138 | "id": "uIog-0SyDuIF" |
148 | 139 | }, |
|
163 | 154 | }, |
164 | 155 | { |
165 | 156 | "cell_type": "code", |
166 | | - "execution_count": 7, |
| 157 | + "execution_count": null, |
167 | 158 | "metadata": { |
168 | 159 | "id": "wBS8xNhN0x62" |
169 | 160 | }, |
170 | | - "outputs": [ |
171 | | - { |
172 | | - "data": { |
173 | | - "text/plain": [ |
174 | | - "[{'role': 'user', 'parts': [{'text': 'hello'}]},\n", |
175 | | - " {'role': 'model', 'parts': [{'text': 'Hello! How can I assist you today?'}]}]" |
176 | | - ] |
177 | | - }, |
178 | | - "execution_count": 7, |
179 | | - "metadata": {}, |
180 | | - "output_type": "execute_result" |
181 | | - } |
182 | | - ], |
| 161 | + "outputs": [], |
183 | 162 | "source": [ |
184 | 163 | "contents" |
185 | 164 | ] |
186 | 165 | }, |
187 | 166 | { |
188 | 167 | "cell_type": "code", |
189 | | - "execution_count": 8, |
| 168 | + "execution_count": null, |
190 | 169 | "metadata": { |
191 | 170 | "id": "1681593ef561" |
192 | 171 | }, |
193 | | - "outputs": [ |
194 | | - { |
195 | | - "data": { |
196 | | - "text/plain": [ |
197 | | - "{}" |
198 | | - ] |
199 | | - }, |
200 | | - "execution_count": 8, |
201 | | - "metadata": {}, |
202 | | - "output_type": "execute_result" |
203 | | - } |
204 | | - ], |
| 172 | + "outputs": [], |
205 | 173 | "source": [ |
206 | 174 | "generation_config" |
207 | 175 | ] |
208 | 176 | }, |
209 | 177 | { |
210 | 178 | "cell_type": "code", |
211 | | - "execution_count": 9, |
| 179 | + "execution_count": null, |
212 | 180 | "metadata": { |
213 | 181 | "id": "a2c31f8f1894" |
214 | 182 | }, |
215 | | - "outputs": [ |
216 | | - { |
217 | | - "data": { |
218 | | - "text/plain": [ |
219 | | - "{}" |
220 | | - ] |
221 | | - }, |
222 | | - "execution_count": 9, |
223 | | - "metadata": {}, |
224 | | - "output_type": "execute_result" |
225 | | - } |
226 | | - ], |
| 183 | + "outputs": [], |
227 | 184 | "source": [ |
228 | 185 | "safety_settings" |
229 | 186 | ] |
230 | 187 | }, |
231 | 188 | { |
232 | 189 | "cell_type": "code", |
233 | | - "execution_count": 10, |
| 190 | + "execution_count": null, |
234 | 191 | "metadata": { |
235 | 192 | "id": "4d17bac9fefc" |
236 | 193 | }, |
237 | | - "outputs": [ |
238 | | - { |
239 | | - "data": { |
240 | | - "text/plain": [ |
241 | | - "'How does electricity work?'" |
242 | | - ] |
243 | | - }, |
244 | | - "execution_count": 10, |
245 | | - "metadata": {}, |
246 | | - "output_type": "execute_result" |
247 | | - } |
248 | | - ], |
| 194 | + "outputs": [], |
249 | 195 | "source": [ |
250 | 196 | "user_input" |
251 | 197 | ] |
|
261 | 207 | }, |
262 | 208 | { |
263 | 209 | "cell_type": "code", |
264 | | - "execution_count": 11, |
| 210 | + "execution_count": null, |
265 | 211 | "metadata": { |
266 | 212 | "id": "LB2LxPmAB95V" |
267 | 213 | }, |
|
279 | 225 | }, |
280 | 226 | { |
281 | 227 | "cell_type": "code", |
282 | | - "execution_count": 12, |
| 228 | + "execution_count": null, |
283 | 229 | "metadata": { |
284 | 230 | "id": "Lm3RXwYuGtZK" |
285 | 231 | }, |
286 | | - "outputs": [ |
287 | | - { |
288 | | - "data": { |
289 | | - "text/markdown": [ |
290 | | - "Electricity is the flow of electric charge. It is a fundamental part of nature and is responsible for a wide range of phenomena, from lightning and static electricity to the operation of electronic devices.\n", |
291 | | - "\n", |
292 | | - "**Basic Principles of Electricity:**\n", |
293 | | - "\n", |
294 | | - "1. **Electric Charge:** Matter is made up of atoms, which have a positively charged nucleus surrounded by negatively charged electrons. The movement of these charged particles creates electric currents.\n", |
295 | | - "\n", |
296 | | - "2. **Electric Field:** Electric charges create an electric field around them. The strength and direction of this field depend on the amount and type of charge.\n", |
297 | | - "\n", |
298 | | - "3. **Electric Potential:** Electric potential is the amount of electrical energy stored in a region of space. It is measured in volts (V).\n", |
299 | | - "\n", |
300 | | - "4. **Electric Current:** Electric current is the flow of electric charge through a conductor. It is measured in amperes (A).\n", |
301 | | - "\n", |
302 | | - "**How Electricity Works:**\n", |
303 | | - "\n", |
304 | | - "1. **Generation of Electricity:** Electricity can be generated in various ways, including:\n", |
305 | | - " - **Mechanical Energy:** Generators convert mechanical energy into electrical energy by spinning a conductor in a magnetic field. This is the principle behind power plants that use turbines driven by steam, water, or wind.\n", |
306 | | - " - **Chemical Energy:** Batteries generate electricity through chemical reactions.\n", |
307 | | - " - **Solar Energy:** Solar cells convert sunlight directly into electricity using the photovoltaic effect.\n", |
308 | | - "\n", |
309 | | - "2. **Transmission of Electricity:** Electricity is transmitted over long distances through power lines. These lines are made of conductive materials, such as copper or aluminum, which allow electrons to flow easily.\n", |
310 | | - "\n", |
311 | | - "3. **Distribution of Electricity:** Once electricity reaches populated areas, it is distributed to homes, businesses, and other consumers through a network of local power lines and transformers.\n", |
312 | | - "\n", |
313 | | - "4. **Utilization of Electricity:** Electricity is used to power various devices and appliances by converting electrical energy into other forms of energy, such as light, heat, or motion.\n", |
314 | | - "\n", |
315 | | - "The flow of electricity in a circuit is driven by the difference in electric potential between two points. When a complete circuit is formed, electrons can flow from a region of higher potential to a region of lower potential, creating an electric current.\n", |
316 | | - "\n", |
317 | | - "Electricity is a versatile form of energy that has revolutionized modern society. It is used in a wide range of applications, from lighting and heating to powering computers and transportation systems." |
318 | | - ], |
319 | | - "text/plain": [ |
320 | | - "<IPython.core.display.Markdown object>" |
321 | | - ] |
322 | | - }, |
323 | | - "metadata": {}, |
324 | | - "output_type": "display_data" |
325 | | - } |
326 | | - ], |
| 232 | + "outputs": [], |
327 | 233 | "source": [ |
328 | 234 | "display(Markdown(response.text))" |
329 | 235 | ] |
330 | 236 | }, |
331 | 237 | { |
332 | 238 | "cell_type": "code", |
333 | | - "execution_count": 13, |
| 239 | + "execution_count": null, |
334 | 240 | "metadata": { |
335 | 241 | "id": "JbKuUc3NGxYD" |
336 | 242 | }, |
337 | | - "outputs": [ |
338 | | - { |
339 | | - "data": { |
340 | | - "text/plain": [ |
341 | | - "safety_ratings {\n", |
342 | | - " category: HARM_CATEGORY_SEXUALLY_EXPLICIT\n", |
343 | | - " probability: NEGLIGIBLE\n", |
344 | | - "}\n", |
345 | | - "safety_ratings {\n", |
346 | | - " category: HARM_CATEGORY_HATE_SPEECH\n", |
347 | | - " probability: NEGLIGIBLE\n", |
348 | | - "}\n", |
349 | | - "safety_ratings {\n", |
350 | | - " category: HARM_CATEGORY_HARASSMENT\n", |
351 | | - " probability: NEGLIGIBLE\n", |
352 | | - "}\n", |
353 | | - "safety_ratings {\n", |
354 | | - " category: HARM_CATEGORY_DANGEROUS_CONTENT\n", |
355 | | - " probability: NEGLIGIBLE\n", |
356 | | - "}" |
357 | | - ] |
358 | | - }, |
359 | | - "execution_count": 13, |
360 | | - "metadata": {}, |
361 | | - "output_type": "execute_result" |
362 | | - } |
363 | | - ], |
| 243 | + "outputs": [], |
364 | 244 | "source": [ |
365 | 245 | "response.prompt_feedback" |
366 | 246 | ] |
367 | 247 | }, |
368 | 248 | { |
369 | 249 | "cell_type": "code", |
370 | | - "execution_count": 14, |
| 250 | + "execution_count": null, |
371 | 251 | "metadata": { |
372 | 252 | "id": "SLAaIq3kgwwJ" |
373 | 253 | }, |
374 | | - "outputs": [ |
375 | | - { |
376 | | - "data": { |
377 | | - "text/plain": [ |
378 | | - "[index: 0\n", |
379 | | - "content {\n", |
380 | | - " parts {\n", |
381 | | - " text: \"Electricity is the flow of electric charge. It is a fundamental part of nature and is responsible for a wide range of phenomena, from lightning and static electricity to the operation of electronic devices.\\n\\n**Basic Principles of Electricity:**\\n\\n1. **Electric Charge:** Matter is made up of atoms, which have a positively charged nucleus surrounded by negatively charged electrons. The movement of these charged particles creates electric currents.\\n\\n2. **Electric Field:** Electric charges create an electric field around them. The strength and direction of this field depend on the amount and type of charge.\\n\\n3. **Electric Potential:** Electric potential is the amount of electrical energy stored in a region of space. It is measured in volts (V).\\n\\n4. **Electric Current:** Electric current is the flow of electric charge through a conductor. It is measured in amperes (A).\\n\\n**How Electricity Works:**\\n\\n1. **Generation of Electricity:** Electricity can be generated in various ways, including:\\n - **Mechanical Energy:** Generators convert mechanical energy into electrical energy by spinning a conductor in a magnetic field. This is the principle behind power plants that use turbines driven by steam, water, or wind.\\n - **Chemical Energy:** Batteries generate electricity through chemical reactions.\\n - **Solar Energy:** Solar cells convert sunlight directly into electricity using the photovoltaic effect.\\n\\n2. **Transmission of Electricity:** Electricity is transmitted over long distances through power lines. These lines are made of conductive materials, such as copper or aluminum, which allow electrons to flow easily.\\n\\n3. **Distribution of Electricity:** Once electricity reaches populated areas, it is distributed to homes, businesses, and other consumers through a network of local power lines and transformers.\\n\\n4. **Utilization of Electricity:** Electricity is used to power various devices and appliances by converting electrical energy into other forms of energy, such as light, heat, or motion.\\n\\nThe flow of electricity in a circuit is driven by the difference in electric potential between two points. When a complete circuit is formed, electrons can flow from a region of higher potential to a region of lower potential, creating an electric current.\\n\\nElectricity is a versatile form of energy that has revolutionized modern society. It is used in a wide range of applications, from lighting and heating to powering computers and transportation systems.\"\n", |
382 | | - " }\n", |
383 | | - " role: \"model\"\n", |
384 | | - "}\n", |
385 | | - "finish_reason: STOP\n", |
386 | | - "safety_ratings {\n", |
387 | | - " category: HARM_CATEGORY_SEXUALLY_EXPLICIT\n", |
388 | | - " probability: NEGLIGIBLE\n", |
389 | | - "}\n", |
390 | | - "safety_ratings {\n", |
391 | | - " category: HARM_CATEGORY_HATE_SPEECH\n", |
392 | | - " probability: NEGLIGIBLE\n", |
393 | | - "}\n", |
394 | | - "safety_ratings {\n", |
395 | | - " category: HARM_CATEGORY_HARASSMENT\n", |
396 | | - " probability: NEGLIGIBLE\n", |
397 | | - "}\n", |
398 | | - "safety_ratings {\n", |
399 | | - " category: HARM_CATEGORY_DANGEROUS_CONTENT\n", |
400 | | - " probability: NEGLIGIBLE\n", |
401 | | - "}\n", |
402 | | - "]" |
403 | | - ] |
404 | | - }, |
405 | | - "execution_count": 14, |
406 | | - "metadata": {}, |
407 | | - "output_type": "execute_result" |
408 | | - } |
409 | | - ], |
| 254 | + "outputs": [], |
410 | 255 | "source": [ |
411 | 256 | "response.candidates" |
412 | 257 | ] |
|
0 commit comments