add more about context limits

This commit is contained in:
Alexander Bricken
2025-05-26 22:42:50 -04:00
parent 740073e41c
commit 68101cbaf3

View File

@@ -34,7 +34,7 @@
"\n",
"#### Why do we need to manage memory?\n",
"\n",
"LLMs have finite context windows (200k tokens for Claude 4 Sonnet & Opus). Tactically, this means that any request greater than 200k tokens won't work. As many teams building with LLMs quickly learn, there is additional complexity in identifying and working within the *effective* [context window](https://docs.anthropic.com/en/docs/build-with-claude/context-windows) of an LLM. See our tips for [long context prompting](https://docs.anthropic.com/en/docs/build-with-claude/prompt-engineering/long-context-tips) to learn more about effective context windows and best practices.\n",
"LLMs have finite context windows (200k tokens for Claude 4 Sonnet & Opus). Tactically, this means that any request if the sum of prompt tokens and output tokens exceeds the models context window, the system will return a validation error. As many teams building with LLMs quickly learn, there is additional complexity in identifying and working within the *effective* [context window](https://docs.anthropic.com/en/docs/build-with-claude/context-windows) of an LLM. See our tips for [long context prompting](https://docs.anthropic.com/en/docs/build-with-claude/prompt-engineering/long-context-tips) to learn more about effective context windows and best practices.\n",
"\n",
"In addition to the above, memory is important for the following reasons:\n",
"- **Context windows are a moving target:** Even if we could build infinitely long context windows, they'd never be enough—the real world produces far more data than any window can hold. When we expand from 200k to 2M tokens, users immediately need 20M for their growing codebases, longer conversations, and larger document collections.\n",
@@ -91,9 +91,30 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": "import sys \nimport os\n\n# Check if the repo already exists\nif not os.path.exists('/tmp/anthropic-quickstarts'):\n # Clone the agents quickstart implementation\n !git clone https://github.com/anthropics/anthropic-quickstarts.git /tmp/anthropic-quickstarts\nelse:\n print(\"Repository already exists at /tmp/anthropic-quickstarts\")\n\n# IMPORTANT: Insert at the beginning of sys.path to override any existing 'agents' modules\nif '/tmp/anthropic-quickstarts' not in sys.path:\n sys.path.insert(0, '/tmp/anthropic-quickstarts')\n\n# Clear any cached imports of 'agents' module\nif 'agents' in sys.modules:\n del sys.modules['agents']\nif 'agents.agent' in sys.modules:\n del sys.modules['agents.agent']"
"source": [
"import sys \n",
"import os\n",
"\n",
"# Check if the repo already exists\n",
"if not os.path.exists('/tmp/anthropic-quickstarts'):\n",
" # Clone the agents quickstart implementation\n",
" !git clone https://github.com/anthropics/anthropic-quickstarts.git /tmp/anthropic-quickstarts\n",
"else:\n",
" print(\"Repository already exists at /tmp/anthropic-quickstarts\")\n",
"\n",
"# IMPORTANT: Insert at the beginning of sys.path to override any existing 'agents' modules\n",
"if '/tmp/anthropic-quickstarts' not in sys.path:\n",
" sys.path.insert(0, '/tmp/anthropic-quickstarts')\n",
"\n",
"# Clear any cached imports of 'agents' module\n",
"if 'agents' in sys.modules:\n",
" del sys.modules['agents']\n",
"if 'agents.agent' in sys.modules:\n",
" del sys.modules['agents.agent']"
]
},
{
"cell_type": "markdown",
@@ -1014,4 +1035,4 @@
},
"nbformat": 4,
"nbformat_minor": 2
}
}