mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 17:35:10 +03:00
fix: llamaindex colab data fetching
This commit is contained in:
1 parent
ca83ef085c
commit
20ea63ffcd
2 files changed
+14
-18
No files matched your search
@@ -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).
|
||||
|
||||
<DatabaseSetup />
|
||||
|
||||
## 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:
|
||||
|
||||
<a
|
||||
className="w-64"
|
||||
href="https://github.com/supabase/supabase/blob/master/examples/ai/integrations/llamaindex/llamaindex.ipynb"
|
||||
href="https://colab.research.google.com/github/supabase/supabase/blob/master/examples/ai/llamaindex/llamaindex.ipynb"
|
||||
>
|
||||
<img src="/docs/img/ai/colab-badge.svg" />
|
||||
</a>
|
||||
|
||||
@@ -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)"
|
||||
]
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user