Skip to content

Commit f890f35

Browse files
Apply spec review polish to patterns
Pattern 1: clarify the router lambda's inline comment so a reader who lands mid-snippet without the surrounding prose still sees the intent. Pattern 3: switch state messages to list[Message] for consistency with pattern 2, add the Message import, and use attribute access (.content) rather than dict subscript at the read site. Per spec review on PR #67.
1 parent f12a115 commit f890f35

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

docs/patterns/parameterized-entry-point.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def report(s: MissionState) -> dict:
4848

4949
builder = (
5050
GraphBuilder(MissionState)
51-
.add_node("router", lambda s: {}) # passthrough; routes from state
51+
.add_node("router", lambda s: {}) # no state change; conditional edge below routes
5252
.add_node("plan", plan)
5353
.add_node("execute", execute)
5454
.add_node("report", report)

docs/patterns/session-as-checkpoint-resume.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,11 @@ across resume).
2828
from typing import Annotated
2929
from openarmature.checkpoint import SQLiteCheckpointer
3030
from openarmature.graph import END, GraphBuilder, State, append, merge
31+
from openarmature.llm import Message
3132

3233

3334
class SessionState(State):
34-
messages: Annotated[list[dict], append] = []
35+
messages: Annotated[list[Message], append] = []
3536
facts: Annotated[dict[str, str], merge] = {}
3637
last_user_input: str = ""
3738

@@ -73,7 +74,7 @@ async def handle_turn(session_id: str, user_input: str) -> str:
7374
# correlation_id; exact lookup is application-side bookkeeping.
7475
sessions_db.set_invocation_id(session_id, latest_for(session_id))
7576

76-
return final.messages[-1]["content"]
77+
return final.messages[-1].content
7778
```
7879

7980
`sessions_db` is your application's session-state store (Postgres,

0 commit comments

Comments
 (0)