-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
fix: ChatPromptBuilder Fails to JSON Serialize #7849
Conversation
Pull Request Test Coverage Report for Build 9489988243Details
💛 - Coveralls |
Pull Request Test Coverage Report for Build 9499141713Warning: 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 do not know if this is the place for this, but I've found a doc string on 'ChatPromptTemplate' that is misleading:
I believe that, when reading it, it means that if 'required_variables' argument is not provided the function fails, but instead it means that the run method raises an exception if some of those variables is not provided. Should I fix this one here or open another PR for it. |
Pull Request Test Coverage Report for Build 9506510225Details
💛 - Coveralls |
Pull Request Test Coverage Report for Build 9506509369Details
💛 - Coveralls |
Pull Request Test Coverage Report for Build 9506565575Details
💛 - Coveralls |
Pull Request Test Coverage Report for Build 9506715329Details
💛 - Coveralls |
Pull Request Test Coverage Report for Build 9527200328Warning: 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 |
Pull Request Test Coverage Report for Build 9528525456Details
💛 - Coveralls |
Pull Request Test Coverage Report for Build 9566152365Details
💛 - Coveralls |
Pull Request Test Coverage Report for Build 9566276770Details
💛 - Coveralls |
Do not know why tests fail 🫠, will work on it later. |
seems to be just a linting issue |
@davidsbatista how can I solve that? I used the pre-commit hooks and they all passed. |
I suspect updating the branch might fixe it |
seems like this file |
|
You need to make sure you have the same Hatch version as the CI. Ensure it is 1.9.3, Newer versions will produce inconsistent results. |
Pull Request Test Coverage Report for Build 9587909214Details
💛 - Coveralls |
Pull Request Test Coverage Report for Build 9587996856Details
💛 - Coveralls |
It seems that this change is not in the v2.2.3? I downloaded the source code and noticed that the ChatMessage as well as ChatPromptBuilder class doesn't have 'to_dict' and 'from_dict' functions. Is it expected...? |
Also, I noticed that there's no default value for optional input "name". When using the "from_dict" function in ChatMessage, it would complain "name" is missing in initialization. |
Related Issues
ChatPromptBuilder
Fails to JSON Serialize due toChatMessage
class #7844Proposed Changes:
The bug was caused by the 'ChatMessage' class not being serialized correctly, which led to a failure in the serialization of 'ChatPromptTemplate'. To resolve this issue, 'to_dict' and 'from_dict' methods were added to both classes, ensuring proper serialization.
How did you test it?
Added testing for all the new methods and reproduced the scenario presented on #7844 , it works fine now
Notes for the reviewer
Checklist
fix:
,feat:
,build:
,chore:
,ci:
,docs:
,style:
,refactor:
,perf:
,test:
. ✅