Eden: Hey there, Eden here.
And in this video we're going to define our graph state,
which is going to be passed around
during our nodes execution.
And this is going to be a short video
because it's pretty straightforward.
And as always, if you want to get the exact code for
what we're going to be writing in this video,
feel free to check out the Github branch of 4-state.
Alrighty, let's go to state.py and we want to start
with the imports and we'll import list and TypeDict.
And let's create the class of GraphState
which will inherit from TypeDict.
And this will include all the state that we need
for the graph execution.
And let's discuss before we implement.
Of course, we want to have the question in our state,
because we always want to reference it,
whether to determine if the documents retrieved are relevant
to the question or even to what's to search online.
We want to save the documents that are going
to help us answer this question.
So those are going to be the retrieved documents
or the documents that we get back from the search result.
And for that we're going to be saving
in a list of documents.
We want to have a Boolean flag
that will tell us whether we need to search online
for extra results or not.
And of course we want to have the generation field,
which is going to be the generated answer.
Alrighty, let's go and let's define those attributes.
So question is going to be a string, generation is going
to be a string, web search is going to be a Boolean.
And finally, documents is going to be a list of strings,
which is going to be a list of the content
of those documents.
And that's pretty much it. That's our state.
And if you want to check out the exact code, you are welcome
to go to the GitHub repository,
and go and look for the branch 4-state.
So you can see that under graph we have the state.py file,
and this is the implementation.