From dadb6f1445a77566a8ab731bbd1d9c363b37337e Mon Sep 17 00:00:00 2001 From: Eugene Yurtsev Date: Fri, 9 Aug 2024 14:28:57 -0400 Subject: [PATCH] cli[patch]: Update integration template for embedding models (#25248) Update integration template for embedding models --- .../docs/text_embedding.ipynb | 42 ++++--------------- 1 file changed, 7 insertions(+), 35 deletions(-) diff --git a/libs/cli/langchain_cli/integration_template/docs/text_embedding.ipynb b/libs/cli/langchain_cli/integration_template/docs/text_embedding.ipynb index 893e2336dc..7e9cabaeef 100644 --- a/libs/cli/langchain_cli/integration_template/docs/text_embedding.ipynb +++ b/libs/cli/langchain_cli/integration_template/docs/text_embedding.ipynb @@ -24,13 +24,9 @@ "## Overview\n", "### Integration details\n", "\n", - "- TODO: Fill in table features.\n", - "- TODO: Remove JS support link if not relevant, otherwise ensure link is correct.\n", - "- TODO: Make sure API reference links are correct.\n", + "import { ItemTable } from \"@theme/FeatureTables\";\n", "\n", - "| Class | Package | Local | Serializable | [JS support](https://js.langchain.com/v0.2/docs/integrations/text_embedding/__package_name_short_snake__) | Package downloads | Package latest |\n", - "| :--- | :--- | :---: | :---: | :---: | :---: | :---: |\n", - "| [__ModuleName__Embeddings](https://api.python.langchain.com/en/latest/embeddings/__module_name__.embeddings.__ModuleName__Embeddings.html) | [__package_name__](https://api.python.langchain.com/en/latest/__package_name_short_snake___api_reference.html) | ✅/❌ | beta/❌ | ✅/❌ | ![PyPI - Downloads](https://img.shields.io/pypi/dm/__package_name__?style=flat-square&label=%20) | ![PyPI - Version](https://img.shields.io/pypi/v/__package_name__?style=flat-square&label=%20) |\n", + "\n", "\n", "## Setup\n", "\n", @@ -157,10 +153,10 @@ "retriever = vectorstore.as_retriever()\n", "\n", "# Retrieve the most similar text\n", - "retrieved_document = retriever.invoke(\"What is LangChain?\")\n", + "retrieved_documents = retriever.invoke(\"What is LangChain?\")\n", "\n", "# show the retrieved document's content\n", - "retrieved_document.page_content" + "retrieved_documents[0].page_content" ] }, { @@ -210,7 +206,7 @@ "text2 = (\n", " \"LangGraph is a library for building stateful, multi-actor applications with LLMs\"\n", ")\n", - "two_vectors = embeddings.embed_queries([text, text2])\n", + "two_vectors = embeddings.embed_documents([text, text2])\n", "for vector in two_vectors:\n", " print(str(vector)[:100]) # Show the first 100 characters of the vector" ] @@ -220,34 +216,10 @@ "id": "98785c12", "metadata": {}, "source": [ - "### Async Usage\n", + "## API Reference\n", "\n", - "You can also use `aembed_query` and `aembed_documents` for producing embeddings asynchronously:\n" + "For detailed documentation on `__ModuleName__Embeddings` features and configuration options, please refer to the [API reference](https://api.python.langchain.com/en/latest/embeddings/__module_name__.embeddings.__ModuleName__Embeddings.html).\n" ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "4c3bef91", - "metadata": {}, - "outputs": [], - "source": [ - "import asyncio\n", - "\n", - "async def async_example():\n", - " single_vector = await embeddings.embed_query(text)\n", - " print(str(single_vector)[:100]) # Show the first 100 characters of the vector\n", - "\n", - "asyncio.run(async_example())" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "f1bd4396", - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": {