Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various small changes #1268

Merged
merged 1 commit into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions libs/langgraph/langgraph/pregel/loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,10 @@ def _put_checkpoint(self, metadata: CheckpointMetadata) -> None:
k: v
for k, v in channel_versions.items()
if k not in self.checkpoint_previous_versions
or k in self.checkpoint_previous_versions
and v > self.checkpoint_previous_versions[k]
or (
k in self.checkpoint_previous_versions
and v > self.checkpoint_previous_versions[k]
)
}
else:
new_versions = channel_versions
Expand Down
20 changes: 14 additions & 6 deletions libs/langgraph/tests/test_pregel.py
Original file line number Diff line number Diff line change
Expand Up @@ -7452,12 +7452,20 @@ def down(state: State):

assert app.get_graph().draw_mermaid(with_styles=False) == snapshot
assert app.invoke({"my_key": "my_value"}) == {"my_key": "my_value_more"}
assert [*app.stream({"my_key": "my_value"})] == [
{"up": None},
{"side": None},
{"other": {"my_key": "_more"}},
{"down": None},
]
assert [*app.stream({"my_key": "my_value"})] in (
[
{"up": None},
{"side": None},
{"other": {"my_key": "_more"}},
{"down": None},
],
[
{"up": None},
{"other": {"my_key": "_more"}},
{"side": None},
{"down": None},
],
)


def test_nested_graph_xray(snapshot: SnapshotAssertion) -> None:
Expand Down
2 changes: 1 addition & 1 deletion libs/sdk-js/src/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export interface Config {
/**
* Timestamp of the state checkpoint
*/
thread_ts?: string;
checkpoint_id?: string;
[key: string]: unknown;
};
}
Expand Down
8 changes: 5 additions & 3 deletions libs/sdk-py/langgraph_sdk/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,8 @@ async def get_state(
'configurable':
{
'thread_id': 'e2496803-ecd5-4e0c-a779-3226296181c2',
'thread_ts': '1ef4a9b8-e6fb-67b1-8001-abd5184439d1'
'checkpoint_ns': '',
'checkpoint_id': '1ef4a9b8-e6fb-67b1-8001-abd5184439d1'
}
},
'metadata':
Expand Down Expand Up @@ -822,7 +823,8 @@ async def get_state(
'configurable':
{
'thread_id': 'e2496803-ecd5-4e0c-a779-3226296181c2',
'thread_ts': '1ef4a9b8-d80d-6fa7-8000-9300467fad0f'
'checkpoint_ns': '',
'checkpoint_id': '1ef4a9b8-d80d-6fa7-8000-9300467fad0f'
}
}
}
Expand Down Expand Up @@ -1184,7 +1186,7 @@ async def create(
'user_id': None,
'graph_id': 'agent',
'thread_id': 'my_thread_id',
'thread_ts': None,
'checkpoint_id': None,
'model_name': "openai",
'assistant_id': 'my_assistant_id'
}
Expand Down
Loading