mirror of
https://github.com/EvolutionAPI/adk-python.git
synced 2025-07-14 09:51:25 -06:00
fix: Explictly throw execption when custom id is set for vertex ai session service.
PiperOrigin-RevId: 757815469
This commit is contained in:
parent
4c4cfb74ae
commit
70a6bfae90
@ -57,6 +57,12 @@ class VertexAiSessionService(BaseSessionService):
|
|||||||
state: Optional[dict[str, Any]] = None,
|
state: Optional[dict[str, Any]] = None,
|
||||||
session_id: Optional[str] = None,
|
session_id: Optional[str] = None,
|
||||||
) -> Session:
|
) -> Session:
|
||||||
|
if session_id:
|
||||||
|
raise ValueError(
|
||||||
|
'User-provided Session id is not supported for'
|
||||||
|
' VertexAISessionService.'
|
||||||
|
)
|
||||||
|
|
||||||
reasoning_engine_id = _parse_reasoning_engine_id(app_name)
|
reasoning_engine_id = _parse_reasoning_engine_id(app_name)
|
||||||
|
|
||||||
session_json_dict = {'user_id': user_id}
|
session_json_dict = {'user_id': user_id}
|
||||||
|
@ -261,3 +261,15 @@ def test_create_session():
|
|||||||
assert session == session_service.get_session(
|
assert session == session_service.get_session(
|
||||||
app_name='123', user_id='user', session_id=session_id
|
app_name='123', user_id='user', session_id=session_id
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_session_with_custom_session_id():
|
||||||
|
session_service = mock_vertex_ai_session_service()
|
||||||
|
|
||||||
|
with pytest.raises(ValueError) as excinfo:
|
||||||
|
session_service.create_session(
|
||||||
|
app_name='123', user_id='user', session_id='1'
|
||||||
|
)
|
||||||
|
assert str(excinfo.value) == (
|
||||||
|
'User-provided Session id is not supported for VertexAISessionService.'
|
||||||
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user