From 8d0fba4e5fde2341ea8eeb733245f4ceec10a205 Mon Sep 17 00:00:00 2001 From: Osamaali313 Date: Fri, 17 Jul 2026 00:19:48 +0300 Subject: [PATCH] Fix instruction_first kwarg dropped in (a)run_instructor_with_payload MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `run_instructor_with_payload` and `arun_instructor_with_payload` construct a `MessagesBuilder` with `instructions_first=instructions_first`, but `MessagesBuilder`'s field is named `instruction_first` (no trailing "s"): # utils/message_builder.py instruction_first: bool = Field(default=True) ... if self.instruction_first: `MessagesBuilder` is a pydantic model, so under the default `extra="ignore"` the misspelled `instructions_first=` kwarg is silently discarded and `instruction_first` stays at its default `True`. The caller's value never takes effect — e.g. `LiteLLMChatRuntime.record_to_record` (runtimes/_litellm.py) passes `instructions_first=False`, but the instruction/system message is still placed first. The two sibling functions in the same module, `run_instructor_with_payloads` and `arun_instructor_with_payloads`, already use the correct field name `instruction_first=instructions_first`. Align the two singular functions with them. --- adala/utils/llm_utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adala/utils/llm_utils.py b/adala/utils/llm_utils.py index ac57a1d6..59c110f1 100644 --- a/adala/utils/llm_utils.py +++ b/adala/utils/llm_utils.py @@ -386,7 +386,7 @@ def run_instructor_with_payload( messages_builder = MessagesBuilder( user_prompt_template=user_prompt_template, system_prompt=instructions_template, - instructions_first=instructions_first, + instruction_first=instructions_first, input_field_types=input_field_types, extra_fields=extra_fields, split_into_chunks=split_into_chunks, @@ -455,7 +455,7 @@ async def arun_instructor_with_payload( messages_builder = MessagesBuilder( user_prompt_template=user_prompt_template, system_prompt=instructions_template, - instructions_first=instructions_first, + instruction_first=instructions_first, input_field_types=input_field_types, extra_fields=extra_fields, split_into_chunks=split_into_chunks,