From 26ec22794ca8ca3661d924925e3dd1620fddc88e Mon Sep 17 00:00:00 2001 From: r266-tech Date: Sun, 21 Jun 2026 12:58:13 +0800 Subject: [PATCH] docs(api): correct ReflectResult.based_on key names MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The in-process engine builds based_on with keys world, experience, opinion, observation, "mental-models" (hyphen), directives (memory_engine.py). ReflectResult's Field description named the key "mental_models" (underscore) and omitted "observation", and the json_schema_extra example had the same drift — so a consumer doing based_on["mental_models"] hits KeyError and never learns the "observation" bucket exists. The maintainer's own http.py comment already notes the key is hyphenated. Fixes the description and example to the real keys. Leaves the dead 'opinion' key untouched (handled by #2323/#2335). The separate wire model ReflectBasedOn is unaffected. --- hindsight-api-slim/hindsight_api/engine/response_models.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hindsight-api-slim/hindsight_api/engine/response_models.py b/hindsight-api-slim/hindsight_api/engine/response_models.py index ffa92c8d5..c1c00e493 100644 --- a/hindsight-api-slim/hindsight_api/engine/response_models.py +++ b/hindsight-api-slim/hindsight_api/engine/response_models.py @@ -307,7 +307,8 @@ class ReflectResult(BaseModel): ], "experience": [], "opinion": [], - "mental_models": [], + "observation": [], + "mental-models": [], "directives": [ { "id": "directive-123", @@ -324,7 +325,7 @@ class ReflectResult(BaseModel): text: str = Field(description="The formulated answer text") based_on: dict[str, Any] = Field( - description="Facts used to formulate the answer, organized by type (world, experience, mental_models, directives)" + description="Facts used to formulate the answer, organized by type (world, experience, observation, mental-models, directives)" ) structured_output: dict[str, Any] | None = Field( default=None,