Repository navigation
fix(reflect): omit temperature in structured extraction when disabled - #5163
Merged
nicoloboschi merged 3 commits intoOct 6, 2026
Conversation
…uctured extraction - structured extraction now calls the existing _deterministic_temperature() instead of duplicating its "0.0 unless the reflect temperature is omitted" expression 200 lines from the helper that already encodes it - renamed _map_temperature/_MAP_TEMPERATURE to _deterministic_temperature/ _DETERMINISTIC_TEMPERATURE now that both reflect mechanical passes share it, and folded the Bedrock structured_output_failed case into its rationale - rebased onto origin/main (branch was 72 commits stale)
nicoloboschi
force-pushed
the
sebastian/fix-structured-refresh-temperature
branch
from
October 6, 2026 12:40
c3272f7 to
9ff892f
Compare
test_reflect_structured_output_threads_reflect_flag stubbed get_config with only llm_strict_schema_reflect, so the new llm_temperature_reflect read raised AttributeError inside _generate_structured_output's except block and the LLM call never happened (CI test-api shard 2/3).
This was referenced Oct 8, 2026
Merged
This was referenced Oct 16, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Mental-model refreshes with a
response_schemastill senttemperature=0.0during their structured extraction pass, even whenHINDSIGHT_API_LLM_TEMPERATURE=nonedisabled that parameter for a model. Bedrock GPT-6 Luna rejects the field, so the refresh failed withstructured_output_failedand preserved the previous page content.Structured extraction now passes no temperature when the configured reflect temperature is omitted. It continues to use
0.0for models that accept the parameter, keeping the existing deterministic extraction behavior. The regression test captures the extraction call with temperature disabled; it failed with0.0before this change and passes withNoneafterward.Validation:
uv run pytest -o addopts='' -o log_cli=false tests/test_reflect_agent.py tests/test_reflect_split_synthesis.py tests/test_llm_temperature_env.py -q --tb=short -k 'not RealLLM': 114 passed, 2 skipped (local ML stack), 3 provider-backed tests deselected because this checkout has no OpenAI API key.uv run pytest -o addopts='' tests/test_reflect_agent.py::TestReflectStructuredOutput tests/test_llm_temperature_env.py tests/test_llm_temperature_pipeline.py -q: 20 passed, 3 skipped (local ML stack).uv run ruff check hindsight_api/engine/reflect/agent.py tests/test_reflect_agent.pyanduv run ruff format --check hindsight_api/engine/reflect/agent.py tests/test_reflect_agent.py: passed.Live Bedrock verification requires a released image containing this fix and a subsequent mental-model refresh. No deployment is included here.