diff --git a/notebooks/document-chunking/with-langchain-splitters.ipynb b/notebooks/document-chunking/with-langchain-splitters.ipynb index aff75de6..003f6122 100644 --- a/notebooks/document-chunking/with-langchain-splitters.ipynb +++ b/notebooks/document-chunking/with-langchain-splitters.ipynb @@ -265,7 +265,6 @@ "\n", "\n", "def parent_child_splitter(documents, chunk_size: int = 200):\n", - "\n", " child_splitter = RecursiveCharacterTextSplitter(chunk_size=chunk_size)\n", "\n", " docs = []\n", @@ -550,22 +549,20 @@ "source": [ "from langchain_elasticsearch import (\n", " ElasticsearchStore,\n", - " ApproxRetrievalStrategy,\n", + " DenseVectorStrategy,\n", ")\n", "from typing import List, Union\n", "from langchain_core.documents import Document\n", "\n", "\n", - "class CustomRetrievalStrategy(ApproxRetrievalStrategy):\n", - "\n", - " def query(\n", + "class CustomRetrievalStrategy(DenseVectorStrategy):\n", + " def es_query(\n", " self,\n", " query: Union[str, None],\n", " filter: List[dict],\n", " **kwargs,\n", " ):\n", - "\n", - " es_query = {\n", + " return {\n", " \"knn\": {\n", " \"inner_hits\": {\"_source\": False, \"fields\": [\"passages.text\"]},\n", " \"field\": \"passages.vector.predicted_value\",\n", @@ -581,8 +578,6 @@ " }\n", " }\n", "\n", - " return es_query\n", - "\n", "\n", "vector_store = ElasticsearchStore(\n", " index_name=INDEX_NAME,\n",