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

Export Annotation etc from root #299

Merged
merged 2 commits into from
Aug 6, 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
3 changes: 3 additions & 0 deletions langgraph/src/graph/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@ export {
type StateGraphArgs,
StateGraph,
type CompiledStateGraph,
Annotation,
type StateType,
type UpdateType,
} from "./state.js";
export { MessageGraph, messagesStateReducer } from "./message.js";
8 changes: 4 additions & 4 deletions langgraph/src/graph/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ type ExtractUpdateType<C> = C extends BaseChannel
? ReturnType<C>["UpdateType"]
: never;

export type StateInterface<S extends StateDefinition> = {
export type StateType<S extends StateDefinition> = {
[key in keyof S]: ExtractValueType<S[key]>;
};

export type UpdateInterface<S extends StateDefinition> = {
export type UpdateType<S extends StateDefinition> = {
[key in keyof S]?: ExtractUpdateType<S[key]>;
};

Expand Down Expand Up @@ -95,8 +95,8 @@ export interface StateGraphArgs<Channels extends object | unknown> {

export class StateGraph<
SD extends StateDefinition | unknown,
S = SD extends StateDefinition ? StateInterface<SD> : SD,
U = SD extends StateDefinition ? UpdateInterface<SD> : Partial<S>,
S = SD extends StateDefinition ? StateType<SD> : SD,
U = SD extends StateDefinition ? UpdateType<SD> : Partial<S>,
N extends string = typeof START
> extends Graph<N, S, U> {
channels: Record<string, BaseChannel>;
Expand Down
3 changes: 3 additions & 0 deletions langgraph/src/web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ export {
type CompiledStateGraph,
MessageGraph,
messagesStateReducer,
Annotation,
type StateType,
type UpdateType,
} from "./graph/index.js";
export { MemorySaver } from "./checkpoint/memory.js";
export {
Expand Down
Loading