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

removing classname before the json structure #844

Merged
merged 2 commits into from Mar 28, 2024

Conversation

tenpigs267
Copy link
Contributor

Context

This PR remove the classname that had been added in front of json structure in ServiceOutputParser as discusser here : #625 (comment)

Change

just removing the unwanted classname

@tenpigs267 tenpigs267 marked this pull request as draft March 27, 2024 12:52
@tenpigs267 tenpigs267 marked this pull request as ready for review March 27, 2024 14:49
Copy link
Owner

@langchain4j langchain4j left a comment

Choose a reason for hiding this comment

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

@tenpigs267 thanks a lot!
I guess we should also make parsing JSON more robust, like extracting json from backticks (if present), removing garbage before/after curly braces, etc

@langchain4j langchain4j merged commit 2f417ce into langchain4j:main Mar 28, 2024
6 checks passed
@tenpigs267
Copy link
Contributor Author

@tenpigs267 thanks a lot! I guess we should also make parsing JSON more robust, like extracting json from backticks (if present), removing garbage before/after curly braces, etc

yes removing backticks and unwanted comment around the doc could be a nice enhancement. I mainly use OpenAI and not sure if backticks is a common llm usage. That kind of code should be highly customisable for the library users so that it can adapt to a lot of situations...

From the prompt side we can also increase reliability by adding a JSON output example (OpenAI works well without it but it is a common technique to improve reliability of the output)

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.

None yet

2 participants