Fix: Prioritize task output_json over LLM response_format #3640
+204
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix: Prioritize task output_json over LLM response_format
Summary
This PR fixes issue #3639 by establishing a clear priority hierarchy when both a task's
output_json
/output_pydantic
and an agent's LLMresponse_format
are set with Pydantic models. Task-level settings now take precedence over agent-level settings, following standard configuration hierarchy principles.Key changes:
LLM._prepare_completion_params()
to accept afrom_task
parameter and check for task output settingsoutput_json
oroutput_pydantic
set, the LLM'sresponse_format
is ignoredLLM.call()
to pass the task object through the call chainReview & Testing Checklist for Human
task.output_json=TaskModel
andagent.llm.response_format=LLMModel
and verify the task model is used in the resultoutput_json
andoutput_pydantic
functionality still works as expected when no LLMresponse_format
is setNotes
Requested by: João ([email protected])
Link to Devin run: https://app.devin.ai/sessions/b30fa7d430ca45ee99cd2f492b080702