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

Adds ability to use functions for prompt definition #207

Closed
wants to merge 6 commits into from

Conversation

hynky1999
Copy link
Collaborator

@hynky1999 hynky1999 commented Jun 20, 2024

For python based config, it's way more desirable to use the prompt functions directly instead of passing a string.

  1. Strings don't allow any checking for existence
  2. String based prompts, don't enforce type-checks
  3. String based prompts, don't allow leveraging of LSP functionality (go to definition etc...)

MISC:
updates the ruff version in pre-commit to match the pyproject one.

@hynky1999 hynky1999 requested a review from NathanHB June 20, 2024 14:55
@@ -61,6 +61,8 @@
if TYPE_CHECKING:
from lighteval.logging.evaluation_tracker import EvaluationTracker

FormatterType = Callable[[dict, str], Doc]
Copy link
Member

Choose a reason for hiding this comment

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

Why do you include a string?
I don't see which prompt formater takes a string as input

@@ -149,6 +151,38 @@ def __post_init__(self):
self.stop_sequence = tuple(self.stop_sequence) if self.stop_sequence is not None else None


def load_prompt_function(prompt_function: str, custom_tasks_module: list | None) -> FormatterType:
Copy link
Member

Choose a reason for hiding this comment

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

I personally find it less readable with a custom type, we'll see if we keep it through time

Copy link
Member

@clefourrier clefourrier left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@clefourrier
Copy link
Member

I've actually updated this PR in #213 to get an homogeneous system, closing this one to avoid merging it accidentally

@clefourrier clefourrier closed this Jul 5, 2024
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