{ "cells": [ { "cell_type": "markdown", "metadata": { "id": "R2-i8jBl9GRH" }, "source": [ "![Redis](https://redis.io/wp-content/uploads/2024/04/Logotype.svg?auto=webp&quality=85,75&width=120)\n", "# RAG with LangChain\n", "\n", "This notebook uses [LangChain](https://python.langchain.com/docs/get_started/introduction) and [Redis](https://redis.com) to perform document + embdding indexing and semantic search tasks. It also shows how to integrate with an LLM like OpenAI's GPT models. See the full partner package source code [here](https://github.com/langchain-ai/langchain-redis/tree/main).\n", "\n", "## Let's Begin!\n", "\"Open" ] }, { "cell_type": "markdown", "metadata": { "id": "ctOVb_LZ1vmk" }, "source": [ "## Environment Setup\n", "\n", "### Pull Github Materials\n", "Because you are likely running this notebook in **Google Colab**, we need to first\n", "pull the necessary dataset and materials directly from GitHub. The following commands grab the material, move to root for colab, and clean up unneeded files.\n", "\n", "**If you are running this notebook locally**, FYI you may not need to perform this\n", "step at all." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "UQezgPCG1vml", "outputId": "97b9bc03-da1b-439a-c37b-be6fdb58ab21" }, "outputs": [], "source": [ "# NBVAL_SKIP\n", "!git clone https://github.com/redis-developer/redis-ai-resources.git temp_repo\n", "!mv temp_repo/python-recipes/RAG/resources .\n", "!rm -rf temp_repo" ] }, { "cell_type": "markdown", "metadata": { "id": "9eieJowO1vmo" }, "source": [ "### Install Python Dependencies" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "⚠️ **Python version requirement**\n", "\n", "This notebook is compatible with versions **older** than Python 3.13. (Python < 3.13)\n", "It may not work correctly on Python 3.13 or newer." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "3.12.5 (main, Mar 30 2026, 18:14:37) [Clang 17.0.0 (clang-1700.6.4.2)]\n" ] } ], "source": [ "import sys\n", "\n", "print(sys.version)\n", "\n", "if sys.version_info >= (3, 13):\n", " raise RuntimeError(\n", " f\"This notebook requires Python < 3.13. \"\n", " f\"You are using {sys.version.split()[0]}.\"\n", " )" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "B3v1wUzX1vmq", "outputId": "84a3feff-e7c1-41ba-9ab1-8c975074552e" }, "outputs": [], "source": [ "%pip install -q redis \"unstructured[pdf]\" sentence-transformers langchain \n", "%pip install -q langchain-community \"langchain-redis>=0.2.0\" langchain-huggingface langchain-openai langchain-unstructured langchain-text-splitters" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Install Redis Stack\n", "\n", "Later in this tutorial, Redis will be used to store, index, and query vector\n", "embeddings created from PDF document chunks. **We need to make sure we have a Redis\n", "instance available.**" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### For Colab\n", "Use the shell script below to download, extract, and install [Redis Stack](https://redis.io/docs/getting-started/install-stack/) directly from the Redis package archive." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "scrolled": true }, "outputs": [], "source": [ "# NBVAL_SKIP\n", "%%sh\n", "curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg\n", "echo \"deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main\" | sudo tee /etc/apt/sources.list.d/redis.list\n", "sudo apt-get update > /dev/null 2>&1\n", "sudo apt-get install redis-stack-server > /dev/null 2>&1\n", "redis-stack-server --daemonize yes" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### For Alternative Environments\n", "There are many ways to get the necessary redis-stack instance running\n", "1. On cloud, deploy a [FREE instance of Redis in the cloud](https://redis.com/try-free/). Or, if you have your\n", "own version of Redis Enterprise running, that works too!\n", "2. Per OS, [see the docs](https://redis.io/docs/latest/operate/oss_and_stack/install/install-stack/)\n", "3. With docker: `docker run -d --name redis-stack-server -p 6379:6379 redis/redis-stack-server:latest`" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Define the Redis Connection URL\n", "\n", "By default this notebook connects to the local instance of Redis Stack. **If you have your own Redis Enterprise instance** - replace REDIS_PASSWORD, REDIS_HOST and REDIS_PORT values with your own." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "import os\n", "import warnings\n", "warnings.filterwarnings('ignore')\n", "\n", "# Replace values below with your own if using Redis Cloud instance\n", "REDIS_HOST = os.getenv(\"REDIS_HOST\", \"localhost\") # ex: \"redis-18374.c253.us-central1-1.gce.cloud.redislabs.com\"\n", "REDIS_PORT = os.getenv(\"REDIS_PORT\", \"6379\") # ex: 18374\n", "REDIS_PASSWORD = os.getenv(\"REDIS_PASSWORD\", \"\") # ex: \"1TNxTEdYRDgIDKM2gDfasupCADXXXX\"\n", "\n", "# If SSL is enabled on the endpoint, use rediss:// as the URL prefix\n", "REDIS_URL = f\"redis://:{REDIS_PASSWORD}@{REDIS_HOST}:{REDIS_PORT}\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## RAG with LangChain" ] }, { "cell_type": "markdown", "metadata": { "id": "7MaVqU8Y1vms" }, "source": [ "### Dataset Preparation (PDF Documents)\n", "\n", "To best demonstrate Redis as a vector database layer, we will load a single\n", "financial (10k filings) doc and preprocess it using some helpers from LangChain:\n", "\n", "- `UnstructuredLoader` is not the only document loader type that LangChain provides. Docs: https://docs.langchain.com/oss/python/integrations/document_loaders/unstructured_file\n", "- `RecursiveCharacterTextSplitter` is what we use to create smaller chunks of text from the doc. Docs: https://docs.langchain.com/oss/python/integrations/splitters/recursive_text_splitter" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "I7VS1bPr1vmt", "outputId": "72299230-26c4-4d80-d61f-138616e2173b" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Listing available documents ... ['resources/nke-10k-2023.pdf', 'resources/amzn-10k-2023.pdf', 'resources/jnj-10k-2023.pdf', 'resources/aapl-10k-2023.pdf', 'resources/testset_15.csv', 'resources/retrieval_basic_rag_test.csv', 'resources/2022-chevy-colorado-ebrochure.pdf', 'resources/nvd-10k-2023.pdf', 'resources/testset.csv', 'resources/msft-10k-2023.pdf', 'resources/propositions.json', 'resources/generation_basic_rag_test.csv']\n" ] } ], "source": [ "from langchain_text_splitters import RecursiveCharacterTextSplitter\n", "from langchain_unstructured import UnstructuredLoader\n", "\n", "# Load list of pdfs from a folder\n", "data_path = \"resources/\"\n", "docs = [os.path.join(data_path, file) for file in os.listdir(data_path)]\n", "\n", "print(\"Listing available documents ...\", docs)" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "WARNING:unstructured:No languages specified, defaulting to English.\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Done preprocessing. Created 180 chunks of the original pdf resources/nke-10k-2023.pdf\n" ] } ], "source": [ "# pick out the Nike doc for this exercise\n", "doc = [doc for doc in docs if \"nke\" in doc][0]\n", "\n", "# set up the file loader/extractor and text splitter to create chunks\n", "text_splitter = RecursiveCharacterTextSplitter(\n", " chunk_size=2500, chunk_overlap=0\n", ")\n", "loader = UnstructuredLoader(\n", " doc, \n", " chunking_strategy=\"basic\", \n", " max_characters=1000000,\n", " include_orig_elements=False,\n", " strategy=\"fast\"\n", ")\n", "\n", "# extract, load, and make chunks\n", "chunks = loader.load_and_split(text_splitter)\n", "\n", "print(\"Done preprocessing. Created\", len(chunks), \"chunks of the original pdf\", doc)" ] }, { "cell_type": "markdown", "metadata": { "id": "96BzcyW31vmw" }, "source": [ "### Initialize Embeddings Model\n", "Here we will use LangChain's built in embedding engine so that it will work seemlessly with the LangChain VectorStore classes." ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 465, "referenced_widgets": [ "e822a189950844309e630f3e428d5a9a", "d3e5c2097a8e44f481e91646e0410e62", "b1e8dcf4ead64c5b8155594fd1d20632", "bd042dad15084b098dfbf7c9277d3581", "54c512a0bb9f485a9612f088c717eec8", "e769ce42211749599822ffc3a18e7292", "0d6362898099436abb80e52eac043c4f", "e3afaca826464f94b6b904e68c827cab", "27ba4306f92c4d659cadcd5c1e0ab787", "15378b3263a449fabf00643fdd23565e", "aee906bc037849e2be3ac68955281892", "2e3997001c494151829379467dde2182", "0281867e8ce8433fb665e287505d0404", "d6ff7f1d2a6b44ff829212b67613e03b", "3402b3afe4304aec81a1e4389e2eafec", "fc32fd51efd2488e9bff38274079d7e5", "07a6bd4b6a484dbebda92c366f3a6740", "13fb05f6cbe24acba47be67e8b0a69a6", "3d30fc25d10e4ce18d50320a88b0a2ec", "ebe649c53e4d48fda0d4ea9a46ec5613", "843c2b0500ee4219841c959f3af20542", "d84881099d4f4f1fa8a481ea9f9dafdd", "04c8bb6bb7c8425b92e0f3fab63d8362", "4d54077e8c38411080b1ef9bfb42e3f8", "b8c9c7fb7b6e4dcfb717f96da1639553", "52961d70221846f78523df1414eb3436", "008e25d7de5e4e548d80be81e26bdb8f", "b0d11b0e853740b7b8e49e5158c940e5", "ac450c103bb44f549a7103f67634f9bf", "99204cde99b348ccb4f45589802f5a38", "2860317abc5b41fab94f8fefe9cb6b3b", "30ebda1e38294648b014354009c17269", "755e63baf4ad4a289fd756d662d9a0bf", "723ef31f042343bd94217075e1857989", "820afc900ef34cdc82f4e5d7c38fb67f", "f06938274c0d4b4591b6cfa2e7a8d183", "1ab52b039fdb4cab909eb439a4ea3524", "d1e27bbac128455e9a0e959ba251eedd", "ff4297f185ce4f2eaf340a422b721774", "168314c6ae1044d6810def7ff06f80c2", "dad25775795b46ec9e7bb788b1d25f82", "4e74d1276be141c9b0f2601ce4c7246a", "2dff47a7d6364e2ba73f057e9b17a705", "f4b4bc8eeef84da2abcf1691e174a080", "6dbbd3a5f81b46d99c9c897dba53d6a5", "b63b4da89d0f45819ad0aead03833f4c", "27725152494c4f0b85e48bf081113764", "8d8356cdf3b54b2daa02fe6d06c2b372", "e61f0ecfe4794a4d929b76b8a5434800", "b1e6fa50486c4973b44b20e29c4837a9", "5d3f0bfd81b34819a6edce0496958f5a", "266abb8c7e064dbea106c6c2903404c3", "59317d931ba14c409d7f9baae6b4b2fc", "da5242e187fd4d6c950e7a75cebb33fa", "a28d8e8eedf34026afe93d2105d7d779", "b4683c36fb744ac18ed8f98f1d352d16", "a68f0e29f8f745fab98bd16b4835956a", "d7791474a31b4ef7bffecdd264cbd0a5", "e49064443c9549ebb7a6d0710d2ad02e", "ee0db8230ae64f1b94e246e2947682a3", "cff28f0f731c48e88de8ccad15146e2f", "af1f8d072046449d9437cb10ccdb2218", "a1f692c86e6d4c668f31bcb4f4189f48", "a8b7b5ad3c954b94bda03987653ce1c8", "32a5f8335e3a4312aea8bb83505b4ed3", "0d4624d3273d46268299e37d96c0d85d", "7c1867628e4742868ba1e1fa322b948e", "35e9d31c8cfb41199df0e4636537a9c0", "f1fff6bb909d4fcbbe0a7582fe5a09d4", "0b3b28fae35d497886c72e4222470629", "bfd29912ee224c4e93ec37f545339586", "d335cf6ac50b46f5a50870069a14a066", "5b7765acd2024e04ba423edc346fe021", "96c778b21e154c77952c3b6456831f6a", "67730a22939d42db8894a633483fd412", "c3e15e863ece4df88d1ad4fa4601fb43", "ce7fbbb4b844429aa16d60c6524bb6ca", "0d1bc800782745a9b89e93bb992e0ce0", "369c5197fd23479c8aa79ac72cbea260", "5317c63c5168499eb992b4d764761dfc", "364519d35ab848199a6fb3e15906318a", "8b7e8c8ff5f3478aa064f5b79ffaaadf", "ccb27092ee314285add51fd91e5ca49d", "61f3b41fdcf04cff88dd08b36a4a5f41", "816a516fa90f43a18dfda92374c2f4ed", "7d8e2e3c678642afba660b450d5f3201", "872caf759d1f45439397ee35c8cf5dc0", "74b0c9b3b9944eab80f16b2789d6c041", "27b3516e55614d1e91ce4c87c022ee0a", "3991f774ac7f492993002be26cd67f18", "d6804472f88d4254925b7b006a97b2c8", "e0cae801b89e43598bab0ce7f38d7042", "09049b516bc545ea844a770021f6812a", "6a3ae2fa53c942edbb1b29a86717ad89", "3da15201c5da4e40b0b3ac999552723a", "bda924a0e1364f89a7f6c9c5ceb03b62", "7a83acfd4fb240c181f127fc7ee07d48", "d6ebd756685b4a589332a3598a25cd89", "f3d585528e6a4962bfb93afbe92b6312", "879c273bd3924ec0acaec655a92350e0", "744ba6e1b34e4883b49c138ab1bdbebc", "d449ea30c72044f986ffc3e1f9a128d8", "976d3f30f0654d48b096a5c39a8dece5", "41685bf8cb4344368edf161b66ae15b2", "7034b97b70c84a01a3d48e316814b555", "39a239df60004a039de689a69c571afc", "1b2f3f0c7afd419e88f061d0c3280989", "701d2879a67c4b86b9f9de76ff675e7c", "955d7c1b76b348549daceb8482a8e825", "2d0a785ceb884a1f9ee020d22c987fa1", "543e7442413d4035bb6949ccbab5cb6b", "5d47f3871bf44a469dcfd0e456d3dae0", "bbb1a53611e14dcb9b028fe82d71e317", "0d31b15287954c3094750dd36a10d47a", "9818040fcf844fd9b00cd0e438209d40", "7c269846386c4f14bfafde1d5c0e871e", "b11227ec73784e09871e0c25131b9f86", "4083110114e3443c920cbeb8c396d4da", "366cf22df75b42509e5610ff9c9b1d3d", "ff231927834c41088becbe8f94f96f7b", "6e3f1af22a534a7ebdb9752acb7f1b96", "7a6e695c3dcf417f9f53ceb019e37111", "5bf9cc6f60614542bf0628586b8560dd", "d08483b9393840cfb36dd504514043c4", "d36c28d414af4712b16a7f0543f61fc9", "00b534687273409fbc18960bb7db0907", "a27b96cc3ce944549ba2d26f5d7338c2", "75f27178134f477db58ef7cfc487897b", "e2816b9d2a21443c82b547466c3347d1", "0a9b8aa436604adc85c1f9a86a9889a6", "37e5517b0c7b45e0ad3366d4daf5b668", "58f9c1e1f51f49c48c6dc6b441078218", "a8114c2300b74599b0652601806b080e", "e211cf2a0e6d4d1096bfb9dfaae00cbb", "f63c59800b0845b8bc8d9c2cce8bafc0", "1f7ba17ad64c4ab68fe963eaf7a1efa7", "05d146ed0f084dac8845c32c4bb28cff", "d05d9073ecd2434da541da9d71c3a907", "52a56e10c8084ce999802b6db17ab78e", "84e4dc1690b642b7b00f5e1cedff91e8", "0ab7b921de994f6980493fb89d3b8572", "6ff193e5c339435cba696e69b4a1ea20", "7ebc91105d344011898341ce4f7edce0", "ae72de3e05a4461d9c2b0c1f953894b2", "69d7c03c926e441a9bccfbe86fd5731d", "9e0ba3c3e2a84f43ae708c89203c814a", "b2b8a580aa1944e6a00106f47070935c", "cf7adc55be354c75b64d9a94285ea8f9", "770d6b0784674359a669f3f1836a5876", "c60fc7a6181a40d489ff43af79ff29b4", "4ffcc071ec56449ba865c876bc5cff5c", "a9c792cb80884e0899da0f40d9472e97", "7ba192f9998e41b782db482b60655f86", "737a0eaff10c4237a67cbd680160ee91" ] }, "id": "_h1e-L9yZfaY", "outputId": "fd540dd7-a0aa-4827-e001-f6d4ef603c6a" }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "Warning: You are sending unauthenticated requests to the HF Hub. Please set a HF_TOKEN to enable higher rate limits and faster downloads.\n", "WARNING:huggingface_hub.utils._http:Warning: You are sending unauthenticated requests to the HF Hub. Please set a HF_TOKEN to enable higher rate limits and faster downloads.\n", "Loading weights: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████| 103/103 [00:00<00:00, 14486.88it/s]\n", "\u001b[1mBertModel LOAD REPORT\u001b[0m from: sentence-transformers/all-MiniLM-L6-v2\n", "Key | Status | | \n", "------------------------+------------+--+-\n", "embeddings.position_ids | UNEXPECTED | | \n", "\n", "Notes:\n", "- UNEXPECTED:\tcan be ignored when loading from different task/architecture; not ok if you expect identical arch.\n" ] } ], "source": [ "from langchain_huggingface import HuggingFaceEmbeddings\n", "\n", "embeddings = HuggingFaceEmbeddings(model_name=\"sentence-transformers/all-MiniLM-L6-v2\")" ] }, { "cell_type": "markdown", "metadata": { "id": "Qrj-jeGmBRTL" }, "source": [ "## Vector Search with LangChain\n", "### Create Redis vector store instance\n", "\n", "We also need to create a schema for the vector index so we can take advantage of the metadata along with the vectors.\n", "\n", "**Important Note**: LangChain does not support JSON data types yet. Only supports HASH for now. This update should be coming soon." ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "yY69FViAjNv1", "outputId": "ab7b212b-3c55-44b1-cf72-6eb926cf302f" }, "outputs": [], "source": [ "from langchain_redis import RedisVectorStore\n", "\n", "index_name = \"langchain_ex\"\n", "\n", "# construct the vector store class from texts and metadata\n", "rds = RedisVectorStore.from_documents(\n", " chunks,\n", " embeddings,\n", " index_name=index_name,\n", " redis_url=REDIS_URL,\n", " metadata_schema=[\n", " {\n", " \"name\": \"source\",\n", " \"type\": \"text\"\n", " },\n", " ]\n", ")" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "gntcxF1P1vmx", "outputId": "3bef4861-8778-4ab7-fb61-710aba655f2c" }, "outputs": [ { "data": { "text/plain": [ "879" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# access underlying redis client to see how many docs have been stores\n", "rds._index.client.dbsize()" ] }, { "cell_type": "markdown", "metadata": { "id": "61xV5qyp1vmy" }, "source": [ "### Query the database\n", "Now we can use the LangChain vector store class to perform similarity search operations on Redis" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "id": "Gv6SxKOB1vmy" }, "outputs": [], "source": [ "from redisvl.query.filter import Text" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "Q3pH3MPD1vmy", "outputId": "2754347f-be31-4a38-d356-31ecc235ffe8" }, "outputs": [ { "data": { "text/plain": [ "[(Document(metadata={'source': 'resources/nke-10k-2023.pdf', 'file_directory': 'resources', 'filename': 'nke-10k-2023.pdf', 'last_modified': '2026-03-20T15:56:42', 'page_number': 1, 'languages': ['eng'], 'filetype': 'application/pdf', 'category': 'CompositeElement', 'element_id': 'ee89578c33712bb26cf88ab00579fe6d'}, page_content=\"(Dollars in millions, except per share data)\\n\\nRevenues Cost of sales\\n\\nGross profit Gross margin\\n\\nDemand creation expense Operating overhead expense\\n\\nTotal selling and administrative expense % of revenues\\n\\nInterest expense (income), net\\n\\nOther (income) expense, net Income before income taxes\\n\\nIncome tax expense Effective tax rate\\n\\nNET INCOME Diluted earnings per common share\\n\\n$\\n\\n$ $\\n\\nFISCAL 2023\\n\\n51,217 28,925\\n\\n22,292\\n\\n43.5 %\\n\\n4,060 12,317\\n\\n16,377\\n\\n32.0 % (6)\\n\\n(280) 6,201\\n\\n1,131\\n\\n18.2 %\\n\\n5,070 3.23\\n\\n$\\n\\n$ $\\n\\nFISCAL 2022\\n\\n46,710 25,231\\n\\n21,479\\n\\n46.0 %\\n\\n3,850 10,954\\n\\n14,804\\n\\n31.7 % 205\\n\\n(181) 6,651\\n\\n605 9.1 %\\n\\n6,046 3.75\\n\\n% CHANGE\\n\\n10 % $ 15 %\\n\\n4 %\\n\\n5 % 12 %\\n\\n11 %\\n\\n—\\n\\n— -7 %\\n\\n87 %\\n\\n16 % $ -14 % $\\n\\nFISCAL 2021\\n\\n% CHANGE\\n\\n44,538 24,576\\n\\n5 % 3 %\\n\\n19,962\\n\\n8 %\\n\\n44.8 %\\n\\n3,114 9,911\\n\\n24 % 11 %\\n\\n13,025\\n\\n14 %\\n\\n29.2 % 262\\n\\n—\\n\\n14 6,661\\n\\n— 0 %\\n\\n934 14.0 %\\n\\n35 %\\n\\n5,727 3.56\\n\\n6 % 5 %\\n\\n2023 FORM 10-K 31\\n\\nTable of Contents\\n\\nCONSOLIDATED OPERATING RESULTS REVENUES\\n\\n(Dollars in millions)\\n\\nFISCAL 2023\\n\\nFISCAL 2022\\n\\n% CHANGE\\n\\n% CHANGE EXCLUDING CURRENCY (1) CHANGES\\n\\nFISCAL 2021\\n\\n% CHANGE\\n\\nNIKE, Inc. Revenues:\\n\\nNIKE Brand Revenues by:\\n\\nFootwear Apparel\\n\\n$\\n\\n33,135 $ 13,843\\n\\n29,143 13,567\\n\\n14 % 2 %\\n\\n20 % $ 8 %\\n\\n28,021 12,865\\n\\n4 % 5 %\\n\\nEquipment Global Brand Divisions\\n\\n(2)\\n\\nTotal NIKE Brand Revenues\\n\\n$\\n\\n1,727 58\\n\\n48,763 $\\n\\n1,624 102 44,436\\n\\n6 % -43 % 10 %\\n\\n13 % -43 % 16 % $\\n\\n1,382 25 42,293\\n\\n18 % 308 % 5 %\\n\\nConverse Corporate\\n\\n(3)\\n\\n2,427 27\\n\\n2,346 (72)\\n\\n3 % —\\n\\n8 % —\\n\\n2,205 40\\n\\n6 % —\\n\\nTOTAL NIKE, INC. REVENUES\\n\\n$\\n\\n51,217 $\\n\\n46,710\\n\\n10 %\\n\\n16 % $\\n\\n44,538\\n\\n5 %\\n\\nSupplemental NIKE Brand Revenues Details: NIKE Brand Revenues by:\\n\\nSales to Wholesale Customers\\n\\n$\\n\\n27,397 $\\n\\n25,608\\n\\n7 %\\n\\n14 % $\\n\\n25,898\\n\\n1 %\\n\\nSales through NIKE Direct Global Brand Divisions\\n\\n(2)\\n\\n21,308 58\\n\\n18,726 102\\n\\n14 % -43 %\\n\\n20 % -43 %\\n\\n16,370 25\\n\\n14 % 308 %\\n\\nTOTAL NIKE BRAND REVENUES (1) NIKE Brand Revenues on a Wholesale Equivalent Basis :\\n\\n$\\n\\n48,763 $\\n\\n44,436\\n\\n10 %\\n\\n16 % $\\n\\n42,293\\n\\n5 %\\n\\nSales to Wholesale Customers Sales from our Wholesale Operations to NIKE Direct Operations\\n\\nTOTAL NIKE BRAND WHOLESALE EQUIVALENT REVENUES NIKE Brand Wholesale Equivalent Revenues by:\\n\\n(1),(4)\\n\\n$\\n\\n$\\n\\n27,397 $ 12,730\\n\\n40,127 $\\n\\n25,608 10,543\\n\\n36,151\\n\\n7 % 21 %\\n\\n11 %\\n\\n14 % $ 27 %\\n\\n18 % $\\n\\n25,898 9,872\\n\\n35,770\\n\\n1 % 7 % 1 %\\n\\nMen's Women's NIKE Kids'\\n\\n$\\n\\n20,733 $ 8,606 5,038\\n\\n18,797 8,273 4,874\\n\\n10 % 4 % 3 %\\n\\n17 % $ 11 % 10 %\\n\\n18,391 8,225 4,882\\n\\n2 % 1 % 0 %\\n\\nJordan Brand (5) Others\\n\\n6,589 (839)\\n\\n5,122 (915)\\n\\n29 % 8 %\\n\\n35 % -3 %\"),\n", " 0.49901163578),\n", " (Document(metadata={'source': 'resources/nke-10k-2023.pdf', 'file_directory': 'resources', 'filename': 'nke-10k-2023.pdf', 'last_modified': '2026-03-20T15:56:42', 'page_number': 1, 'languages': ['eng'], 'filetype': 'application/pdf', 'category': 'CompositeElement', 'element_id': 'ee89578c33712bb26cf88ab00579fe6d'}, page_content=\"Tax (expense) benefit Gain (loss) net of tax\\n\\n5 (14)\\n\\n(9) 22\\n\\nTotal net gain (loss) reclassified for the period\\n\\n$\\n\\n463 $\\n\\n30\\n\\n2023 FORM 10-K 82\\n\\nTable of Contents\\n\\nNOTE 14 — REVENUES\\n\\nDISAGGREGATION OF REVENUES The following tables present the Company's Revenues disaggregated by reportable operating segment, major product line and distribution channel:\\n\\n(Dollars in millions)\\n\\nNORTH AMERICA\\n\\nEUROPE, MIDDLE EAST & AFRICA\\n\\nGREATER CHINA\\n\\nYEAR ENDED MAY 31, 2023 ASIA PACIFIC & LATIN (1)\\n\\nGLOBAL BRAND DIVISIONS\\n\\nTOTAL NIKE\\n\\nAMERICA\\n\\nBRAND CONVERSE CORPORATE\\n\\nTOTAL NIKE, INC.\\n\\nRevenues by: Footwear\\n\\n$\\n\\n14,897 $\\n\\n8,260 $\\n\\n5,435 $\\n\\n4,543 $\\n\\n— $\\n\\n33,135 $\\n\\n2,155 $\\n\\n— $\\n\\n35,290\\n\\nApparel Equipment Other\\n\\n5,947 764 —\\n\\n4,566 592 —\\n\\n1,666 147 —\\n\\n1,664 224 —\\n\\n— — 58\\n\\n13,843 1,727 58\\n\\n90 28 154\\n\\n— — 27\\n\\n13,933 1,755 239\\n\\nTOTAL REVENUES\\n\\n$\\n\\n21,608 $\\n\\n13,418 $\\n\\n7,248 $\\n\\n6,431 $\\n\\n58 $\\n\\n48,763 $\\n\\n2,427 $\\n\\n27 $\\n\\n51,217\\n\\nRevenues by:\\n\\nSales to Wholesale Customers Sales through Direct to Consumer\\n\\n$\\n\\n11,273 $ 10,335\\n\\n8,522 $ 4,896\\n\\n3,866 $ 3,382\\n\\n3,736 $ 2,695\\n\\n— $ —\\n\\n27,397 $ 21,308\\n\\n1,299 $ 974\\n\\n— $ —\\n\\n28,696 22,282\\n\\nOther\\n\\nTOTAL REVENUES\\n\\n$\\n\\n—\\n\\n21,608 $\\n\\n—\\n\\n13,418 $\\n\\n— 7,248 $\\n\\n— 6,431 $\\n\\n58 58 $\\n\\n58\\n\\n48,763 $\\n\\n154 2,427 $\\n\\n27 27 $\\n\\n239 51,217\\n\\n(1) Refer to Note 18 — Acquisitions and Divestitures for additional information on the transition of the Company's NIKE Brand businesses in its CASA territory to third-party distributors.\\n\\nYEAR ENDED MAY 31, 2022\\n\\n(Dollars in millions)\\n\\nNORTH AMERICA\\n\\nEUROPE, MIDDLE EAST & AFRICA\\n\\nGREATER CHINA\\n\\nASIA PACIFIC & LATIN AMERICA\\n\\nGLOBAL BRAND DIVISIONS\\n\\nTOTAL NIKE\\n\\nBRAND CONVERSE CORPORATE\\n\\nTOTAL NIKE, INC.\\n\\nRevenues by: Footwear Apparel\\n\\n$\\n\\n12,228 $ 5,492\\n\\n7,388 $ 4,527\\n\\n5,416 $ 1,938\\n\\n4,111 $ 1,610\\n\\n— $ —\\n\\n29,143 $ 13,567\\n\\n2,094 $ 103\\n\\n— $ —\\n\\n31,237 13,670\\n\\nEquipment Other\\n\\n633 —\\n\\n564 —\\n\\n193 —\\n\\n234 —\\n\\n— 102\\n\\n1,624 102\\n\\n26 123\\n\\n— (72)\\n\\n1,650 153\\n\\nTOTAL REVENUES Revenues by:\\n\\n$\\n\\n18,353 $\\n\\n12,479 $\\n\\n7,547 $\\n\\n5,955 $\\n\\n102 $\\n\\n44,436 $\\n\\n2,346 $\\n\\n(72) $\\n\\n46,710\\n\\nSales to Wholesale Customers Sales through Direct to Consumer Other\\n\\n$\\n\\n9,621 $ 8,732 —\\n\\n8,377 $ 4,102 —\\n\\n4,081 $ 3,466 —\\n\\n3,529 $ 2,426 —\\n\\n— $ — 102\\n\\n25,608 $ 18,726 102\\n\\n1,292 $ 931 123\\n\\n— $ — (72)\\n\\n26,900 19,657 153\\n\\nTOTAL REVENUES\\n\\n$\\n\\n18,353 $\\n\\n12,479 $\\n\\n7,547 $\\n\\n5,955 $\\n\\n102 $\\n\\n44,436 $\\n\\n2,346 $\\n\\n(72) $\\n\\n46,710\\n\\n2023 FORM 10-K 83\\n\\nTable of Contents\\n\\nYEAR ENDED MAY 31, 2021\\n\\n(Dollars in millions)\\n\\nNORTH AMERICA\\n\\nEUROPE, MIDDLE EAST & AFRICA\\n\\nGREATER CHINA\"),\n", " 0.529603302479),\n", " (Document(metadata={'source': 'resources/nke-10k-2023.pdf', 'file_directory': 'resources', 'filename': 'nke-10k-2023.pdf', 'last_modified': '2026-03-20T15:56:42', 'page_number': 1, 'languages': ['eng'], 'filetype': 'application/pdf', 'category': 'CompositeElement', 'element_id': 'ee89578c33712bb26cf88ab00579fe6d'}, page_content=\"NIKE, INC. CONSOLIDATED STATEMENTS OF INCOME\\n\\n(In millions, except per share data)\\n\\nRevenues Cost of sales\\n\\nGross profit\\n\\nDemand creation expense Operating overhead expense\\n\\nTotal selling and administrative expense\\n\\nInterest expense (income), net\\n\\nOther (income) expense, net Income before income taxes\\n\\nIncome tax expense NET INCOME\\n\\nEarnings per common share:\\n\\nBasic Diluted\\n\\nWeighted average common shares outstanding:\\n\\nBasic Diluted\\n\\nThe accompanying Notes to the Consolidated Financial Statements are an integral part of this statement.\\n\\n$\\n\\n$\\n\\n$ $\\n\\nYEAR ENDED MAY 31,\\n\\n2023\\n\\n2022\\n\\n2021\\n\\n51,217 $ 28,925\\n\\n46,710 $ 25,231\\n\\n44,538 24,576\\n\\n22,292 4,060 12,317\\n\\n21,479 3,850 10,954\\n\\n19,962 3,114 9,911\\n\\n16,377 (6)\\n\\n14,804 205\\n\\n13,025 262\\n\\n(280) 6,201\\n\\n(181) 6,651\\n\\n14 6,661\\n\\n1,131 5,070 $\\n\\n605 6,046 $\\n\\n934 5,727\\n\\n3.27 $ 3.23 $\\n\\n3.83 $ 3.75 $\\n\\n3.64 3.56\\n\\n1,551.6 1,569.8\\n\\n1,578.8 1,610.8\\n\\n1,573.0 1,609.4\\n\\n2023 FORM 10-K 55\\n\\nTable of Contents\\n\\nNIKE, INC. CONSOLIDATED STATEMENTS OF COMPREHENSIVE INCOME\\n\\nYEAR ENDED MAY 31,\\n\\n(Dollars in millions)\\n\\n2023\\n\\n2022\\n\\nNet income Other comprehensive income (loss), net of tax:\\n\\n$\\n\\n5,070 $\\n\\n6,046 $\\n\\nChange in net foreign currency translation adjustment\\n\\n267\\n\\n(522)\\n\\nChange in net gains (losses) on cash flow hedges Change in net gains (losses) on other\\n\\n(348) (6)\\n\\n1,214 6\\n\\nTotal other comprehensive income (loss), net of tax TOTAL COMPREHENSIVE INCOME\\n\\n$\\n\\n(87) 4,983 $\\n\\n698 6,744 $\\n\\nThe accompanying Notes to the Consolidated Financial Statements are an integral part of this statement.\\n\\n2023 FORM 10-K 56\\n\\n2021\\n\\n5,727\\n\\n496\\n\\n(825) 5\\n\\n(324) 5,403\\n\\nTable of Contents\\n\\nNIKE, INC. CONSOLIDATED BALANCE SHEETS\\n\\n(In millions)\\n\\nASSETS\\n\\nCurrent assets:\\n\\nCash and equivalents Short-term investments\\n\\nAccounts receivable, net Inventories Prepaid expenses and other current assets\\n\\nTotal current assets\\n\\nProperty, plant and equipment, net\\n\\nOperating lease right-of-use assets, net Identifiable intangible assets, net Goodwill\\n\\nDeferred income taxes and other assets\\n\\nTOTAL ASSETS\\n\\nLIABILITIES AND SHAREHOLDERS' EQUITY Current liabilities:\\n\\nCurrent portion of long-term debt Notes payable Accounts payable\\n\\nCurrent portion of operating lease liabilities Accrued liabilities Income taxes payable\\n\\nTotal current liabilities\\n\\nLong-term debt\\n\\nOperating lease liabilities Deferred income taxes and other liabilities Commitments and contingencies (Note 16)\\n\\nRedeemable preferred stock Shareholders' equity: Common stock at stated value:\"),\n", " 0.560669064522),\n", " (Document(metadata={'source': 'resources/nke-10k-2023.pdf', 'file_directory': 'resources', 'filename': 'nke-10k-2023.pdf', 'last_modified': '2026-03-20T15:56:42', 'page_number': 1, 'languages': ['eng'], 'filetype': 'application/pdf', 'category': 'CompositeElement', 'element_id': 'ee89578c33712bb26cf88ab00579fe6d'}, page_content='Lower margin in our NIKE Direct business, driven by higher promotional activity to liquidate inventory in the current period compared to lower promotional activity in\\n\\nthe prior period resulting from lower available inventory supply;\\n\\nUnfavorable changes in net foreign currency exchange rates, including hedges; and\\n\\nLower off-price margin, on a wholesale equivalent basis.\\n\\nThis was partially offset by:\\n\\nHigher NIKE Brand full-price ASP, net of discounts, on a wholesale equivalent basis, due primarily to strategic pricing actions and product mix; and\\n\\nLower other costs, primarily due to higher inventory obsolescence reserves recognized in Greater China in the fourth quarter of fiscal 2022.\\n\\nTOTAL SELLING AND ADMINISTRATIVE EXPENSE\\n\\n(Dollars in millions)\\n\\nDemand creation expense Operating overhead expense\\n\\n(1)\\n\\n$\\n\\nFISCAL 2023 4,060 12,317\\n\\n$\\n\\nFISCAL 2022 3,850 10,954\\n\\n% CHANGE\\n\\n5 % $\\n\\n12 %\\n\\nFISCAL 2021 3,114 9,911\\n\\nTotal selling and administrative expense\\n\\n% of revenues\\n\\n$\\n\\n16,377\\n\\n32.0 %\\n\\n$\\n\\n14,804\\n\\n31.7 %\\n\\n11 % $ 30 bps\\n\\n13,025\\n\\n29.2 %\\n\\n(1) Demand creation expense consists of advertising and promotion costs, including costs of endorsement contracts, complimentary product, television, digital and print advertising and media costs, brand\\n\\nevents and retail brand presentation.\\n\\nFISCAL 2023 COMPARED TO FISCAL 2022\\n\\nDemand creation expense increased 5% for fiscal 2023, primarily due to higher advertising and marketing expense and higher sports marketing expense. Changes in foreign currency exchange rates decreased Demand creation expense by approximately 4 percentage points.\\n\\nOperating overhead expense increased 12%, primarily due to higher wage-related expenses, NIKE Direct variable costs, strategic technology enterprise investments and other administrative costs. Changes in foreign currency exchange rates decreased Operating overhead expense by approximately 3 percentage points.\\n\\n2023 FORM 10-K 34\\n\\n% CHANGE\\n\\n24 % 11 %\\n\\n14 % 250 bps\\n\\nTable of Contents\\n\\nOTHER (INCOME) EXPENSE, NET\\n\\n(Dollars in millions)\\n\\nFISCAL 2023\\n\\nFISCAL 2022\\n\\nFISCAL 2021\\n\\nOther (income) expense, net\\n\\n$\\n\\n(280) $\\n\\n(181) $\\n\\n14\\n\\nOther (income) expense, net comprises foreign currency conversion gains and losses from the remeasurement of monetary assets and liabilities denominated in non- functional currencies and the impact of certain foreign currency derivative instruments, as well as unusual or non-operating transactions that are outside the normal course of business.'),\n", " 0.574473381042)]" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# basic \"top 4\" vector search on a given query\n", "rds.similarity_search_with_score(query=\"Profit margins\", k=4)" ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "od6Wqmya1vmy", "outputId": "5dbac581-4a07-45b0-d630-995342e91dc7" }, "outputs": [ { "data": { "text/plain": [ "[(Document(metadata={'source': 'resources/nke-10k-2023.pdf', 'file_directory': 'resources', 'filename': 'nke-10k-2023.pdf', 'last_modified': '2026-03-20T15:56:42', 'page_number': 1, 'languages': ['eng'], 'filetype': 'application/pdf', 'category': 'CompositeElement', 'element_id': 'ee89578c33712bb26cf88ab00579fe6d'}, page_content=\"(Dollars in millions, except per share data)\\n\\nRevenues Cost of sales\\n\\nGross profit Gross margin\\n\\nDemand creation expense Operating overhead expense\\n\\nTotal selling and administrative expense % of revenues\\n\\nInterest expense (income), net\\n\\nOther (income) expense, net Income before income taxes\\n\\nIncome tax expense Effective tax rate\\n\\nNET INCOME Diluted earnings per common share\\n\\n$\\n\\n$ $\\n\\nFISCAL 2023\\n\\n51,217 28,925\\n\\n22,292\\n\\n43.5 %\\n\\n4,060 12,317\\n\\n16,377\\n\\n32.0 % (6)\\n\\n(280) 6,201\\n\\n1,131\\n\\n18.2 %\\n\\n5,070 3.23\\n\\n$\\n\\n$ $\\n\\nFISCAL 2022\\n\\n46,710 25,231\\n\\n21,479\\n\\n46.0 %\\n\\n3,850 10,954\\n\\n14,804\\n\\n31.7 % 205\\n\\n(181) 6,651\\n\\n605 9.1 %\\n\\n6,046 3.75\\n\\n% CHANGE\\n\\n10 % $ 15 %\\n\\n4 %\\n\\n5 % 12 %\\n\\n11 %\\n\\n—\\n\\n— -7 %\\n\\n87 %\\n\\n16 % $ -14 % $\\n\\nFISCAL 2021\\n\\n% CHANGE\\n\\n44,538 24,576\\n\\n5 % 3 %\\n\\n19,962\\n\\n8 %\\n\\n44.8 %\\n\\n3,114 9,911\\n\\n24 % 11 %\\n\\n13,025\\n\\n14 %\\n\\n29.2 % 262\\n\\n—\\n\\n14 6,661\\n\\n— 0 %\\n\\n934 14.0 %\\n\\n35 %\\n\\n5,727 3.56\\n\\n6 % 5 %\\n\\n2023 FORM 10-K 31\\n\\nTable of Contents\\n\\nCONSOLIDATED OPERATING RESULTS REVENUES\\n\\n(Dollars in millions)\\n\\nFISCAL 2023\\n\\nFISCAL 2022\\n\\n% CHANGE\\n\\n% CHANGE EXCLUDING CURRENCY (1) CHANGES\\n\\nFISCAL 2021\\n\\n% CHANGE\\n\\nNIKE, Inc. Revenues:\\n\\nNIKE Brand Revenues by:\\n\\nFootwear Apparel\\n\\n$\\n\\n33,135 $ 13,843\\n\\n29,143 13,567\\n\\n14 % 2 %\\n\\n20 % $ 8 %\\n\\n28,021 12,865\\n\\n4 % 5 %\\n\\nEquipment Global Brand Divisions\\n\\n(2)\\n\\nTotal NIKE Brand Revenues\\n\\n$\\n\\n1,727 58\\n\\n48,763 $\\n\\n1,624 102 44,436\\n\\n6 % -43 % 10 %\\n\\n13 % -43 % 16 % $\\n\\n1,382 25 42,293\\n\\n18 % 308 % 5 %\\n\\nConverse Corporate\\n\\n(3)\\n\\n2,427 27\\n\\n2,346 (72)\\n\\n3 % —\\n\\n8 % —\\n\\n2,205 40\\n\\n6 % —\\n\\nTOTAL NIKE, INC. REVENUES\\n\\n$\\n\\n51,217 $\\n\\n46,710\\n\\n10 %\\n\\n16 % $\\n\\n44,538\\n\\n5 %\\n\\nSupplemental NIKE Brand Revenues Details: NIKE Brand Revenues by:\\n\\nSales to Wholesale Customers\\n\\n$\\n\\n27,397 $\\n\\n25,608\\n\\n7 %\\n\\n14 % $\\n\\n25,898\\n\\n1 %\\n\\nSales through NIKE Direct Global Brand Divisions\\n\\n(2)\\n\\n21,308 58\\n\\n18,726 102\\n\\n14 % -43 %\\n\\n20 % -43 %\\n\\n16,370 25\\n\\n14 % 308 %\\n\\nTOTAL NIKE BRAND REVENUES (1) NIKE Brand Revenues on a Wholesale Equivalent Basis :\\n\\n$\\n\\n48,763 $\\n\\n44,436\\n\\n10 %\\n\\n16 % $\\n\\n42,293\\n\\n5 %\\n\\nSales to Wholesale Customers Sales from our Wholesale Operations to NIKE Direct Operations\\n\\nTOTAL NIKE BRAND WHOLESALE EQUIVALENT REVENUES NIKE Brand Wholesale Equivalent Revenues by:\\n\\n(1),(4)\\n\\n$\\n\\n$\\n\\n27,397 $ 12,730\\n\\n40,127 $\\n\\n25,608 10,543\\n\\n36,151\\n\\n7 % 21 %\\n\\n11 %\\n\\n14 % $ 27 %\\n\\n18 % $\\n\\n25,898 9,872\\n\\n35,770\\n\\n1 % 7 % 1 %\\n\\nMen's Women's NIKE Kids'\\n\\n$\\n\\n20,733 $ 8,606 5,038\\n\\n18,797 8,273 4,874\\n\\n10 % 4 % 3 %\\n\\n17 % $ 11 % 10 %\\n\\n18,391 8,225 4,882\\n\\n2 % 1 % 0 %\\n\\nJordan Brand (5) Others\\n\\n6,589 (839)\\n\\n5,122 (915)\\n\\n29 % 8 %\\n\\n35 % -3 %\"),\n", " 0.49901163578),\n", " (Document(metadata={'source': 'resources/nke-10k-2023.pdf', 'file_directory': 'resources', 'filename': 'nke-10k-2023.pdf', 'last_modified': '2026-03-20T15:56:42', 'page_number': 1, 'languages': ['eng'], 'filetype': 'application/pdf', 'category': 'CompositeElement', 'element_id': 'ee89578c33712bb26cf88ab00579fe6d'}, page_content='From time to time, we may invest in technology, business infrastructure, new businesses or capabilities, product offering and manufacturing innovation and expansion of existing businesses, such as our NIKE Direct operations, which require substantial cash investments and management attention. We believe cost-effective investments are essential to business growth and profitability; however, significant investments are subject to typical risks and uncertainties inherent in developing a new business or expanding an existing business. The failure of any significant investment to provide expected returns or profitability could have a material adverse effect on our financial results and divert management attention from more profitable business operations. See also \"Our NIKE Direct operations have required and will continue to require a substantial investment and commitment of resources and are subject to numerous risks and uncertainties.\"\\n\\nThe sale of a large number of shares of common stock by our principal shareholder could depress the market price of our common stock.\\n\\nAs of June 30, 2023, Swoosh, LLC beneficially owned approximately 77% of our Class A Common Stock. If, on June 30, 2023, all of these shares were converted into Class B Common Stock, Swoosh, LLC\\'s commensurate ownership percentage of our Class B Common Stock would be approximately 16%. The shares are available for resale, subject to the requirements of the U.S. securities laws and the terms of the limited liability company agreement governing Swoosh, LLC. The sale or prospect of a sale of a substantial number of these shares could have an adverse effect on the market price of our common stock. Swoosh, LLC was formed by Philip H. Knight, our Chairman Emeritus, to hold the majority of his shares of Class A Common Stock. Mr. Knight does not have voting rights with respect to Swoosh, LLC, although Travis Knight, his son and a NIKE director, has a significant role in the management of the Class A Common Stock owned by Swoosh, LLC.\\n\\nChanges in our credit ratings or macroeconomic conditions may affect our liquidity, increasing borrowing costs and limiting our financing options.'),\n", " 0.604557514191),\n", " (Document(metadata={'source': 'resources/nke-10k-2023.pdf', 'file_directory': 'resources', 'filename': 'nke-10k-2023.pdf', 'last_modified': '2026-03-20T15:56:42', 'page_number': 1, 'languages': ['eng'], 'filetype': 'application/pdf', 'category': 'CompositeElement', 'element_id': 'ee89578c33712bb26cf88ab00579fe6d'}, page_content='NIKE Brand revenues, which represented over 90% of NIKE, Inc. Revenues, increased 10% and 16% on a reported and currency-neutral basis, respectively. This increase was primarily due to higher revenues in Men\\'s, the Jordan Brand, Women\\'s and Kids\\' which grew 17%, 35%,11% and 10%, respectively, on a wholesale equivalent basis.\\n\\nNIKE Brand footwear revenues increased 20% on a currency-neutral basis, due to higher revenues in Men\\'s, the Jordan Brand, Women\\'s and Kids\\'. Unit sales of footwear increased 13%, while higher average selling price (\"ASP\") per pair contributed approximately 7 percentage points of footwear revenue growth. Higher ASP was primarily due to higher full-price ASP, net of discounts, on a wholesale equivalent basis, and growth in the size of our NIKE Direct business, partially offset by lower NIKE Direct ASP.\\n\\nNIKE Brand apparel revenues increased 8% on a currency-neutral basis, primarily due to higher revenues in Men\\'s. Unit sales of apparel increased 4%, while higher ASP per unit contributed approximately 4 percentage points of apparel revenue growth. Higher ASP was primarily due to higher full-price ASP and growth in the size of our NIKE Direct business, partially offset by lower NIKE Direct ASP, reflecting higher promotional activity.\\n\\nNIKE Direct revenues increased 14% from $18.7 billion in fiscal 2022 to $21.3 billion in fiscal 2023. On a currency-neutral basis, NIKE Direct revenues increased 20% primarily driven by NIKE Brand Digital sales growth of 24%, comparable store sales growth of 14% and the addition of new stores. For further information regarding comparable store sales, including the definition, see \"Comparable Store Sales\". NIKE Brand Digital sales were $12.6 billion for fiscal 2023 compared to $10.7 billion for fiscal 2022.\\n\\n2023 FORM 10-K 33\\n\\nTable of Contents\\n\\nGROSS MARGIN FISCAL 2023 COMPARED TO FISCAL 2022\\n\\nFor fiscal 2023, our consolidated gross profit increased 4% to $22,292 million compared to $21,479 million for fiscal 2022. Gross margin decreased 250 basis points to 43.5% for fiscal 2023 compared to 46.0% for fiscal 2022 due to the following:\\n\\nWholesale equivalent\\n\\nThe decrease in gross margin for fiscal 2023 was primarily due to:\\n\\nHigher NIKE Brand product costs, on a wholesale equivalent basis, primarily due to higher input costs and elevated inbound freight and logistics costs as well as\\n\\nproduct mix;'),\n", " 0.650711715221),\n", " (Document(metadata={'source': 'resources/nke-10k-2023.pdf', 'file_directory': 'resources', 'filename': 'nke-10k-2023.pdf', 'last_modified': '2026-03-20T15:56:42', 'page_number': 1, 'languages': ['eng'], 'filetype': 'application/pdf', 'category': 'CompositeElement', 'element_id': 'ee89578c33712bb26cf88ab00579fe6d'}, page_content='We experience moderate fluctuations in aggregate sales volume during the year. Historically, revenues in the first and fourth fiscal quarters have slightly exceeded those in the second and third fiscal quarters. However, the mix of product sales may vary considerably from time to time or in the future as a result of strategic shifts in our business and seasonal or geographic demand for particular types of footwear, apparel and equipment and in connection with the timing of significant sporting events, such as the NBA Finals, Olympics or the World Cup, among others. In addition, our customers may cancel orders, change delivery schedules or change the mix of products ordered with minimal notice. As a result, we may not be able to accurately predict our quarterly sales. Accordingly, our results of operations are likely to fluctuate significantly from period to period. This seasonality, along with other factors that are beyond our control, including economic conditions, changes in consumer preferences, weather conditions, outbreaks of disease, social or political unrest, availability of import quotas, transportation disruptions and currency exchange rate fluctuations, has in the past adversely affected and could in the future adversely affect our business and cause our results of operations to fluctuate. Our operating margins are also sensitive to a number of additional factors that are beyond our control, including manufacturing and transportation costs, shifts in product sales mix and geographic sales trends, all of which we expect to continue. Results of operations in any period should not be considered indicative of the results to be expected for any future period.\\n\\nIf we are unable to anticipate consumer preferences and develop new products, we may not be able to maintain or increase our revenues and profits.'),\n", " 0.664224147797)]" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# vector search with metadata filtering\n", "f = Text(\"text\") % \"profit\"\n", "rds.similarity_search_with_score(query=\"Profit margins\", k=4, filter=f)" ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "DT9sPHw51vmy", "outputId": "7d2b8969-91b8-4ff7-81ba-9d0cb6280edc" }, "outputs": [ { "data": { "text/plain": [ "[(Document(metadata={'source': 'resources/nke-10k-2023.pdf', 'file_directory': 'resources', 'filename': 'nke-10k-2023.pdf', 'last_modified': '2026-03-20T15:56:42', 'page_number': 1, 'languages': ['eng'], 'filetype': 'application/pdf', 'category': 'CompositeElement', 'element_id': 'ee89578c33712bb26cf88ab00579fe6d'}, page_content='As discussed in Note 15 — Operating Segments and Related Information in the accompanying Notes to the Consolidated Financial Statements, our operating segments are evidence of the structure of the Company\\'s internal organization. The NIKE Brand segments are defined by geographic regions for operations participating in NIKE Brand sales activity.\\n\\nThe breakdown of Revenues is as follows:\\n\\n(Dollars in millions)\\n\\nFISCAL 2023 FISCAL 2022\\n\\n% CHANGE\\n\\n% CHANGE EXCLUDING CURRENCY (1) CHANGES FISCAL 2021\\n\\n% CHANGE\\n\\nNorth America Europe, Middle East & Africa Greater China\\n\\n$\\n\\n21,608 $ 13,418 7,248\\n\\n18,353 12,479 7,547\\n\\n18 % 8 % -4 %\\n\\n18 % $ 21 % 4 %\\n\\n17,179 11,456 8,290\\n\\n7 % 9 % -9 %\\n\\nAsia Pacific & Latin America Global Brand Divisions\\n\\n(3)\\n\\n(2)\\n\\n6,431 58\\n\\n5,955 102\\n\\n8 % -43 %\\n\\n17 % -43 %\\n\\n5,343 25\\n\\n11 % 308 %\\n\\nTOTAL NIKE BRAND Converse\\n\\n$\\n\\n48,763 $ 2,427\\n\\n44,436 2,346\\n\\n10 % 3 %\\n\\n16 % $ 8 %\\n\\n42,293 2,205\\n\\n5 % 6 %\\n\\n(4)\\n\\nCorporate TOTAL NIKE, INC. REVENUES\\n\\n$\\n\\n27\\n\\n51,217 $\\n\\n(72) 46,710\\n\\n— 10 %\\n\\n— 16 % $\\n\\n40 44,538\\n\\n— 5 %\\n\\n(1) The percent change excluding currency changes represents a non-GAAP financial measure. For further information, see \"Use of Non-GAAP Financial Measures\".\\n\\n(2) For additional information on the transition of our NIKE Brand businesses within our CASA territory to a third-party distributor, see Note 18 — Acquisitions and Divestitures of the Notes to Consolidated\\n\\nFinancial Statements contained in Item 8 of this Annual Report.\\n\\n(3) Global Brand Divisions revenues include NIKE Brand licensing and other miscellaneous revenues that are not part of a geographic operating segment.\\n\\n(4) Corporate revenues primarily consist of foreign currency hedge gains and losses related to revenues generated by entities within the NIKE Brand geographic operating segments and Converse, but\\n\\nmanaged through our central foreign exchange risk management program.\\n\\nThe primary financial measure used by the Company to evaluate performance is Earnings Before Interest and Taxes (\"EBIT\"). As discussed in Note 15 — Operating Segments and Related Information in the accompanying Notes to the Consolidated Financial Statements, certain corporate costs are not included in EBIT.\\n\\nThe breakdown of EBIT is as follows:\\n\\n(Dollars in millions)\\n\\nFISCAL 2023\\n\\nFISCAL 2022\\n\\n% CHANGE\\n\\nFISCAL 2021\\n\\nNorth America Europe, Middle East & Africa Greater China\\n\\n$\\n\\n5,454 3,531 2,283\\n\\n$\\n\\n5,114 3,293 2,365\\n\\n7 % $ 7 % -3 %\\n\\n5,089 2,435 3,243\\n\\nAsia Pacific & Latin America Global Brand Divisions (1)'),\n", " 0.23328602314),\n", " (Document(metadata={'source': 'resources/nke-10k-2023.pdf', 'file_directory': 'resources', 'filename': 'nke-10k-2023.pdf', 'last_modified': '2026-03-20T15:56:42', 'page_number': 1, 'languages': ['eng'], 'filetype': 'application/pdf', 'category': 'CompositeElement', 'element_id': 'ee89578c33712bb26cf88ab00579fe6d'}, page_content=\"Tax (expense) benefit Gain (loss) net of tax\\n\\n5 (14)\\n\\n(9) 22\\n\\nTotal net gain (loss) reclassified for the period\\n\\n$\\n\\n463 $\\n\\n30\\n\\n2023 FORM 10-K 82\\n\\nTable of Contents\\n\\nNOTE 14 — REVENUES\\n\\nDISAGGREGATION OF REVENUES The following tables present the Company's Revenues disaggregated by reportable operating segment, major product line and distribution channel:\\n\\n(Dollars in millions)\\n\\nNORTH AMERICA\\n\\nEUROPE, MIDDLE EAST & AFRICA\\n\\nGREATER CHINA\\n\\nYEAR ENDED MAY 31, 2023 ASIA PACIFIC & LATIN (1)\\n\\nGLOBAL BRAND DIVISIONS\\n\\nTOTAL NIKE\\n\\nAMERICA\\n\\nBRAND CONVERSE CORPORATE\\n\\nTOTAL NIKE, INC.\\n\\nRevenues by: Footwear\\n\\n$\\n\\n14,897 $\\n\\n8,260 $\\n\\n5,435 $\\n\\n4,543 $\\n\\n— $\\n\\n33,135 $\\n\\n2,155 $\\n\\n— $\\n\\n35,290\\n\\nApparel Equipment Other\\n\\n5,947 764 —\\n\\n4,566 592 —\\n\\n1,666 147 —\\n\\n1,664 224 —\\n\\n— — 58\\n\\n13,843 1,727 58\\n\\n90 28 154\\n\\n— — 27\\n\\n13,933 1,755 239\\n\\nTOTAL REVENUES\\n\\n$\\n\\n21,608 $\\n\\n13,418 $\\n\\n7,248 $\\n\\n6,431 $\\n\\n58 $\\n\\n48,763 $\\n\\n2,427 $\\n\\n27 $\\n\\n51,217\\n\\nRevenues by:\\n\\nSales to Wholesale Customers Sales through Direct to Consumer\\n\\n$\\n\\n11,273 $ 10,335\\n\\n8,522 $ 4,896\\n\\n3,866 $ 3,382\\n\\n3,736 $ 2,695\\n\\n— $ —\\n\\n27,397 $ 21,308\\n\\n1,299 $ 974\\n\\n— $ —\\n\\n28,696 22,282\\n\\nOther\\n\\nTOTAL REVENUES\\n\\n$\\n\\n—\\n\\n21,608 $\\n\\n—\\n\\n13,418 $\\n\\n— 7,248 $\\n\\n— 6,431 $\\n\\n58 58 $\\n\\n58\\n\\n48,763 $\\n\\n154 2,427 $\\n\\n27 27 $\\n\\n239 51,217\\n\\n(1) Refer to Note 18 — Acquisitions and Divestitures for additional information on the transition of the Company's NIKE Brand businesses in its CASA territory to third-party distributors.\\n\\nYEAR ENDED MAY 31, 2022\\n\\n(Dollars in millions)\\n\\nNORTH AMERICA\\n\\nEUROPE, MIDDLE EAST & AFRICA\\n\\nGREATER CHINA\\n\\nASIA PACIFIC & LATIN AMERICA\\n\\nGLOBAL BRAND DIVISIONS\\n\\nTOTAL NIKE\\n\\nBRAND CONVERSE CORPORATE\\n\\nTOTAL NIKE, INC.\\n\\nRevenues by: Footwear Apparel\\n\\n$\\n\\n12,228 $ 5,492\\n\\n7,388 $ 4,527\\n\\n5,416 $ 1,938\\n\\n4,111 $ 1,610\\n\\n— $ —\\n\\n29,143 $ 13,567\\n\\n2,094 $ 103\\n\\n— $ —\\n\\n31,237 13,670\\n\\nEquipment Other\\n\\n633 —\\n\\n564 —\\n\\n193 —\\n\\n234 —\\n\\n— 102\\n\\n1,624 102\\n\\n26 123\\n\\n— (72)\\n\\n1,650 153\\n\\nTOTAL REVENUES Revenues by:\\n\\n$\\n\\n18,353 $\\n\\n12,479 $\\n\\n7,547 $\\n\\n5,955 $\\n\\n102 $\\n\\n44,436 $\\n\\n2,346 $\\n\\n(72) $\\n\\n46,710\\n\\nSales to Wholesale Customers Sales through Direct to Consumer Other\\n\\n$\\n\\n9,621 $ 8,732 —\\n\\n8,377 $ 4,102 —\\n\\n4,081 $ 3,466 —\\n\\n3,529 $ 2,426 —\\n\\n— $ — 102\\n\\n25,608 $ 18,726 102\\n\\n1,292 $ 931 123\\n\\n— $ — (72)\\n\\n26,900 19,657 153\\n\\nTOTAL REVENUES\\n\\n$\\n\\n18,353 $\\n\\n12,479 $\\n\\n7,547 $\\n\\n5,955 $\\n\\n102 $\\n\\n44,436 $\\n\\n2,346 $\\n\\n(72) $\\n\\n46,710\\n\\n2023 FORM 10-K 83\\n\\nTable of Contents\\n\\nYEAR ENDED MAY 31, 2021\\n\\n(Dollars in millions)\\n\\nNORTH AMERICA\\n\\nEUROPE, MIDDLE EAST & AFRICA\\n\\nGREATER CHINA\"),\n", " 0.261225223541),\n", " (Document(metadata={'source': 'resources/nke-10k-2023.pdf', 'file_directory': 'resources', 'filename': 'nke-10k-2023.pdf', 'last_modified': '2026-03-20T15:56:42', 'page_number': 1, 'languages': ['eng'], 'filetype': 'application/pdf', 'category': 'CompositeElement', 'element_id': 'ee89578c33712bb26cf88ab00579fe6d'}, page_content='4,780 (508)\\n\\n7 % -80 %\\n\\nTOTAL NIKE BRAND WHOLESALE EQUIVALENT REVENUES\\n\\n$\\n\\n40,127 $\\n\\n36,151\\n\\n11 %\\n\\n18 % $\\n\\n35,770\\n\\n1 %\\n\\n(1)\\n\\nThe percent change excluding currency changes and the presentation of wholesale equivalent revenues represent non-GAAP financial measures. For further information, see \"Use of Non-GAAP Financial Measures\".\\n\\n(2) Global Brand Divisions revenues include NIKE Brand licensing and other miscellaneous revenues that are not part of a geographic operating segment.\\n\\n(3) Corporate revenues primarily consist of foreign currency hedge gains and losses related to revenues generated by entities within the NIKE Brand geographic operating segments and Converse, but\\n\\nmanaged through our central foreign exchange risk management program.\\n\\n(4)\\n\\nAs a result of the Consumer Direct Acceleration strategy, announced in fiscal 2021, the Company is now organized around a consumer construct of Men\\'s, Women\\'s and Kids\\'. Beginning in the first quarter of fiscal 2022, unisex products are classified within Men\\'s, and Jordan Brand revenues are separately reported. Certain prior year amounts were reclassified to conform to fiscal 2022 presentation. These changes had no impact on previously reported consolidated results of operations or shareholders\\' equity.\\n\\n(5) Others include products not allocated to Men\\'s, Women\\'s, NIKE Kids\\' and Jordan Brand, as well as certain adjustments that are not allocated to products designated by consumer.\\n\\n2023 FORM 10-K 32\\n\\n% CHANGE EXCLUDING CURRENCY (1) CHANGES\\n\\n4 % 6 %\\n\\n18 % 302 % 6 %\\n\\n7 % —\\n\\n6 %\\n\\n1 %\\n\\n15 % 302 %\\n\\n6 %\\n\\n1 % 7 % 1 %\\n\\n3 % 1 % 0 %\\n\\n7 % -79 %\\n\\n1 %\\n\\nTable of Contents\\n\\nFISCAL 2023 NIKE BRAND REVENUE HIGHLIGHTS The following tables present NIKE Brand revenues disaggregated by reportable operating segment, distribution channel and major product line:\\n\\nFISCAL 2023 COMPARED TO FISCAL 2022\\n\\nNIKE, Inc. Revenues were $51.2 billion in fiscal 2023, which increased 10% and 16% compared to fiscal 2022 on a reported and currency-neutral basis, respectively. The increase was due to higher revenues in North America, Europe, Middle East & Africa (\"EMEA\"), APLA and Greater China, which contributed approximately 7, 6, 2 and 1 percentage points to NIKE, Inc. Revenues, respectively.'),\n", " 0.283525764942),\n", " (Document(metadata={'source': 'resources/nke-10k-2023.pdf', 'file_directory': 'resources', 'filename': 'nke-10k-2023.pdf', 'last_modified': '2026-03-20T15:56:42', 'page_number': 1, 'languages': ['eng'], 'filetype': 'application/pdf', 'category': 'CompositeElement', 'element_id': 'ee89578c33712bb26cf88ab00579fe6d'}, page_content=\"ASIA PACIFIC & LATIN AMERICA\\n\\n(1)\\n\\nGLOBAL BRAND DIVISIONS\\n\\nTOTAL NIKE BRAND\\n\\nCONVERSE CORPORATE\\n\\nTOTAL NIKE, INC.\\n\\nRevenues by:\\n\\nFootwear Apparel Equipment\\n\\n$\\n\\n11,644 $ 5,028 507\\n\\n6,970 $ 3,996 490\\n\\n5,748 $ 2,347 195\\n\\n3,659 $ 1,494 190\\n\\n— $ — —\\n\\n28,021 $ 12,865 1,382\\n\\n1,986 $ 104 29\\n\\n— $ — —\\n\\n30,007 12,969 1,411\\n\\nOther\\n\\nTOTAL REVENUES\\n\\n$\\n\\n—\\n\\n17,179 $\\n\\n—\\n\\n11,456 $\\n\\n— 8,290 $\\n\\n— 5,343 $\\n\\n25 25 $\\n\\n25\\n\\n42,293 $\\n\\n86 2,205 $\\n\\n40 40 $\\n\\n151 44,538\\n\\nRevenues by:\\n\\nSales to Wholesale Customers $\\n\\n10,186 $\\n\\n7,812 $\\n\\n4,513 $\\n\\n3,387 $\\n\\n— $\\n\\n25,898 $\\n\\n1,353 $\\n\\n— $\\n\\n27,251\\n\\nSales through Direct to Consumer Other\\n\\n6,993 —\\n\\n3,644 —\\n\\n3,777 —\\n\\n1,956 —\\n\\n— 25\\n\\n16,370 25\\n\\n766 86\\n\\n— 40\\n\\n17,136 151\\n\\nTOTAL REVENUES\\n\\n$\\n\\n17,179 $\\n\\n11,456 $\\n\\n8,290 $\\n\\n5,343 $\\n\\n25 $\\n\\n42,293 $\\n\\n2,205 $\\n\\n40 $\\n\\n44,538\\n\\n(1) Refer to Note 18 — Acquisitions and Divestitures for additional information on the transition of the Company's NIKE Brand business in Brazil to a third-party distributor.\\n\\nFor the fiscal years ended May 31, 2023, 2022 and 2021, Global Brand Divisions revenues include NIKE Brand licensing and other miscellaneous revenues that are not part of a geographic operating segment. Converse Other revenues were primarily attributable to licensing businesses. Corporate revenues primarily consisted of foreign currency hedge gains and losses related to revenues generated by entities within the NIKE Brand geographic operating segments and Converse but managed through the Company's central foreign exchange risk management program.\\n\\nAs of May 31, 2023 and 2022, the Company did not have any contract assets and had an immaterial amount of contract liabilities recorded in Accrued liabilities on the Consolidated Balance Sheets.\\n\\nSALES-RELATED RESERVES\\n\\nAs of May 31, 2023 and 2022, the Company's sales-related reserve balance, which includes returns, post-invoice sales discounts and miscellaneous claims, was $994 million and $1,015 million, respectively, recorded in Accrued liabilities on the Consolidated Balance Sheets. The estimated cost of inventory for expected product returns was $226 million and $194 million as of May 31, 2023 and 2022, respectively, and was recorded in Prepaid expenses and other current assets on the Consolidated Balance Sheets.\\n\\nNOTE 15 — OPERATING SEGMENTS AND RELATED INFORMATION\"),\n", " 0.285882890224)]" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# vector search with combinations of metadata filtering\n", "\n", "f = (Text(\"text\") % \"profit\") | (Text(\"text\") % \"revenue\")\n", "rds.similarity_search_with_score(query=\"Nike company revenue\", k=4, filter=f)" ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "kIoGJOop1vmz", "outputId": "9abbf5fd-77de-4094-a2e8-fba2fc5a3a05" }, "outputs": [ { "data": { "text/plain": [ "[(Document(metadata={'source': 'resources/nke-10k-2023.pdf', 'file_directory': 'resources', 'filename': 'nke-10k-2023.pdf', 'last_modified': '2026-03-20T15:56:42', 'page_number': 1, 'languages': ['eng'], 'filetype': 'application/pdf', 'category': 'CompositeElement', 'element_id': 'ee89578c33712bb26cf88ab00579fe6d'}, page_content='As discussed in Note 15 — Operating Segments and Related Information in the accompanying Notes to the Consolidated Financial Statements, our operating segments are evidence of the structure of the Company\\'s internal organization. The NIKE Brand segments are defined by geographic regions for operations participating in NIKE Brand sales activity.\\n\\nThe breakdown of Revenues is as follows:\\n\\n(Dollars in millions)\\n\\nFISCAL 2023 FISCAL 2022\\n\\n% CHANGE\\n\\n% CHANGE EXCLUDING CURRENCY (1) CHANGES FISCAL 2021\\n\\n% CHANGE\\n\\nNorth America Europe, Middle East & Africa Greater China\\n\\n$\\n\\n21,608 $ 13,418 7,248\\n\\n18,353 12,479 7,547\\n\\n18 % 8 % -4 %\\n\\n18 % $ 21 % 4 %\\n\\n17,179 11,456 8,290\\n\\n7 % 9 % -9 %\\n\\nAsia Pacific & Latin America Global Brand Divisions\\n\\n(3)\\n\\n(2)\\n\\n6,431 58\\n\\n5,955 102\\n\\n8 % -43 %\\n\\n17 % -43 %\\n\\n5,343 25\\n\\n11 % 308 %\\n\\nTOTAL NIKE BRAND Converse\\n\\n$\\n\\n48,763 $ 2,427\\n\\n44,436 2,346\\n\\n10 % 3 %\\n\\n16 % $ 8 %\\n\\n42,293 2,205\\n\\n5 % 6 %\\n\\n(4)\\n\\nCorporate TOTAL NIKE, INC. REVENUES\\n\\n$\\n\\n27\\n\\n51,217 $\\n\\n(72) 46,710\\n\\n— 10 %\\n\\n— 16 % $\\n\\n40 44,538\\n\\n— 5 %\\n\\n(1) The percent change excluding currency changes represents a non-GAAP financial measure. For further information, see \"Use of Non-GAAP Financial Measures\".\\n\\n(2) For additional information on the transition of our NIKE Brand businesses within our CASA territory to a third-party distributor, see Note 18 — Acquisitions and Divestitures of the Notes to Consolidated\\n\\nFinancial Statements contained in Item 8 of this Annual Report.\\n\\n(3) Global Brand Divisions revenues include NIKE Brand licensing and other miscellaneous revenues that are not part of a geographic operating segment.\\n\\n(4) Corporate revenues primarily consist of foreign currency hedge gains and losses related to revenues generated by entities within the NIKE Brand geographic operating segments and Converse, but\\n\\nmanaged through our central foreign exchange risk management program.\\n\\nThe primary financial measure used by the Company to evaluate performance is Earnings Before Interest and Taxes (\"EBIT\"). As discussed in Note 15 — Operating Segments and Related Information in the accompanying Notes to the Consolidated Financial Statements, certain corporate costs are not included in EBIT.\\n\\nThe breakdown of EBIT is as follows:\\n\\n(Dollars in millions)\\n\\nFISCAL 2023\\n\\nFISCAL 2022\\n\\n% CHANGE\\n\\nFISCAL 2021\\n\\nNorth America Europe, Middle East & Africa Greater China\\n\\n$\\n\\n5,454 3,531 2,283\\n\\n$\\n\\n5,114 3,293 2,365\\n\\n7 % $ 7 % -3 %\\n\\n5,089 2,435 3,243\\n\\nAsia Pacific & Latin America Global Brand Divisions (1)'),\n", " 0.23328602314),\n", " (Document(metadata={'source': 'resources/nke-10k-2023.pdf', 'file_directory': 'resources', 'filename': 'nke-10k-2023.pdf', 'last_modified': '2026-03-20T15:56:42', 'page_number': 1, 'languages': ['eng'], 'filetype': 'application/pdf', 'category': 'CompositeElement', 'element_id': 'ee89578c33712bb26cf88ab00579fe6d'}, page_content=\"Tax (expense) benefit Gain (loss) net of tax\\n\\n5 (14)\\n\\n(9) 22\\n\\nTotal net gain (loss) reclassified for the period\\n\\n$\\n\\n463 $\\n\\n30\\n\\n2023 FORM 10-K 82\\n\\nTable of Contents\\n\\nNOTE 14 — REVENUES\\n\\nDISAGGREGATION OF REVENUES The following tables present the Company's Revenues disaggregated by reportable operating segment, major product line and distribution channel:\\n\\n(Dollars in millions)\\n\\nNORTH AMERICA\\n\\nEUROPE, MIDDLE EAST & AFRICA\\n\\nGREATER CHINA\\n\\nYEAR ENDED MAY 31, 2023 ASIA PACIFIC & LATIN (1)\\n\\nGLOBAL BRAND DIVISIONS\\n\\nTOTAL NIKE\\n\\nAMERICA\\n\\nBRAND CONVERSE CORPORATE\\n\\nTOTAL NIKE, INC.\\n\\nRevenues by: Footwear\\n\\n$\\n\\n14,897 $\\n\\n8,260 $\\n\\n5,435 $\\n\\n4,543 $\\n\\n— $\\n\\n33,135 $\\n\\n2,155 $\\n\\n— $\\n\\n35,290\\n\\nApparel Equipment Other\\n\\n5,947 764 —\\n\\n4,566 592 —\\n\\n1,666 147 —\\n\\n1,664 224 —\\n\\n— — 58\\n\\n13,843 1,727 58\\n\\n90 28 154\\n\\n— — 27\\n\\n13,933 1,755 239\\n\\nTOTAL REVENUES\\n\\n$\\n\\n21,608 $\\n\\n13,418 $\\n\\n7,248 $\\n\\n6,431 $\\n\\n58 $\\n\\n48,763 $\\n\\n2,427 $\\n\\n27 $\\n\\n51,217\\n\\nRevenues by:\\n\\nSales to Wholesale Customers Sales through Direct to Consumer\\n\\n$\\n\\n11,273 $ 10,335\\n\\n8,522 $ 4,896\\n\\n3,866 $ 3,382\\n\\n3,736 $ 2,695\\n\\n— $ —\\n\\n27,397 $ 21,308\\n\\n1,299 $ 974\\n\\n— $ —\\n\\n28,696 22,282\\n\\nOther\\n\\nTOTAL REVENUES\\n\\n$\\n\\n—\\n\\n21,608 $\\n\\n—\\n\\n13,418 $\\n\\n— 7,248 $\\n\\n— 6,431 $\\n\\n58 58 $\\n\\n58\\n\\n48,763 $\\n\\n154 2,427 $\\n\\n27 27 $\\n\\n239 51,217\\n\\n(1) Refer to Note 18 — Acquisitions and Divestitures for additional information on the transition of the Company's NIKE Brand businesses in its CASA territory to third-party distributors.\\n\\nYEAR ENDED MAY 31, 2022\\n\\n(Dollars in millions)\\n\\nNORTH AMERICA\\n\\nEUROPE, MIDDLE EAST & AFRICA\\n\\nGREATER CHINA\\n\\nASIA PACIFIC & LATIN AMERICA\\n\\nGLOBAL BRAND DIVISIONS\\n\\nTOTAL NIKE\\n\\nBRAND CONVERSE CORPORATE\\n\\nTOTAL NIKE, INC.\\n\\nRevenues by: Footwear Apparel\\n\\n$\\n\\n12,228 $ 5,492\\n\\n7,388 $ 4,527\\n\\n5,416 $ 1,938\\n\\n4,111 $ 1,610\\n\\n— $ —\\n\\n29,143 $ 13,567\\n\\n2,094 $ 103\\n\\n— $ —\\n\\n31,237 13,670\\n\\nEquipment Other\\n\\n633 —\\n\\n564 —\\n\\n193 —\\n\\n234 —\\n\\n— 102\\n\\n1,624 102\\n\\n26 123\\n\\n— (72)\\n\\n1,650 153\\n\\nTOTAL REVENUES Revenues by:\\n\\n$\\n\\n18,353 $\\n\\n12,479 $\\n\\n7,547 $\\n\\n5,955 $\\n\\n102 $\\n\\n44,436 $\\n\\n2,346 $\\n\\n(72) $\\n\\n46,710\\n\\nSales to Wholesale Customers Sales through Direct to Consumer Other\\n\\n$\\n\\n9,621 $ 8,732 —\\n\\n8,377 $ 4,102 —\\n\\n4,081 $ 3,466 —\\n\\n3,529 $ 2,426 —\\n\\n— $ — 102\\n\\n25,608 $ 18,726 102\\n\\n1,292 $ 931 123\\n\\n— $ — (72)\\n\\n26,900 19,657 153\\n\\nTOTAL REVENUES\\n\\n$\\n\\n18,353 $\\n\\n12,479 $\\n\\n7,547 $\\n\\n5,955 $\\n\\n102 $\\n\\n44,436 $\\n\\n2,346 $\\n\\n(72) $\\n\\n46,710\\n\\n2023 FORM 10-K 83\\n\\nTable of Contents\\n\\nYEAR ENDED MAY 31, 2021\\n\\n(Dollars in millions)\\n\\nNORTH AMERICA\\n\\nEUROPE, MIDDLE EAST & AFRICA\\n\\nGREATER CHINA\"),\n", " 0.261225223541),\n", " (Document(metadata={'source': 'resources/nke-10k-2023.pdf', 'file_directory': 'resources', 'filename': 'nke-10k-2023.pdf', 'last_modified': '2026-03-20T15:56:42', 'page_number': 1, 'languages': ['eng'], 'filetype': 'application/pdf', 'category': 'CompositeElement', 'element_id': 'ee89578c33712bb26cf88ab00579fe6d'}, page_content='4,780 (508)\\n\\n7 % -80 %\\n\\nTOTAL NIKE BRAND WHOLESALE EQUIVALENT REVENUES\\n\\n$\\n\\n40,127 $\\n\\n36,151\\n\\n11 %\\n\\n18 % $\\n\\n35,770\\n\\n1 %\\n\\n(1)\\n\\nThe percent change excluding currency changes and the presentation of wholesale equivalent revenues represent non-GAAP financial measures. For further information, see \"Use of Non-GAAP Financial Measures\".\\n\\n(2) Global Brand Divisions revenues include NIKE Brand licensing and other miscellaneous revenues that are not part of a geographic operating segment.\\n\\n(3) Corporate revenues primarily consist of foreign currency hedge gains and losses related to revenues generated by entities within the NIKE Brand geographic operating segments and Converse, but\\n\\nmanaged through our central foreign exchange risk management program.\\n\\n(4)\\n\\nAs a result of the Consumer Direct Acceleration strategy, announced in fiscal 2021, the Company is now organized around a consumer construct of Men\\'s, Women\\'s and Kids\\'. Beginning in the first quarter of fiscal 2022, unisex products are classified within Men\\'s, and Jordan Brand revenues are separately reported. Certain prior year amounts were reclassified to conform to fiscal 2022 presentation. These changes had no impact on previously reported consolidated results of operations or shareholders\\' equity.\\n\\n(5) Others include products not allocated to Men\\'s, Women\\'s, NIKE Kids\\' and Jordan Brand, as well as certain adjustments that are not allocated to products designated by consumer.\\n\\n2023 FORM 10-K 32\\n\\n% CHANGE EXCLUDING CURRENCY (1) CHANGES\\n\\n4 % 6 %\\n\\n18 % 302 % 6 %\\n\\n7 % —\\n\\n6 %\\n\\n1 %\\n\\n15 % 302 %\\n\\n6 %\\n\\n1 % 7 % 1 %\\n\\n3 % 1 % 0 %\\n\\n7 % -79 %\\n\\n1 %\\n\\nTable of Contents\\n\\nFISCAL 2023 NIKE BRAND REVENUE HIGHLIGHTS The following tables present NIKE Brand revenues disaggregated by reportable operating segment, distribution channel and major product line:\\n\\nFISCAL 2023 COMPARED TO FISCAL 2022\\n\\nNIKE, Inc. Revenues were $51.2 billion in fiscal 2023, which increased 10% and 16% compared to fiscal 2022 on a reported and currency-neutral basis, respectively. The increase was due to higher revenues in North America, Europe, Middle East & Africa (\"EMEA\"), APLA and Greater China, which contributed approximately 7, 6, 2 and 1 percentage points to NIKE, Inc. Revenues, respectively.'),\n", " 0.283525764942),\n", " (Document(metadata={'source': 'resources/nke-10k-2023.pdf', 'file_directory': 'resources', 'filename': 'nke-10k-2023.pdf', 'last_modified': '2026-03-20T15:56:42', 'page_number': 1, 'languages': ['eng'], 'filetype': 'application/pdf', 'category': 'CompositeElement', 'element_id': 'ee89578c33712bb26cf88ab00579fe6d'}, page_content=\"ASIA PACIFIC & LATIN AMERICA\\n\\n(1)\\n\\nGLOBAL BRAND DIVISIONS\\n\\nTOTAL NIKE BRAND\\n\\nCONVERSE CORPORATE\\n\\nTOTAL NIKE, INC.\\n\\nRevenues by:\\n\\nFootwear Apparel Equipment\\n\\n$\\n\\n11,644 $ 5,028 507\\n\\n6,970 $ 3,996 490\\n\\n5,748 $ 2,347 195\\n\\n3,659 $ 1,494 190\\n\\n— $ — —\\n\\n28,021 $ 12,865 1,382\\n\\n1,986 $ 104 29\\n\\n— $ — —\\n\\n30,007 12,969 1,411\\n\\nOther\\n\\nTOTAL REVENUES\\n\\n$\\n\\n—\\n\\n17,179 $\\n\\n—\\n\\n11,456 $\\n\\n— 8,290 $\\n\\n— 5,343 $\\n\\n25 25 $\\n\\n25\\n\\n42,293 $\\n\\n86 2,205 $\\n\\n40 40 $\\n\\n151 44,538\\n\\nRevenues by:\\n\\nSales to Wholesale Customers $\\n\\n10,186 $\\n\\n7,812 $\\n\\n4,513 $\\n\\n3,387 $\\n\\n— $\\n\\n25,898 $\\n\\n1,353 $\\n\\n— $\\n\\n27,251\\n\\nSales through Direct to Consumer Other\\n\\n6,993 —\\n\\n3,644 —\\n\\n3,777 —\\n\\n1,956 —\\n\\n— 25\\n\\n16,370 25\\n\\n766 86\\n\\n— 40\\n\\n17,136 151\\n\\nTOTAL REVENUES\\n\\n$\\n\\n17,179 $\\n\\n11,456 $\\n\\n8,290 $\\n\\n5,343 $\\n\\n25 $\\n\\n42,293 $\\n\\n2,205 $\\n\\n40 $\\n\\n44,538\\n\\n(1) Refer to Note 18 — Acquisitions and Divestitures for additional information on the transition of the Company's NIKE Brand business in Brazil to a third-party distributor.\\n\\nFor the fiscal years ended May 31, 2023, 2022 and 2021, Global Brand Divisions revenues include NIKE Brand licensing and other miscellaneous revenues that are not part of a geographic operating segment. Converse Other revenues were primarily attributable to licensing businesses. Corporate revenues primarily consisted of foreign currency hedge gains and losses related to revenues generated by entities within the NIKE Brand geographic operating segments and Converse but managed through the Company's central foreign exchange risk management program.\\n\\nAs of May 31, 2023 and 2022, the Company did not have any contract assets and had an immaterial amount of contract liabilities recorded in Accrued liabilities on the Consolidated Balance Sheets.\\n\\nSALES-RELATED RESERVES\\n\\nAs of May 31, 2023 and 2022, the Company's sales-related reserve balance, which includes returns, post-invoice sales discounts and miscellaneous claims, was $994 million and $1,015 million, respectively, recorded in Accrued liabilities on the Consolidated Balance Sheets. The estimated cost of inventory for expected product returns was $226 million and $194 million as of May 31, 2023 and 2022, respectively, and was recorded in Prepaid expenses and other current assets on the Consolidated Balance Sheets.\\n\\nNOTE 15 — OPERATING SEGMENTS AND RELATED INFORMATION\"),\n", " 0.285882890224)]" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# filter results to a certain distance threshold\n", "rds.similarity_search_with_score(query=\"Nike company revenue\", k=4, distance_threshold=0.3)" ] }, { "cell_type": "markdown", "metadata": { "id": "XdzQa112Bf2b" }, "source": [ "## RAG with LangChain\n", "LangChain makes it easy to now take this vector store and build retireval augmented generation (RAG) applications over your data." ] }, { "cell_type": "markdown", "metadata": { "collapsed": false, "id": "CU2aFQPW1vmz", "jupyter": { "outputs_hidden": false } }, "source": [ "### Initialize OpenAI\n", "\n", "You need to supply an OpenAI API key (starts with `sk-...`) when prompted. If the key is in your env -- great, otherwise enter it when prompted below. You can find your API key at https://platform.openai.com/account/api-keys" ] }, { "cell_type": "code", "execution_count": 13, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "GSpH-cur1vmz", "outputId": "b00de5c7-1684-4e8e-c146-6d402910cdc5" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "OpenAI API Key: ········\n" ] } ], "source": [ "import getpass\n", "from langchain_openai import ChatOpenAI\n", "\n", "llm = ChatOpenAI(openai_api_key=os.getenv(\"OPENAI_API_KEY\") or getpass.getpass(prompt=\"OpenAI API Key:\"))" ] }, { "cell_type": "markdown", "metadata": { "id": "-SQXQB-c1vmz" }, "source": [ "### Setup prompt" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [], "source": [ "from langchain_core.output_parsers import StrOutputParser\n", "from langchain_core.prompts import ChatPromptTemplate\n", "from langchain_core.runnables import RunnablePassthrough\n", "\n", "prompt_template = \"\"\"\n", " Use the following pieces of context from financial 10k filings data to answer the user question at the end. \n", " If you don't know the answer, say that you don't know, don't try to make up an answer.\n", "\n", " Context:\n", " ---------\n", " {context}\n", " ---------\n", " Question:\n", " {question}\n", " Answer:\n", "\"\"\"\n", "\n", "def format_docs(docs):\n", " return \"\\n\\n\".join(doc.page_content for doc in docs)\n", "\n", "prompt = ChatPromptTemplate.from_template(prompt_template)" ] }, { "cell_type": "markdown", "metadata": { "id": "xgEXBujxG1dO" }, "source": [ "### Putting it all together\n", "\n", "This is where the Langchain brings all the components together in a form of a simple RAG application with the financial PDF document." ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [], "source": [ "rag_chain = (\n", " {\n", " \"context\": rds.as_retriever() | format_docs,\n", " \"question\": RunnablePassthrough()\n", " }\n", " | prompt\n", " | llm\n", " | StrOutputParser()\n", ")" ] }, { "cell_type": "markdown", "metadata": { "id": "SURTtVbYBFGc" }, "source": [ "### Finally - let's ask questions!\n", "\n" ] }, { "cell_type": "code", "execution_count": 16, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 52 }, "id": "0JkswfOHZu9h", "outputId": "813fffe6-3d8b-4df7-a035-c54e421c0856", "scrolled": true }, "outputs": [ { "data": { "text/plain": [ "\"Nike's revenue last year was $46,710 million, and this year it increased to $51,217 million.\"" ] }, "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ "query = \"What was Nike's revenue last year compared to this year??\"\n", "rag_chain.invoke(query)" ] }, { "cell_type": "code", "execution_count": 17, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 52 }, "id": "ZvioUduS1vm0", "outputId": "a8ba0e5d-c06b-4848-d066-c26884b3caee" }, "outputs": [ { "data": { "text/plain": [ "'Nike offers a range of products including athletic footwear, apparel, equipment, accessories, and services. While the exact number of products is not specified in the provided context, it is clear that Nike offers a diverse array of products across different categories. Nike is part of the athletic footwear, apparel, and equipment industry.'" ] }, "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ "query = \"How many products does Nike offer? What is the industry that Nike is part of?\"\n", "rag_chain.invoke(query)" ] }, { "cell_type": "code", "execution_count": 18, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 35 }, "id": "Q9mE5z-61vm1", "outputId": "e3860d3e-e68b-489b-9897-c7118377c7bb" }, "outputs": [ { "data": { "text/plain": [ "\"I don't know. This information does not provide details on Nike's ethical practices or behaviors. Ethical considerations are usually not directly addressed in financial filings.\"" ] }, "execution_count": 18, "metadata": {}, "output_type": "execute_result" } ], "source": [ "query = \"Is Nike an ethical company?\"\n", "rag_chain.invoke(query)" ] }, { "cell_type": "markdown", "metadata": { "id": "5itk4UPF1vm1" }, "source": [ "## Cleanup\n", "\n", "Cleanup the index and data." ] }, { "cell_type": "code", "execution_count": 22, "metadata": { "id": "DtZi-mQ61vm-" }, "outputs": [], "source": [ "from redisvl.index import SearchIndex\n", "\n", "idx = SearchIndex.from_existing(\n", " index_name,\n", " redis_url=REDIS_URL\n", ")\n", "\n", "idx.delete()" ] }, { "cell_type": "code", "execution_count": 19, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'0.16.0'" ] }, "execution_count": 19, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import redisvl\n", "\n", "redisvl.__version__" ] }, { "cell_type": "code", "execution_count": 20, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'7.4.0'" ] }, "execution_count": 20, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import redis\n", "\n", "redis.__version__" ] }, { "cell_type": "code", "execution_count": 21, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'redis://:@localhost:6379'" ] }, "execution_count": 21, "metadata": {}, "output_type": "execute_result" } ], "source": [ "REDIS_URL" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "accelerator": "GPU", "colab": { "gpuType": "T4", "provenance": [] }, "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.12.5" } }, "nbformat": 4, "nbformat_minor": 4 }