Skip to content

MAINT: Allow custom Likert system prompt and scale#1514

Open
jsong468 wants to merge 2 commits intoAzure:mainfrom
jsong468:custom_likert_path
Open

MAINT: Allow custom Likert system prompt and scale#1514
jsong468 wants to merge 2 commits intoAzure:mainfrom
jsong468:custom_likert_path

Conversation

@jsong468
Copy link
Contributor

This is a follow up to #1444 that allow users to create and use their own yamls for system prompt and Likert scales instead of being forced to choose one of the LikertScalePaths. New validation functions are added to ensure the system prompt and scales are of the right format.

Tests and Documentation

Additional unit tests added.

chat_target (PromptChatTarget): The chat target to use for scoring.
likert_scale (LikertScalePaths): The Likert scale configuration to use for scoring.
likert_scale (Optional[LikertScalePaths]): The Likert scale configuration to use for scoring.
custom_likert_path (Optional[Path]): Path to a custom YAML file containing the Likert scale definition.
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe this is cleaner here but wondering why we can't use the generic self ask scorer since you can add custom scales already there? this can take custom scales & scale definitions as a yaml or string

)
# Only load the default system prompt template if a custom one wasn't already
# set via custom_system_prompt_path in __init__.
if not hasattr(self, "_scoring_instructions_template"):
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: can we set to None & avoid using hasattr()?

ie if self._scoring_instructions_template is None:
or pass in as a parameter?

# The system prompt should come from the custom template, not the default one
assert "Custom prompt for test_cat" in scorer._system_prompt
assert "from 1 to 5" in scorer._system_prompt

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: maybe add unit tests for all the conditions of the scale/yaml - ie both likert & custom provided gives error, test missing both parameters gives error, file not found, non yaml/malformed?

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