Skip to content

Commit 98b2114

Browse files
authored
Format and clear outputs. (#512)
1 parent 741ebaf commit 98b2114

File tree

2 files changed

+43
-341
lines changed

2 files changed

+43
-341
lines changed

templates/aistudio_gemini_prompt_chat_b64.ipynb

Lines changed: 21 additions & 176 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
},
1212
{
1313
"cell_type": "code",
14-
"execution_count": 1,
14+
"execution_count": null,
1515
"metadata": {
1616
"cellView": "form",
1717
"id": "tuOe1ymfHZPu"
@@ -51,27 +51,18 @@
5151
},
5252
{
5353
"cell_type": "code",
54-
"execution_count": 2,
54+
"execution_count": null,
5555
"metadata": {
5656
"id": "cZiU4TKzznh9"
5757
},
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": [],
6859
"source": [
6960
"!pip install -U -q google-generativeai"
7061
]
7162
},
7263
{
7364
"cell_type": "code",
74-
"execution_count": 3,
65+
"execution_count": null,
7566
"metadata": {
7667
"id": "kWIuwKG2_oWE"
7768
},
@@ -121,7 +112,7 @@
121112
},
122113
{
123114
"cell_type": "code",
124-
"execution_count": 5,
115+
"execution_count": null,
125116
"metadata": {
126117
"id": "_SvYoR3WCeKr"
127118
},
@@ -142,7 +133,7 @@
142133
},
143134
{
144135
"cell_type": "code",
145-
"execution_count": 6,
136+
"execution_count": null,
146137
"metadata": {
147138
"id": "uIog-0SyDuIF"
148139
},
@@ -163,89 +154,44 @@
163154
},
164155
{
165156
"cell_type": "code",
166-
"execution_count": 7,
157+
"execution_count": null,
167158
"metadata": {
168159
"id": "wBS8xNhN0x62"
169160
},
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": [],
183162
"source": [
184163
"contents"
185164
]
186165
},
187166
{
188167
"cell_type": "code",
189-
"execution_count": 8,
168+
"execution_count": null,
190169
"metadata": {
191170
"id": "1681593ef561"
192171
},
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": [],
205173
"source": [
206174
"generation_config"
207175
]
208176
},
209177
{
210178
"cell_type": "code",
211-
"execution_count": 9,
179+
"execution_count": null,
212180
"metadata": {
213181
"id": "a2c31f8f1894"
214182
},
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": [],
227184
"source": [
228185
"safety_settings"
229186
]
230187
},
231188
{
232189
"cell_type": "code",
233-
"execution_count": 10,
190+
"execution_count": null,
234191
"metadata": {
235192
"id": "4d17bac9fefc"
236193
},
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": [],
249195
"source": [
250196
"user_input"
251197
]
@@ -261,7 +207,7 @@
261207
},
262208
{
263209
"cell_type": "code",
264-
"execution_count": 11,
210+
"execution_count": null,
265211
"metadata": {
266212
"id": "LB2LxPmAB95V"
267213
},
@@ -279,134 +225,33 @@
279225
},
280226
{
281227
"cell_type": "code",
282-
"execution_count": 12,
228+
"execution_count": null,
283229
"metadata": {
284230
"id": "Lm3RXwYuGtZK"
285231
},
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": [],
327233
"source": [
328234
"display(Markdown(response.text))"
329235
]
330236
},
331237
{
332238
"cell_type": "code",
333-
"execution_count": 13,
239+
"execution_count": null,
334240
"metadata": {
335241
"id": "JbKuUc3NGxYD"
336242
},
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": [],
364244
"source": [
365245
"response.prompt_feedback"
366246
]
367247
},
368248
{
369249
"cell_type": "code",
370-
"execution_count": 14,
250+
"execution_count": null,
371251
"metadata": {
372252
"id": "SLAaIq3kgwwJ"
373253
},
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": [],
410255
"source": [
411256
"response.candidates"
412257
]

0 commit comments

Comments
 (0)