Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
schorndorfer committed Nov 10, 2023
1 parent e688c91 commit b9b6758
Show file tree
Hide file tree
Showing 5 changed files with 239 additions and 95 deletions.
164 changes: 114 additions & 50 deletions _sources/analyze-text.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 2,
"metadata": {
"tags": [
"hide-input"
Expand All @@ -52,15 +52,15 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "39c4a7ca6071465ab5b8176860fe34e4",
"model_id": "381ae5cdc97546e294b08b535e29a621",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Map(center=[20, 0], controls=(ZoomControl(options=['position', 'zoom_in_text', 'zoom_in_title', 'zoom_out_text…"
]
},
"execution_count": 1,
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
Expand Down Expand Up @@ -143,7 +143,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 3,
"metadata": {
"tags": [
"hide-input"
Expand All @@ -162,11 +162,10 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"# This code is for v1 of the openai package: pypi.org/project/openai\n",
"from openai import OpenAI\n",
"client = OpenAI()\n",
"\n",
Expand Down Expand Up @@ -194,7 +193,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 5,
"metadata": {
"tags": [
"hide-input"
Expand Down Expand Up @@ -293,6 +292,98 @@
"print(json.dumps(data, indent=4))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": [
"hide-input"
]
},
"outputs": [],
"source": [
"output = \"\"\"\n",
"{\n",
" \"title\": \"FEWER-TOKEN NEURAL SPEECH CODEC WITH TIME-INVARIANT CODES\",\n",
" \"authors\": [\n",
" {\n",
" \"name\": \"Yong Ren\",\n",
" \"email\": null,\n",
" \"affiliations\": [\n",
" 1,\n",
" 2\n",
" ]\n",
" },\n",
" {\n",
" \"name\": \"Tao Wang\",\n",
" \"email\": null,\n",
" \"affiliations\": [\n",
" 1\n",
" ]\n",
" },\n",
" {\n",
" \"name\": \"Jiangyan Yi\",\n",
" \"email\": null,\n",
" \"affiliations\": [\n",
" 1\n",
" ]\n",
" },\n",
" {\n",
" \"name\": \"Le Xu\",\n",
" \"email\": null,\n",
" \"affiliations\": [\n",
" 1,\n",
" 2\n",
" ]\n",
" },\n",
" {\n",
" \"name\": \"Jianhua Tao\",\n",
" \"email\": null,\n",
" \"affiliations\": [\n",
" 3\n",
" ]\n",
" },\n",
" {\n",
" \"name\": \"Chuyuan Zhang\",\n",
" \"email\": null,\n",
" \"affiliations\": [\n",
" 1,\n",
" 2\n",
" ]\n",
" },\n",
" {\n",
" \"name\": \"Junzuo Zhou\",\n",
" \"email\": null,\n",
" \"affiliations\": [\n",
" 1,\n",
" 2\n",
" ]\n",
" }\n",
" ],\n",
" \"affiliations\": [\n",
" {\n",
" \"index\": 1,\n",
" \"name\": \"Institute of Automation, Chinese Academy of Sciences, China\",\n",
" \"longitude\": \"116.331398\",\n",
" \"latitude\": \"39.897445\"\n",
" },\n",
" {\n",
" \"index\": 2,\n",
" \"name\": \"University of Chinese Academy of Sciences, China\",\n",
" \"longitude\": \"116.651381\",\n",
" \"latitude\": \"40.12114\"\n",
" },\n",
" {\n",
" \"index\": 3,\n",
" \"name\": \"Department of Automation, Tsinghua University, China\",\n",
" \"longitude\": \"116.326443\",\n",
" \"latitude\": \"40.00368\"\n",
" }\n",
" ]\n",
"}\n",
"\"\"\""
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -339,7 +430,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 6,
"metadata": {
"tags": [
"hide-input"
Expand Down Expand Up @@ -409,7 +500,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 7,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -497,42 +588,15 @@
"cell_type": "markdown",
"metadata": {},
"source": [
":::{admonition} Payoff!\n",
":::{admonition} Payoff\n",
":class: important\n",
"Now we can populate the map!\n",
"Now we can do analysis on clusters of innovation and collaboration across authors and institutions. And we can populate the map!\n",
":::"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "af16af07932b4fc88283c9bb63c10ddf",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Map(center=[20, 0], controls=(ZoomControl(options=['position', 'zoom_in_text', 'zoom_in_title', 'zoom_out_text…"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"map = leafmap.Map()\n",
"map.add_xy_data(df_extracted, x=\"longitude\", y=\"latitude\", layer_name=\"World Cities\")\n",
"map"
]
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 14,
"metadata": {
"tags": [
"hide-input"
Expand All @@ -542,35 +606,35 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "a53b869e1ee94507b5971ea21e6db10f",
"model_id": "90c99dc7421149dd9968d9413aa634f5",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Map(center=[42.0451, -87.6877], close_popup_on_click=False, controls=(ZoomControl(options=['position', 'zoom_i"
"Map(center=[42.0451, -87.6877], controls=(ZoomControl(options=['position', 'zoom_in_text', 'zoom_in_title', 'z"
]
},
"execution_count": 6,
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from ipywidgets import HTML\n",
"from ipyleaflet import Map, Marker, Popup\n",
"from ipyleaflet import Map, Marker, Popup, MarkerCluster\n",
"\n",
"center = (42.0451, -87.6877)\n",
"map2 = Map(center=center, zoom=2, close_popup_on_click=False)\n",
"map2 = Map(center=center, zoom=2, close_popup_on_click=True)\n",
"\n",
"\n",
"for row in list(df_extracted.iterrows())[:100]:\n",
"markers = []\n",
"for row in list(df_extracted.iterrows())[:500]:\n",
" marker = Marker(location=(row[1]['latitude'], row[1]['longitude']))\n",
" message = HTML()\n",
" message.value = f\"{row[1]['author']} <b>{row[1]['affiliation']}</b>\"\n",
" message.placeholder = \"Author\"\n",
" message.description = \"Author\"\n",
" message.value = f\"{row[1]['author']}: <b>{row[1]['affiliation']}</b>\"\n",
" marker.popup = message\n",
" map2.add_layer(marker)\n",
" markers.append(marker)\n",
"\n",
"map2.add_layer(MarkerCluster(markers=markers))\n",
"\n",
"map2"
]
Expand Down
148 changes: 115 additions & 33 deletions analyze-text.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions function-calling.html
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ <h2>Flight Status Query Project<a class="headerlink" href="#flight-status-query-
</div>
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>ChatCompletion(id=&#39;chatcmpl-8JDCJIXNhMzVHQQ5DPp2lL1Kd1pya&#39;, choices=[Choice(finish_reason=&#39;function_call&#39;, index=0, message=ChatCompletionMessage(content=None, role=&#39;assistant&#39;, function_call=FunctionCall(arguments=&#39;{\n &quot;airline_code&quot;: &quot;UA&quot;,\n &quot;flight_number&quot;: 792,\n &quot;day&quot;: 9,\n &quot;month&quot;: 11,\n &quot;year&quot;: 2023\n}&#39;, name=&#39;get_flight_status&#39;), tool_calls=None))], created=1699589655, model=&#39;gpt-3.5-turbo-0613&#39;, object=&#39;chat.completion&#39;, system_fingerprint=None, usage=CompletionUsage(completion_tokens=48, prompt_tokens=119, total_tokens=167))
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>ChatCompletion(id=&#39;chatcmpl-8JLwplX6jjVH4G8uztQHbxlT4jFzU&#39;, choices=[Choice(finish_reason=&#39;function_call&#39;, index=0, message=ChatCompletionMessage(content=None, role=&#39;assistant&#39;, function_call=FunctionCall(arguments=&#39;{\n &quot;airline_code&quot;: &quot;UA&quot;,\n &quot;flight_number&quot;: 792,\n &quot;day&quot;: 9,\n &quot;month&quot;: 11,\n &quot;year&quot;: 2023\n}&#39;, name=&#39;get_flight_status&#39;), tool_calls=None))], created=1699623291, model=&#39;gpt-3.5-turbo-0613&#39;, object=&#39;chat.completion&#39;, system_fingerprint=None, usage=CompletionUsage(completion_tokens=48, prompt_tokens=119, total_tokens=167))
</pre></div>
</div>
</div>
Expand Down Expand Up @@ -623,7 +623,7 @@ <h2>Flight Status Query Project<a class="headerlink" href="#flight-status-query-
</div>
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>ChatCompletion(id=&#39;chatcmpl-8JDCLIQJ8Tm7bERPgm5a9YUlyL3ib&#39;, choices=[Choice(finish_reason=&#39;stop&#39;, index=0, message=ChatCompletionMessage(content=&#39;The flight UA 792 is scheduled to depart on November 9, 2023, at 06:00 CST and arrive at 09:06 EST. The flight is currently on time.&#39;, role=&#39;assistant&#39;, function_call=None, tool_calls=None))], created=1699589657, model=&#39;gpt-3.5-turbo-0613&#39;, object=&#39;chat.completion&#39;, system_fingerprint=None, usage=CompletionUsage(completion_tokens=41, prompt_tokens=143, total_tokens=184))
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>ChatCompletion(id=&#39;chatcmpl-8JLwrVvNEZssUDuo4Tr4xCAkxhpiW&#39;, choices=[Choice(finish_reason=&#39;stop&#39;, index=0, message=ChatCompletionMessage(content=&#39;The flight status of UA 792 for Nov 9, 2023 is on time. It is scheduled to depart at 06:00 CST and arrive at 09:06 EST.&#39;, role=&#39;assistant&#39;, function_call=None, tool_calls=None))], created=1699623293, model=&#39;gpt-3.5-turbo-0613&#39;, object=&#39;chat.completion&#39;, system_fingerprint=None, usage=CompletionUsage(completion_tokens=40, prompt_tokens=143, total_tokens=183))
</pre></div>
</div>
</div>
Expand All @@ -638,7 +638,7 @@ <h2>Flight Status Query Project<a class="headerlink" href="#flight-status-query-
</div>
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>The flight UA 792 is scheduled to depart on November 9, 2023, at 06:00 CST and arrive at 09:06 EST. The flight is currently on time.
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>The flight status of UA 792 for Nov 9, 2023 is on time. It is scheduled to depart at 06:00 CST and arrive at 09:06 EST.
</pre></div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion searchindex.js

Large diffs are not rendered by default.

14 changes: 6 additions & 8 deletions setting-up-openai.html
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ <h2>Code Example<a class="headerlink" href="#code-example" title="Permalink to t
</div>
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>ChatCompletion(id=&#39;chatcmpl-8JDCPtRtrRWmC1g7k5zjLBBCGU4E3&#39;, choices=[Choice(finish_reason=&#39;length&#39;, index=0, message=ChatCompletionMessage(content=&#39;As a lion tamer with extensive knowledge in zoology and large cat psychology, being in the same room as a lion is a profound mix of exhilaration, respect, and careful calculation. Each interaction with a lion, regardless of my expertise, requires a high degree of awareness and understanding of lion behavior.\n\nHere are a few aspects of the experience:\n\n1. **Respect for Power**: Being in close proximity to such a formidable predator is an immediate reminder of their strength, agility, and potential for danger. Lions are apex predators with powerful jaws, large teeth, and muscular bodies capable of swift and deadly action.\n\n2. **Heightened Senses**: My senses are heightened, and I remain attuned to every movement, sound, and even the subtleties of the lion\&#39;s body language. This intense focus helps to anticipate the lion\&#39;s actions and respond appropriately.\n\n3. **Bond and Trust**: Over time, building a relationship with individual lions leads to a mutual understanding and a bond that can sometimes resemble trust. This &quot;trust,&quot; however, is based on consistent behavior, predictability, and respect rather than affection, as would be seen with domestic animals.\n\n4. **Understanding of Behavior**: My background in zoology and specifically in large cat psychology allows me to interpret the&#39;, role=&#39;assistant&#39;, function_call=None, tool_calls=None))], created=1699589661, model=&#39;gpt-4-1106-preview&#39;, object=&#39;chat.completion&#39;, system_fingerprint=&#39;fp_a24b4d720c&#39;, usage=CompletionUsage(completion_tokens=256, prompt_tokens=53, total_tokens=309))
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>ChatCompletion(id=&#39;chatcmpl-8JLwvtR5pxyRZw7PiatEGYU7SpGft&#39;, choices=[Choice(finish_reason=&#39;length&#39;, index=0, message=ChatCompletionMessage(content=&quot;As a lion tamer with extensive knowledge in zoology and large cat psychology, being in the same room as a lion is a profound mix of exhilaration, respect, and careful calculation. My academic background and practical experience help me understand lion behavior, which is crucial for safe interactions. Here&#39;s an overview of the experience:\n\n1. **Respect for Power**: Lions are among the most powerful predators on the planet. The sheer size and muscle mass of a lion are awe-inspiring. A fully-grown adult male can weigh upwards of 400 pounds (180 kilograms). Being in close proximity to such a formidable animal naturally commands respect for their strength and potential.\n\n2. **Understanding Body Language**: Years of study and interaction with lions allow me to decipher their body language and vocalizations. I must remain vigilant, always observing for signs of discomfort, aggression, or playfulness in the animal. These can include ear positions, tail movements, facial expressions, and sounds.\n\n3. **Emotional Connection**: Despite the danger, a deep bond often forms between a lion and its trainer. This relationship is built on mutual trust and understanding. However, one must never become complacent; a lion is not a domesticated pet and can be unpredictable.\n\n4. **Adrenaline and&quot;, role=&#39;assistant&#39;, function_call=None, tool_calls=None))], created=1699623297, model=&#39;gpt-4-1106-preview&#39;, object=&#39;chat.completion&#39;, system_fingerprint=&#39;fp_a24b4d720c&#39;, usage=CompletionUsage(completion_tokens=256, prompt_tokens=53, total_tokens=309))
</pre></div>
</div>
</div>
Expand All @@ -541,17 +541,15 @@ <h2>Code Example<a class="headerlink" href="#code-example" title="Permalink to t
</div>
</details>
</div>
<p><span class="pasted-text">As a lion tamer with extensive knowledge in zoology and large cat psychology, being in the same room as a lion is a profound mix of exhilaration, respect, and careful calculation. Each interaction with a lion, regardless of my expertise, requires a high degree of awareness and understanding of lion behavior.
<p><span class="pasted-text">As a lion tamer with extensive knowledge in zoology and large cat psychology, being in the same room as a lion is a profound mix of exhilaration, respect, and careful calculation. My academic background and practical experience help me understand lion behavior, which is crucial for safe interactions. Here’s an overview of the experience:

Here are a few aspects of the experience:
1. **Respect for Power**: Lions are among the most powerful predators on the planet. The sheer size and muscle mass of a lion are awe-inspiring. A fully-grown adult male can weigh upwards of 400 pounds (180 kilograms). Being in close proximity to such a formidable animal naturally commands respect for their strength and potential.

1. **Respect for Power**: Being in close proximity to such a formidable predator is an immediate reminder of their strength, agility, and potential for danger. Lions are apex predators with powerful jaws, large teeth, and muscular bodies capable of swift and deadly action.
2. **Understanding Body Language**: Years of study and interaction with lions allow me to decipher their body language and vocalizations. I must remain vigilant, always observing for signs of discomfort, aggression, or playfulness in the animal. These can include ear positions, tail movements, facial expressions, and sounds.

2. **Heightened Senses**: My senses are heightened, and I remain attuned to every movement, sound, and even the subtleties of the lion’s body language. This intense focus helps to anticipate the lion’s actions and respond appropriately.
3. **Emotional Connection**: Despite the danger, a deep bond often forms between a lion and its trainer. This relationship is built on mutual trust and understanding. However, one must never become complacent; a lion is not a domesticated pet and can be unpredictable.

3. **Bond and Trust**: Over time, building a relationship with individual lions leads to a mutual understanding and a bond that can sometimes resemble trust. This “trust,” however, is based on consistent behavior, predictability, and respect rather than affection, as would be seen with domestic animals.

4. **Understanding of Behavior**: My background in zoology and specifically in large cat psychology allows me to interpret the</span></p>
4. **Adrenaline and</span></p>
</section>
<section id="documentation">
<h2>Documentation<a class="headerlink" href="#documentation" title="Permalink to this heading">#</a></h2>
Expand Down

0 comments on commit b9b6758

Please sign in to comment.