Coverage for mindsdb / api / a2a / common / server / utils.py: 0%

12 statements  

« prev     ^ index     » next       coverage.py v7.13.1, created at 2026-01-21 00:36 +0000

1from ...common.types import ( 

2 JSONRPCResponse, 

3 ContentTypeNotSupportedError, 

4 UnsupportedOperationError, 

5) 

6from typing import List 

7 

8 

9def are_modalities_compatible( 

10 server_output_modes: List[str], client_output_modes: List[str] 

11): 

12 """Modalities are compatible if they are both non-empty 

13 and there is at least one common element.""" 

14 if client_output_modes is None or len(client_output_modes) == 0: 

15 return True 

16 

17 if server_output_modes is None or len(server_output_modes) == 0: 

18 return True 

19 

20 return any(x in server_output_modes for x in client_output_modes) 

21 

22 

23def new_incompatible_types_error(request_id): 

24 return JSONRPCResponse(id=request_id, error=ContentTypeNotSupportedError()) 

25 

26 

27def new_not_implemented_error(request_id): 

28 return JSONRPCResponse(id=request_id, error=UnsupportedOperationError())