content: LangGraph learn log
All checks were successful
Build and Deploy Quartz / build-and-deploy (push) Has been skipped

This commit is contained in:
2026-02-19 21:51:18 +08:00
parent 6f1837415e
commit dd72085114

View File

@@ -0,0 +1,47 @@
---
date: 2026-02-19
---
I need to learn LangGraph because of my graduation project. It's about an LLM-based SQL tools, including features like SQL generation, explain and optimize.
This file serve as a log for my learning process.
# Todo
- [ ] Explore `pydantic` usage with LangGraph
- [ ] Learn about Streaming in LangGraph (brief)
# Log
## 2.19
It seems that we should at least use `TypedDict` as the basic scaffold. We need a structure that support partial update.
Maybe we could use a state wrapper like below:
```python
class MyState(BaseModel):
"""
The actual state class I want to use. In another word,
this is where the actual data stored.
"""
pass
class State(TypedDict):
"""
The state used by LangGraph. Serve as a wrapper.
"""
state:
def some_lang_graph_node_func(wrapper: State):
# parse the actual state
st = MyState(wrapper.state)
# some operations
return Command(
update={state: st}
)
```
> [!note]
>
> After discussing with AI, it seems `pydantic` will work with LangGraph. More research and experiments needed.