diff --git a/docs/modules/utils/combine_docs_examples/vectorstores.ipynb b/docs/modules/utils/combine_docs_examples/vectorstores.ipynb index a10891ac..c8960c4b 100644 --- a/docs/modules/utils/combine_docs_examples/vectorstores.ipynb +++ b/docs/modules/utils/combine_docs_examples/vectorstores.ipynb @@ -68,7 +68,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 4, "id": "67baf32e", "metadata": { "pycharm": { @@ -98,6 +98,68 @@ "print(docs[0].page_content)" ] }, + { + "cell_type": "markdown", + "id": "fb6baaf8", + "metadata": {}, + "source": [ + "## Add texts\n", + "You can easily add text to a vectorstore with the `add_texts` method. It will return a list of document IDs (in case you need to use them downstream)." + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "70758e4f", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['64108bd0-4d91-485c-9743-1e18debdd59e']" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "docsearch.add_texts([\"Ankush went to Princeton\"])" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "4edeb88f", + "metadata": {}, + "outputs": [], + "source": [ + "query = \"Where did Ankush go to college?\"\n", + "docs = docsearch.similarity_search(query)" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "1cba64a2", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Document(page_content='Ankush went to Princeton', lookup_str='', metadata={}, lookup_index=0)" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "docs[0]" + ] + }, { "cell_type": "markdown", "id": "bbf5ec44", @@ -646,7 +708,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.9" + "version": "3.9.1" } }, "nbformat": 4,