-
Notifications
You must be signed in to change notification settings - Fork 1
[wip] Custom session handlers #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
… SAGEMAKER_ as prefix.
…ds into toggle-sticky-routing
…is None but request is a session request, raise 400 error - change session api transform's transform_request to never return request field in output (previously used to pass session_manager - change handler code to only take raw_request as a parameter and use new utility function get_session_manager - add new integration tests for expected errors when sessions is disabled
…ds into toggle-sticky-routing
…eate/close session apis
|
Logic looks good to me in general. I want to understand the CX before we move further. Can you add docs/examples to help understand the CX ? |
…ds into toggle-sticky-routing Signed-off-by: Zuyi Zhao <[email protected]>
…container-standards into custom-session-handlers Signed-off-by: Zuyi Zhao <[email protected]>
…ds into custom-session-handlers Signed-off-by: Zuyi Zhao <[email protected]>
- Fix session ID injection logic to work with default session manager - Changed conditional from elif to separate if statements - Session ID now properly injected into request body when session_id_path is specified - Validation and injection can now happen independently - Update unit tests to match refactored transform API - Remove import of non-existent _validate_session_if_present function - Update test signatures to match _process_session_request parameters - Add missing SessionRequest import - Replace outdated test logic with current implementation - Add integration tests for session_id_path injection feature - Test session ID injection into flat and nested request body paths - Test injection with multiple requests and different sessions - Verify existing body fields are preserved during injection
- Rename session_id_path to request_session_id_path in stateful_session_manager - Rename session_id_path to response_session_id_path in register handlers - Add docstring clarifying request_session_id_path usage - Provide default content messages for create/close session handlers - Remove specific engine references (vLLM, TGI) from documentation - Delete obsolete test_registration.py - Improve integration tests
…ds into custom-session-handlers
Lokiiiiii
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summarizing -
- The parameter names for the handlers are un-intuitive. I recommend renaming it to be obvious in terms of the functionality or the input the developer needs to provide -
path_to_session_id_in_incoming_requestor something similar. - The documentation has inconsistent ordering of decorators. This will cause issues when overriding handlers.
- We need to improve the defaults and documentation needs to indicate defaults for handler arguments
| # Register custom close session handler | ||
| @register_close_session_handler( | ||
| request_shape={ | ||
| "session_id": 'headers."X-Amzn-SageMaker-Session-Id"' # Extract from header |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Within sagemaker.sessions X-Amzn-SageMaker-Session-Id should be the default. We should remove this from the documentation for ease of understanding.
| capacity: int | ||
| session_id: Optional[str] = None | ||
|
|
||
| @register_create_session_handler( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see inconsistent ordering of decorators.
I believe it is supposed to be reversed ie.., handlers should be registered before FastAPI route configurations ?
| # Register custom create session handler | ||
| @register_create_session_handler( | ||
| request_shape={ | ||
| "capacity": "`1024`" # JMESPath literal value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a required new field ? Is there going to be a default ?
|
|
||
| @register_create_session_handler( | ||
| request_shape={ | ||
| "capacity": "`1024`", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this needed ?
Issue #, if available:
Description of changes:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.