mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-27 00:48:45 +00:00
docs: fix trim_messages code blocks (#23271)
This commit is contained in:
parent
86326269a1
commit
9eda8f2fe8
@ -696,7 +696,6 @@ def trim_messages(
|
|||||||
HumanMessage("This is a 4 token text. The full message is 10 tokens.", id="third"),
|
HumanMessage("This is a 4 token text. The full message is 10 tokens.", id="third"),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
Last 40 tokens, including system message, allowing partial messages, start on HumanMessage:
|
Last 40 tokens, including system message, allowing partial messages, start on HumanMessage:
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
@ -717,31 +716,6 @@ def trim_messages(
|
|||||||
HumanMessage("This is a 4 token text. The full message is 10 tokens.", id="third"),
|
HumanMessage("This is a 4 token text. The full message is 10 tokens.", id="third"),
|
||||||
AIMessage("This is a 4 token text. The full message is 10 tokens.", id="fourth"),
|
AIMessage("This is a 4 token text. The full message is 10 tokens.", id="fourth"),
|
||||||
]
|
]
|
||||||
|
|
||||||
Using a TextSplitter for splitting parting messages:
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
...
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
...
|
|
||||||
|
|
||||||
Using a model for token counting:
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
...
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
...
|
|
||||||
|
|
||||||
Chaining:
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
...
|
|
||||||
|
|
||||||
|
|
||||||
""" # noqa: E501
|
""" # noqa: E501
|
||||||
from langchain_core.language_models import BaseLanguageModel
|
from langchain_core.language_models import BaseLanguageModel
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user