diff --git a/apps/docs/pages/guides/ai/integrations/llamaindex.mdx b/apps/docs/pages/guides/ai/integrations/llamaindex.mdx index ceaa6619960..59db32b9cd3 100644 --- a/apps/docs/pages/guides/ai/integrations/llamaindex.mdx +++ b/apps/docs/pages/guides/ai/integrations/llamaindex.mdx @@ -9,17 +9,17 @@ export const meta = { breadcrumb: 'AI Integrations', } -This guide will walk you through a basic example using the LlamaIndex [SupabaseVectorStore](https://github.com/supabase/supabase/blob/master/examples/ai/integrations/llamaindex/llamaindex.ipynb). +This guide will walk you through a basic example using the LlamaIndex [SupabaseVectorStore](https://github.com/supabase/supabase/blob/master/examples/ai/llamaindex/llamaindex.ipynb). ## Launching a notebook -Launch our [LlamaIndex](https://github.com/supabase/supabase/blob/master/examples/ai/integrations/llamaindex/llamaindex.ipynb) notebook in Colab: +Launch our [LlamaIndex](https://github.com/supabase/supabase/blob/master/examples/ai/llamaindex/llamaindex.ipynb) notebook in Colab: diff --git a/examples/ai/llamaindex/llamaindex.ipynb b/examples/ai/llamaindex/llamaindex.ipynb index a9e11c42606..4bcfa36b7bf 100644 --- a/examples/ai/llamaindex/llamaindex.ipynb +++ b/examples/ai/llamaindex/llamaindex.ipynb @@ -36,12 +36,12 @@ "metadata": {}, "outputs": [], "source": [ - "!pip install -qU vecs datasets llama_index" + "!pip install -qU vecs datasets llama_index html2text" ] }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "0026437c", "metadata": {}, "outputs": [], @@ -53,10 +53,11 @@ "# logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)\n", "# logging.getLogger().addHandler(logging.StreamHandler(stream=sys.stdout))\n", "\n", - "from llama_index import SimpleDirectoryReader, Document, StorageContext\n", + "from llama_index import SimpleWebPageReader, StorageContext\n", "from llama_index.indices.vector_store import VectorStoreIndex\n", "from llama_index.vector_stores import SupabaseVectorStore\n", - "import textwrap" + "import textwrap\n", + "import html2text" ] }, { @@ -94,20 +95,15 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "dc6b0bc2-b95f-4190-bf77-fa2dc57fc247", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Document ID: e2b246de-b306-4615-851c-fe891a862a5f Document Hash: 77ae91ab542f3abb308c4d7c77c9bc4c9ad0ccd63144802b7cbe7e1bb3a4094e\n" - ] - } - ], + "outputs": [], "source": [ - "documents = SimpleDirectoryReader('./data').load_data()\n", + "essays = [\n", + " 'paul_graham_essay.txt'\n", + "]\n", + "documents = SimpleWebPageReader().load_data([f'https://raw.githubusercontent.com/supabase/supabase/master/examples/ai/llamaindex/data/{essay}' for essay in essays])\n", "print('Document ID:', documents[0].doc_id, 'Document Hash:', documents[0].doc_hash)" ] },