|
@@ -14,7 +14,7 @@
|
|
|
"In this notebook, we demonstrate how to use Llama3 with LlamaIndex for a comprehensive set of use cases. \n",
|
|
|
"1. Basic completion / chat \n",
|
|
|
"2. Basic RAG (Vector Search, Summarization)\n",
|
|
|
- "3. Advanced RAG (Routing, Sub-Questions)\n",
|
|
|
+ "3. Advanced RAG (Routing)\n",
|
|
|
"4. Text-to-SQL \n",
|
|
|
"5. Structured Data Extraction\n",
|
|
|
"6. Agents\n",
|
|
@@ -444,7 +444,7 @@
|
|
|
"id": "68918eb6-f1e6-460c-b1d5-fb49c3fed4b8",
|
|
|
"metadata": {},
|
|
|
"source": [
|
|
|
- "## 3. Advanced RAG (Routing, Sub-Questions)"
|
|
|
+ "## 3. Advanced RAG (Routing)"
|
|
|
]
|
|
|
},
|
|
|
{
|
|
@@ -528,76 +528,6 @@
|
|
|
},
|
|
|
{
|
|
|
"cell_type": "markdown",
|
|
|
- "id": "2af04881-6a64-475c-8c1e-e5bd3e8006ee",
|
|
|
- "metadata": {},
|
|
|
- "source": [
|
|
|
- "### Break Complex Questions down into Sub-Questions\n",
|
|
|
- "\n",
|
|
|
- "Our Sub-Question Query Engine breaks complex questions down into sub-questions.\n"
|
|
|
- ]
|
|
|
- },
|
|
|
- {
|
|
|
- "cell_type": "code",
|
|
|
- "execution_count": null,
|
|
|
- "id": "2f9430df-ece7-493c-be6b-d5b371c7b8b0",
|
|
|
- "metadata": {},
|
|
|
- "outputs": [],
|
|
|
- "source": [
|
|
|
- "drake_index = VectorStoreIndex.from_documents(docs_drake)\n",
|
|
|
- "drake_query_engine = drake_index.as_query_engine(similarity_top_k=3)\n",
|
|
|
- "\n",
|
|
|
- "kendrick_index = VectorStoreIndex.from_documents(docs_kendrick)\n",
|
|
|
- "kendrick_query_engine = kendrick_index.as_query_engine(similarity_top_k=3)"
|
|
|
- ]
|
|
|
- },
|
|
|
- {
|
|
|
- "cell_type": "code",
|
|
|
- "execution_count": null,
|
|
|
- "id": "f16fa210-7e15-474a-9bd2-1ac681290006",
|
|
|
- "metadata": {},
|
|
|
- "outputs": [],
|
|
|
- "source": [
|
|
|
- "from llama_index.core.tools import QueryEngineTool, ToolMetadata\n",
|
|
|
- "\n",
|
|
|
- "drake_tool = QueryEngineTool(\n",
|
|
|
- " drake_index.as_query_engine(),\n",
|
|
|
- " metadata=ToolMetadata(\n",
|
|
|
- " name=\"drake_search\",\n",
|
|
|
- " description=\"Useful for searching over Drake's life.\",\n",
|
|
|
- " ),\n",
|
|
|
- ")\n",
|
|
|
- "\n",
|
|
|
- "kendrick_tool = QueryEngineTool(\n",
|
|
|
- " kendrick_index.as_query_engine(),\n",
|
|
|
- " metadata=ToolMetadata(\n",
|
|
|
- " name=\"kendrick_summary\",\n",
|
|
|
- " description=\"Useful for searching over Kendrick's life.\",\n",
|
|
|
- " ),\n",
|
|
|
- ")"
|
|
|
- ]
|
|
|
- },
|
|
|
- {
|
|
|
- "cell_type": "code",
|
|
|
- "execution_count": null,
|
|
|
- "id": "21e05b95-95cb-45f3-8fbe-d0b54a9ba988",
|
|
|
- "metadata": {},
|
|
|
- "outputs": [],
|
|
|
- "source": [
|
|
|
- "# from llama_index.core.query_engine import SubQuestionQueryEngine\n",
|
|
|
- "\n",
|
|
|
- "# query_engine = SubQuestionQueryEngine.from_defaults(\n",
|
|
|
- "# [drake_tool, kendrick_tool],\n",
|
|
|
- "# llm=llm_70b, # llama3-70b\n",
|
|
|
- "# verbose=True,\n",
|
|
|
- "# )\n",
|
|
|
- "\n",
|
|
|
- "# response = query_engine.query(\"Which albums did Drake release in his career?\")\n",
|
|
|
- "\n",
|
|
|
- "# print(response)"
|
|
|
- ]
|
|
|
- },
|
|
|
- {
|
|
|
- "cell_type": "markdown",
|
|
|
"id": "a795f0bc-e871-4580-8983-6fb27d421fc5",
|
|
|
"metadata": {},
|
|
|
"source": [
|