fix: refactor code and update init_params in debug_state#317
Conversation
Pull Request Test Coverage Report for Build 15613105327Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
|
I would ignore the failing tests caused due to type mismatch of |
|
Same for adding all the Answer dataclasses. Is it just for having the new |
|
Yes the new |
Okay I gotcha. Would it be possible then to only bring over GeneratedAnswer and not all of the other answer data classes if they aren’t needed? Also it’d be great if you could inherit from the haystack GeneratedAnswer and only add the code you have to. You can see how we did this for ChatMessage in this repo as well. |
Right, I can do that. I initially added it as-is since I didn’t want to spend too much time patching GeneratedAnswer, given that it's going to be merged eventually. Just a heads-up — I might also need to add the AnswerJoiner to avoid the failing tests caused by mismatches. |
|
@Amnah199 it looks like the errors are Connection errors from Pipeline. We have an option in pipeline’s init that lets your turn off the connection validation. So then these errors should go away. |
|
|
||
| Raises a PipelineRuntimeError if any component is missing or if the state structure is invalid. | ||
|
|
||
| :param resume_state: The saved state to validate. |
There was a problem hiding this comment.
In the docstring could we mention what keys are expected in resume_state?
| logger.info("Passed resume state validated successfully.") | ||
|
|
||
|
|
||
| def load_state(file_path: Union[str, Path]) -> Dict[str, Any]: |
There was a problem hiding this comment.
Especially since we have State in Agent now I think we should think about a more specific name than state in the function name. I see in the docs we call it "pipeline state", but I believe we are really loading a dict with keys "input_data", "pipeline_breakpoint", "pipeline_state" so it feels a bit odd to call the whole thing pipeline_state if there is a key called pipeline_state inside.
Do you have an idea on some better namings we could use?
There was a problem hiding this comment.
We can stick to calling it debug_state or we consistently us resume_state internally so we can also keep that. WDYT?
There was a problem hiding this comment.
Maybe something different altogether like pipeline_snapshot?
There was a problem hiding this comment.
Hmm if we opt for this then we should consistently use pipeline_snapshot instead of state everywhere. Including the resume_state param for run method
There was a problem hiding this comment.
I think this could make sense. I believe pipeline_snapshot is more informative than resume_state which from it's name sounds like it should be a boolean
Co-authored-by: Sebastian Husch Lee <10526848+sjrl@users.noreply.github.com>
Co-authored-by: Sebastian Husch Lee <10526848+sjrl@users.noreply.github.com>
Co-authored-by: Sebastian Husch Lee <10526848+sjrl@users.noreply.github.com>
Co-authored-by: Sebastian Husch Lee <10526848+sjrl@users.noreply.github.com>
| Validates the pipeline_breakpoint passed to the pipeline. | ||
|
|
||
| Make sure they are all valid components registered in the pipeline, | ||
| Makes sure the breakpoint contains a valid components registered in the pipeline. |
There was a problem hiding this comment.
| Makes sure the breakpoint contains a valid components registered in the pipeline. | |
| Makes sure the breakpoint contains a valid component registered in the pipeline. |
sjrl
left a comment
There was a problem hiding this comment.
One small comment, otherwise looks good!
Related Issues
Proposed Changes:
remove_unserializable_datamethod (not needed after this PR is merged)debug_state. This was removed for simplicity while converging with haystack/main.How did you test it?
Ran the tests
Notes for the reviewer
I would prefer to merge this PR before continuing with serialization on a separate one here. A single PR would be too jumbled.
Checklist
fix:,feat:,build:,chore:,ci:,docs:,style:,refactor:,perf:,test:.