Skip to content

Commit

Permalink
Export Annotation etc from root (#299)
Browse files Browse the repository at this point in the history
* Export Annotation etc from root

* Fix
  • Loading branch information
nfcampos authored Aug 6, 2024
1 parent d3080bd commit 3ea5202
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
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

0 comments on commit 3ea5202

Please sign in to comment.