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

Improve literal format adherence in ChatAdapter, JSONAdapter #1955

Merged
merged 14 commits into from
Jan 12, 2025

Conversation

dbczumar
Copy link
Collaborator

@dbczumar dbczumar commented Dec 18, 2024

Improve literal format adherence in ChatAdapter

Testing

Confirmed that existing reliability tests pass with GPT-4o and Llama3.1 70B Instruct

Signed-off-by: dbczumar <corey.zumar@databricks.com>
Signed-off-by: dbczumar <corey.zumar@databricks.com>
Signed-off-by: dbczumar <corey.zumar@databricks.com>
@dbczumar dbczumar marked this pull request as ready for review January 9, 2025 23:43
@dbczumar dbczumar changed the title Improve literal format adherence in ChatAdapter Improve literal format adherence in ChatAdapter, JSONAdapter Jan 9, 2025
Signed-off-by: dbczumar <corey.zumar@databricks.com>
Signed-off-by: dbczumar <corey.zumar@databricks.com>
Signed-off-by: dbczumar <corey.zumar@databricks.com>
Signed-off-by: dbczumar <corey.zumar@databricks.com>
Signed-off-by: dbczumar <corey.zumar@databricks.com>
Signed-off-by: dbczumar <corey.zumar@databricks.com>
Signed-off-by: dbczumar <corey.zumar@databricks.com>
Signed-off-by: dbczumar <corey.zumar@databricks.com>
Signed-off-by: dbczumar <corey.zumar@databricks.com>
Signed-off-by: dbczumar <corey.zumar@databricks.com>
Signed-off-by: dbczumar <corey.zumar@databricks.com>

if origin is Literal:
args_str = ", ".join(
_quoted_string_for_literal_type_annotation(a) if isinstance(a, str) else get_annotation_name(a)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@okhat This is slightly trickier than using repr(), since repr() inserts undesired backslashes that are likely to confuse an LM. I think the approach proposed in the PR should hopefully reduce LM confusion with strings containing quotes

@okhat okhat merged commit 26850ac into stanfordnlp:main Jan 12, 2025
4 checks passed
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.

2 participants