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

prompt_builder: add list of header files in code fixing prompt #318

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

DavidKorczynski
Copy link
Collaborator

No description provided.

Signed-off-by: David Korczynski <david@adalogics.com>
Signed-off-by: David Korczynski <david@adalogics.com>
Signed-off-by: David Korczynski <david@adalogics.com>
@DavidKorczynski
Copy link
Collaborator Author

/gcbrun exp -n dk1007

with open(HEADER_FIXER_PROMPT, 'r') as f:
header_avoid_string = f.read()
for header_file in headers_to_avoid:
header_avoid_string += '- %s\n' % (os.path.basename(header_file))
Copy link
Collaborator

Choose a reason for hiding this comment

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

f-string, please :)

@@ -297,6 +299,17 @@ def _format_fixer_problem(self, raw_code: str, error_desc: Optional[str],
else:
# Build error does not pass error desc.
error_summary = BUILD_ERROR_SUMMARY
headers_to_avoid = introspector.query_introspector_header_files(
benchmark.project)
if len(headers_to_avoid) > 0:
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: if headers_to_avoid: for simplicity

@@ -83,6 +85,7 @@ def set_introspector_endpoints(endpoint):
INTROSPECTOR_FUNC_SIG = f'{INTROSPECTOR_ENDPOINT}/function-signature'
INTROSPECTOR_ADDR_TYPE = (
f'{INTROSPECTOR_ENDPOINT}/addr-to-recursive-dwarf-info')
INTROSPECTOR_ALL_HEADER_FILES = (f'{INTROSPECTOR_ENDPOINT}/all-header-files')
Copy link
Collaborator

Choose a reason for hiding this comment

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

no need for () if this fits into one line.

@@ -46,6 +46,7 @@
'jansi_colors-problem.txt')
FDP_JVM_EXAMPLE_2_SOLUTION = os.path.join(EXAMPLE_PATH,
'jansi_colors-solution.java')
HEADER_FIXER_PROMPT = os.path.join(DEFAULT_TEMPLATE_DIR, 'header_fixer.txt')
Copy link
Collaborator

Choose a reason for hiding this comment

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

Did you add this file yet?

@DavidKorczynski
Copy link
Collaborator Author

I'll put this on hold for a few days @DonggeLiu as I think it can be improved but it takes a bit of experimentation.

@DavidKorczynski DavidKorczynski marked this pull request as draft June 13, 2024 21:01
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