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

feat(graph): passthrough input types to invoke/stream #650

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

dqbd
Copy link
Contributor

@dqbd dqbd commented Nov 1, 2024

Opting to fix output types in a different PR due to the complexity of streamMode

Closes #628

nfcampos
nfcampos previously approved these changes Nov 2, 2024
> {
declare NodeType: N;

declare RunInput: RunInput;
declare RunInput: State;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a little strange that RunInput = StateType<SD>, I think we should change it to Update?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea I agree, this looks to be the other way around, no? input should be update, output should be based on stream mode (sometimes update, sometimes state, etc)

const workflow = new StateGraph<AgentState>({
channels: schema,
})
const workflow = new StateGraph(MessagesAnnotation)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is done primarily to get the correct input types (based off the messagesReducer, but open to different solutions.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's good to make this change, the other syntax is deprecated

@@ -3541,6 +3541,7 @@ export function runPregelTests(
hello: "there",
bye: "world",
messages: ["hello"],
// @ts-expect-error This should emit a TS error
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can now actually catch excessive keys!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ha nice!

@dqbd dqbd changed the title feat(graph): passthrough input and output types to invoke/stream feat(graph): passthrough input types to invoke/stream Nov 4, 2024
@dqbd dqbd requested a review from jacoblee93 November 4, 2024 15:26
@dqbd dqbd marked this pull request as ready for review November 4, 2024 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Typesafe graph.invoke?
2 participants