mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-08-28 10:49:56 +02:00
move tip
This commit is contained in:
+10
-10
@@ -12,6 +12,16 @@
|
||||
- **Runtime context**: Data scoped to a single run or invocation
|
||||
- **Cross-conversation context**: Data that persists across multiple conversations or sessions
|
||||
|
||||
!!! tip "Runtime context vs LLM context"
|
||||
|
||||
Runtime context refers to local context: data and dependencies your code needs to run. It does **not** refer to:
|
||||
|
||||
* The LLM context, which is the data passed into the LLM's prompt.
|
||||
* The "context window", which is the maximum number of tokens that can be passed to the LLM.
|
||||
|
||||
Runtime context can be used to optimize the LLM context. For example, you can use user metadata
|
||||
in the runtime context to fetch user preferences and feed them into the context window.
|
||||
|
||||
LangGraph provides three ways to manage context, which combines the mutability and lifetime dimensions:
|
||||
|
||||
| Context type | Description | Mutability | Lifetime | Access method |
|
||||
@@ -29,16 +39,6 @@ LangGraph provides three ways to manage context, which combines the mutability a
|
||||
Runtime context is now passed to the `context` argument of `invoke`/`stream`,
|
||||
which replaces the previous pattern of passing application configuration to `config['configurable']`.
|
||||
|
||||
!!! tip "Runtime context vs LLM context"
|
||||
|
||||
Runtime context refers to local context: data and dependencies your code needs to run. It does **not** refer to:
|
||||
|
||||
* The LLM context, which is the data passed into the LLM's prompt.
|
||||
* The "context window", which is the maximum number of tokens that can be passed to the LLM.
|
||||
|
||||
Runtime context can be used to optimize the LLM context. For example, you can use user metadata
|
||||
in the runtime context to fetch user preferences and feed them into the context window.
|
||||
|
||||
```python
|
||||
@dataclass
|
||||
class ContextSchema:
|
||||
|
||||
Reference in New Issue
Block a user