diff --git a/docs/modules/utils/combine_docs_examples/embeddings.ipynb b/docs/modules/utils/combine_docs_examples/embeddings.ipynb index cc25591198..686afe6d2a 100644 --- a/docs/modules/utils/combine_docs_examples/embeddings.ipynb +++ b/docs/modules/utils/combine_docs_examples/embeddings.ipynb @@ -77,36 +77,130 @@ ] }, { + "attachments": {}, "cell_type": "markdown", "id": "42f76e43", "metadata": {}, "source": [ "## Cohere\n", "\n", - "TODO: add documentation for Cohere embeddings." + "Let's load the Cohere Embedding class." ] }, { + "cell_type": "code", + "execution_count": 1, + "id": "6b82f59f", + "metadata": {}, + "outputs": [], + "source": [ + "from langchain.embeddings import CohereEmbeddings" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "26895c60", + "metadata": {}, + "outputs": [], + "source": [ + "embeddings = CohereEmbeddings(cohere_api_key= cohere_api_key)" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "eea52814", + "metadata": {}, + "outputs": [], + "source": [ + "text = \"This is a test document.\"" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "fbe167bf", + "metadata": {}, + "outputs": [], + "source": [ + "query_result = embeddings.embed_query(text)" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "38ad3b20", + "metadata": {}, + "outputs": [], + "source": [ + "doc_result = embeddings.embed_documents([text])" + ] + }, + { + "attachments": {}, "cell_type": "markdown", "id": "ed47bb62", "metadata": {}, "source": [ "## Hugging Face Hub\n", - "TODO: add documentation for Hugging Face Hub embeddings." + "Let's load the Hugging Face Embedding class." ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 7, + "id": "861521a9", + "metadata": {}, + "outputs": [], + "source": [ + "from langchain.embeddings import HuggingFaceEmbeddings" + ] + }, + { + "cell_type": "code", + "execution_count": 16, "id": "ff9be586", "metadata": {}, "outputs": [], - "source": [] + "source": [ + "embeddings = HuggingFaceEmbeddings()" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "id": "d0a98ae9", + "metadata": {}, + "outputs": [], + "source": [ + "text = \"This is a test document.\"" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "id": "5d6c682b", + "metadata": {}, + "outputs": [], + "source": [ + "query_result = embeddings.embed_query(text)" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "id": "bb5e74c0", + "metadata": {}, + "outputs": [], + "source": [ + "doc_result = embeddings.embed_documents([text])" + ] } ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "cohere", "language": "python", "name": "python3" }, @@ -120,7 +214,12 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.9" + "version": "3.10.8" + }, + "vscode": { + "interpreter": { + "hash": "ce6f9b0d7cdac41515b0e0c38d0e6e153a2edce81d579281cb1ab99da6e8ea6d" + } } }, "nbformat": 4,