Skip to content

Commit c1b425b

Browse files
authored
Clean up imports in short-term-memory.mdx (#1182)
## Overview Removed unused import statements for AnyMessage and AgentState in [dynamic prompt example ](https://docs.langchain.com/oss/python/langchain/short-term-memory#prompt) ## Type of change **Type:** Fix formatting ## Checklist <!-- Put an 'x' in all boxes that apply --> - [x] I have read the [contributing guidelines](README.md) - [ ] I have tested my changes locally using `docs dev` - [x] All code examples have been tested and work correctly - [ ] I have used **root relative** paths for internal links - [ ] I have updated navigation in `src/docs.json` if needed - I have gotten approval from the relevant reviewers - (Internal team members only / optional) I have created a preview deployment using the [Create Preview Branch workflow](https://github.com/langchain-ai/docs/actions/workflows/create-preview-branch.yml) ## Additional notes <!-- Any other information that would be helpful for reviewers -->
1 parent f9d9d3f commit c1b425b

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/oss/langchain/short-term-memory.mdx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -781,17 +781,15 @@ Access short term memory (state) in middleware to create dynamic prompts based o
781781

782782
:::python
783783
```python
784-
from langchain.messages import AnyMessage
785-
from langchain.agents import create_agent, AgentState
784+
from langchain.agents import create_agent
786785
from typing import TypedDict
786+
from langchain.agents.middleware import dynamic_prompt, ModelRequest
787787

788788

789789
class CustomContext(TypedDict):
790790
user_name: str
791791

792792

793-
from langchain.agents.middleware import dynamic_prompt, ModelRequest
794-
795793
def get_weather(city: str) -> str:
796794
"""Get the weather in a city."""
797795
return f"The weather in {city} is always sunny!"
@@ -817,6 +815,7 @@ result = agent.invoke(
817815
)
818816
for msg in result["messages"]:
819817
msg.pretty_print()
818+
820819
```
821820

822821
```shell title="Output"

0 commit comments

Comments
 (0)