Skip to content

Send a phone call from AI agent, in an API call. Or, directly call the bot from the configured phone number!

Python

doc: Avoid empty chunck during import

Clémence Lesnébad118e6dd26
diff --git a/examples/import-training.ipynb b/examples/import-training.ipynb
index c47b745..5817ed3 100644
--- a/examples/import-training.ipynb
+++ b/examples/import-training.ipynb
@@ -266,6 +266,8 @@
" for h4_section in h3_section.split(\"\\n###\"):\n",
" h4_title = h4_section.split(\"\\n\")[0].strip()\n",
" h4_content = compress(\" \".join(h4_section.split(\"\\n\")[1:]))\n",
+ " if not h4_content:\n",
+ " continue\n",
" content = dedent(f\"\"\"\n",
" # {h1_title}\n",
" ## {h2_title}\n",
@@ -278,6 +280,8 @@
"\n",
" else: # No H4\n",
" h3_content = compress(\" \".join(h3_section.split(\"\\n\")[1:]))\n",
+ " if not h3_content:\n",
+ " continue\n",
" content = dedent(f\"\"\"\n",
" # {h1_title}\n",
" ## {h2_title}\n",
@@ -289,6 +293,8 @@
"\n",
" else: # No H3\n",
" h2_content = compress(\" \".join(h2_section.split(\"\\n\")[1:]))\n",
+ " if not h2_content:\n",
+ " continue\n",
" content = dedent(f\"\"\"\n",
" # {h1_title}\n",
" ## {h2_title}\n",
@@ -299,6 +305,8 @@
"\n",
" else: # No H2\n",
" h1_content = compress(\" \".join(h1_section.split(\"\\n\")[1:]))\n",
+ " if not h1_content:\n",
+ " continue\n",
" content = dedent(f\"\"\"\n",
" # {h1_title}\n",
" {h1_content}\n",