Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@xiaoyi-cheng
Copy link
Contributor

Issue #, if available:
Currently GeneratePrompt transform can only substitute default placeholder $model_input with data field.
This PR will support placeholder_data_dict (#273)

Description of changes:
placeholder_keys_dict will be placeholder keys to input keys mapping, but in this way it only supports transform 1 prompt with one placeholder dict. See unit test for use case

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@xiaoyi-cheng xiaoyi-cheng requested a review from danielezhu June 7, 2024 18:29
@xiaoyi-cheng xiaoyi-cheng requested a review from oyangz June 8, 2024 00:37
@xiaoyi-cheng xiaoyi-cheng merged commit 1b356df into aws:main Jun 10, 2024
@xiaoyi-cheng xiaoyi-cheng deleted the prompttransform branch June 10, 2024 16:02
oyangz added a commit that referenced this pull request Jun 11, 2024
* feat: add SaveStrategy to allow flexibility in saving localized evaluation outputs (#281)

* feat: modify GeneratePrompt transform to take placeholder_dict (#288)

* feat: modify GeneratePrompt transform to take placeholder_dict

* fix: unit test

* fix: requested changes

---------

Co-authored-by: keerthanvasist <[email protected]>
Co-authored-by: Xiaoyi Cheng <[email protected]>
Copy link
Contributor

@danielezhu danielezhu left a comment

Choose a reason for hiding this comment

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

Hey @xiaoyi-cheng, I missed this small detail when reviewing your PR last week. I added a comment for record-keeping purposes. I'll submit a PR to fix this soon.

"""
super().__init__(input_keys, output_keys, prompt_template)
super().__init__(input_keys, output_keys, prompt_template, placeholder_to_record_key)
self.register_input_output_keys(input_keys, output_keys)
Copy link
Contributor

Choose a reason for hiding this comment

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

Shoot, I didn't catch this before the PR got merged, but we will need to update the call to self.register_input_output_keys to handle the case where placeholder_to_record_key is non-null.

input_keys_to_register = list(placeholder_to_record_keys.values()) if placeholder_to_record_key else input_keys
self.register_input_output_keys(input_keys_to_register, output_keys)

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.

3 participants