Skip to content

add additional_messages parameters to forward OpenAi style messages to inference providers #859

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ dependencies = [
"huggingface_hub[hf_xet]>=0.30.2",
"torch>=2.0,<3.0",
"GitPython>=3.1.41", # for logging
"datasets>=3.5.0",
"datasets>=3.5.0,<4.0.0",
"pydantic",
"numpy<2", # pinned to avoid incompatibilities
# Prettiness
Expand Down
4 changes: 4 additions & 0 deletions src/lighteval/tasks/prompt_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ def _prepare_chat_template(self, doc: Doc, tokenize: bool = True) -> str:
messages.append({"role": "user", "content": query})
messages.append({"role": "assistant", "content": fewshot_sample.get_golds()[0]})

# If there are any additional messages to include, lets do it
Copy link
Member

Choose a reason for hiding this comment

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

I'm not seeing this param in the Doc class on main, are you sure it exists?

if doc.additional_messages:
messages += doc.additional_messages

# Add main query
main_query = self._extract_query(doc.query, doc.instruction)

Expand Down
5 changes: 3 additions & 2 deletions src/lighteval/tasks/requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,12 @@ class Doc:
images: list["Image"] | None = None # for multimodal benchmarks
specific: dict | None = None # Information which is specific to the current eval

# Uncoditioned query is used for PMI normalization, that's
# Unconditioned query is used for PMI normalization, that's
# log P(choice | Query) - log P(choice | Unconditioned Query)
# The uncoditioned query shouldn't contain any information about the task, thus usually it's empty string or 'Answer:'.
# The unconditioned query shouldn't contain any information about the task, thus usually it's empty string or 'Answer:'.
unconditioned_query: str | None = None
original_query: str | None = None # the query before preprocessing, if stored
additional_messages: list[object] | None = None

id: str = ""
task_name: str = ""
Expand Down
Loading