mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-22 23:00:00 +00:00
parent
4c97a9ee53
commit
86326269a1
@ -7,6 +7,19 @@
|
||||
"source": [
|
||||
"# How to trim messages\n",
|
||||
"\n",
|
||||
":::info Prerequisites\n",
|
||||
"\n",
|
||||
"This guide assumes familiarity with the following concepts:\n",
|
||||
"\n",
|
||||
"- [Messages](/docs/concepts/#messages)\n",
|
||||
"- [Chat models](/docs/concepts/#chat-models)\n",
|
||||
"- [Chaining](/docs/how_to/sequence/)\n",
|
||||
"- [Chat history](/docs/concepts/#chat-history)\n",
|
||||
"\n",
|
||||
"The methods in this guide also require `langchain-core>=0.2.9`.\n",
|
||||
"\n",
|
||||
":::\n",
|
||||
"\n",
|
||||
"All models have finite context windows, meaning there's a limit to how many tokens they can take as input. If you have very long messages or a chain/agent that accumulates a long message is history, you'll need to manage the length of the messages you're passing in to the model.\n",
|
||||
"\n",
|
||||
"The `trim_messages` util provides some basic strategies for trimming a list of messages to be of a certain token length.\n",
|
||||
|
Loading…
Reference in New Issue
Block a user