From 50b3d14adbd966c4107bf3698cbf216d3ae1d9f2 Mon Sep 17 00:00:00 2001 From: Derek Worthen Date: Fri, 14 Aug 2026 07:15:10 -0700 Subject: [PATCH 1/2] Fix local search notebook. Resolves #2387 --- docs/examples_notebooks/local_search.ipynb | 38 ++++++++++++---------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/docs/examples_notebooks/local_search.ipynb b/docs/examples_notebooks/local_search.ipynb index bba7a7b38c..dd7beb9975 100644 --- a/docs/examples_notebooks/local_search.ipynb +++ b/docs/examples_notebooks/local_search.ipynb @@ -32,7 +32,7 @@ " LocalSearchMixedContext,\n", ")\n", "from graphrag.query.structured_search.local_search.search import LocalSearch\n", - "from graphrag_vectors import IndexSchema, LanceDBVectorStore" + "from graphrag_vectors import IndexSchema, create_vector_store, VectorStoreConfig, VectorStoreType" ] }, { @@ -41,7 +41,7 @@ "source": [ "## Local Search Example\n", "\n", - "Local search method generates answers by combining relevant data from the AI-extracted knowledge-graph with text chunks of the raw documents. This method is suitable for questions that require an understanding of specific entities mentioned in the documents (e.g. What are the healing properties of chamomile?)." + "Local search method generates answers by combining relevant data from the AI-extracted knowledge-graph with text chunks of the raw documents. This method is suitable for questions that require an understanding of specific entities mentioned in the documents (e.g. What are the healing properties of chamomile?).\n" ] }, { @@ -50,14 +50,14 @@ "source": [ "### Load text units and graph data tables as context for local search\n", "\n", - "- In this test we first load indexing outputs from parquet files to dataframes, then convert these dataframes into collections of data objects aligning with the knowledge model." + "- In this test we first load indexing outputs from parquet files to dataframes, then convert these dataframes into collections of data objects aligning with the knowledge model.\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "### Load tables to dataframes" + "### Load tables to dataframes\n" ] }, { @@ -82,7 +82,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "#### Read entities" + "#### Read entities\n" ] }, { @@ -99,10 +99,14 @@ "\n", "# load description embeddings to an in-memory lancedb vectorstore\n", "# to connect to a remote db, specify url and port values.\n", - "description_embedding_store = LanceDBVectorStore(\n", + "description_embedding_store = create_vector_store(\n", + " config=VectorStoreConfig(\n", + " type=VectorStoreType.LanceDB,\n", + " uri=LANCEDB_URI\n", + " ),\n", " index_schema=IndexSchema(index_name=\"default-entity-description\")\n", ")\n", - "description_embedding_store.connect(db_uri=LANCEDB_URI)\n", + "description_embedding_store.connect()\n", "\n", "print(f\"Entity count: {len(entity_df)}\")\n", "entity_df.head()" @@ -112,7 +116,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "#### Read relationships" + "#### Read relationships\n" ] }, { @@ -148,7 +152,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "#### Read community reports" + "#### Read community reports\n" ] }, { @@ -168,7 +172,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "#### Read text units" + "#### Read text units\n" ] }, { @@ -221,7 +225,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Create local search context builder" + "### Create local search context builder\n" ] }, { @@ -248,7 +252,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Create local search engine" + "### Create local search engine\n" ] }, { @@ -314,7 +318,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Run local search on sample queries" + "### Run local search on sample queries\n" ] }, { @@ -342,7 +346,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "#### Inspecting the context data used to generate the response" + "#### Inspecting the context data used to generate the response\n" ] }, { @@ -396,14 +400,14 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Question Generation" + "### Question Generation\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "This function takes a list of user queries and generates the next candidate questions." + "This function takes a list of user queries and generates the next candidate questions.\n" ] }, { @@ -440,7 +444,7 @@ ], "metadata": { "kernelspec": { - "display_name": "graphrag", + "display_name": "graphrag-monorepo (3.12.10)", "language": "python", "name": "python3" }, From c2080e5ed8e6ec6747678567090078a1883e2ba5 Mon Sep 17 00:00:00 2001 From: Derek Worthen Date: Fri, 14 Aug 2026 07:17:43 -0700 Subject: [PATCH 2/2] Fix formatting. --- docs/examples_notebooks/local_search.ipynb | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/docs/examples_notebooks/local_search.ipynb b/docs/examples_notebooks/local_search.ipynb index dd7beb9975..e14195ee1e 100644 --- a/docs/examples_notebooks/local_search.ipynb +++ b/docs/examples_notebooks/local_search.ipynb @@ -32,7 +32,12 @@ " LocalSearchMixedContext,\n", ")\n", "from graphrag.query.structured_search.local_search.search import LocalSearch\n", - "from graphrag_vectors import IndexSchema, create_vector_store, VectorStoreConfig, VectorStoreType" + "from graphrag_vectors import (\n", + " IndexSchema,\n", + " VectorStoreConfig,\n", + " VectorStoreType,\n", + " create_vector_store,\n", + ")" ] }, { @@ -100,11 +105,8 @@ "# load description embeddings to an in-memory lancedb vectorstore\n", "# to connect to a remote db, specify url and port values.\n", "description_embedding_store = create_vector_store(\n", - " config=VectorStoreConfig(\n", - " type=VectorStoreType.LanceDB,\n", - " uri=LANCEDB_URI\n", - " ),\n", - " index_schema=IndexSchema(index_name=\"default-entity-description\")\n", + " config=VectorStoreConfig(type=VectorStoreType.LanceDB, uri=LANCEDB_URI),\n", + " index_schema=IndexSchema(index_name=\"default-entity-description\"),\n", ")\n", "description_embedding_store.connect()\n", "\n",