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

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

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 <[email protected]>
Signed-off-by: dbczumar <[email protected]>
Signed-off-by: dbczumar <[email protected]>
@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 <[email protected]>
Signed-off-by: dbczumar <[email protected]>
Signed-off-by: dbczumar <[email protected]>
Signed-off-by: dbczumar <[email protected]>
Signed-off-by: dbczumar <[email protected]>
Signed-off-by: dbczumar <[email protected]>
Signed-off-by: dbczumar <[email protected]>
Signed-off-by: dbczumar <[email protected]>
Signed-off-by: dbczumar <[email protected]>
Signed-off-by: dbczumar <[email protected]>
Signed-off-by: dbczumar <[email protected]>

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

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.

1 participant