FenjuFu opened a new pull request, #863:
URL: https://github.com/apache/burr/pull/863

   ## Summary
   
   - add identity state-conversion hooks to `ActionSchema`
   - let `PydanticActionSchema` convert Burr `State` values into its 
input/output models and merge typed updates back into the original state
   - apply schema conversion in synchronous and asynchronous class-based 
`Action` execution
   - preserve existing `Function`/`Reducer` behavior through `DEFAULT_SCHEMA` 
fallback
   - add end-to-end sync and async class-based Pydantic regression tests
   
   ## Root cause
   
   Class-based actions could expose an `ActionSchema`, but the application 
lifecycle only used it to validate intermediate result types. `run()` and 
`update()` still received Burr `State` objects, so model attribute access such 
as `state.initial_prompt` failed even with a Pydantic schema.
   
   ## Impact
   
   Class-based actions that expose `PydanticActionSchema` now receive the 
declared Pydantic input/output models. The typed model returned from `update()` 
is merged into the original Burr state, preserving unrelated fields and the 
application typing system. Existing dict-based actions and schema-less internal 
reducers keep their current behavior.
   
   ## Validation
   
   - `python -m pytest tests\core\test_application.py tests\core\test_action.py 
tests\integrations\test_class_based_pydantic.py 
tests\integrations\test_burr_pydantic.py -q` 鈥?326 passed
   - `python -m ruff check burr\core\typing.py burr\core\application.py 
burr\integrations\pydantic.py tests\integrations\test_class_based_pydantic.py`
   - `python -m black --check tests\integrations\test_class_based_pydantic.py`
   - `git diff --check`
   
   Closes #400.
   
   Contributed as a member of the iFLYTEK Astron community.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to