|
15 | 15 | class CommonApi: |
16 | 16 | class HitTestApi(ApiMixin): |
17 | 17 | @staticmethod |
18 | | - def get_request_params_api(): |
19 | | - return [ |
20 | | - openapi.Parameter(name='query_text', |
21 | | - in_=openapi.IN_QUERY, |
22 | | - type=openapi.TYPE_STRING, |
23 | | - required=True, |
24 | | - description=_('query text')), |
25 | | - openapi.Parameter(name='top_number', |
26 | | - in_=openapi.IN_QUERY, |
27 | | - type=openapi.TYPE_NUMBER, |
28 | | - default=10, |
29 | | - required=True, |
30 | | - description='topN'), |
31 | | - openapi.Parameter(name='similarity', |
32 | | - in_=openapi.IN_QUERY, |
33 | | - type=openapi.TYPE_NUMBER, |
34 | | - default=0.6, |
35 | | - required=True, |
36 | | - description=_('similarity')), |
37 | | - openapi.Parameter(name='search_mode', |
38 | | - in_=openapi.IN_QUERY, |
39 | | - type=openapi.TYPE_STRING, |
40 | | - default="embedding", |
41 | | - required=True, |
42 | | - description=_('Retrieval pattern embedding|keywords|blend') |
43 | | - ) |
44 | | - ] |
| 18 | + def get_request_body_api(): |
| 19 | + return openapi.Schema( |
| 20 | + type=openapi.TYPE_OBJECT, |
| 21 | + required=['query_text', 'top_number', 'similarity', 'search_mode'], |
| 22 | + properties={ |
| 23 | + 'query_text': openapi.Schema(type=openapi.TYPE_STRING, title=_('query text'), |
| 24 | + description=_('query text')), |
| 25 | + 'top_number': openapi.Schema(type=openapi.TYPE_NUMBER, title=_('top number'), |
| 26 | + description=_('top number')), |
| 27 | + 'similarity': openapi.Schema(type=openapi.TYPE_NUMBER, title=_('similarity'), |
| 28 | + description=_('similarity')), |
| 29 | + 'search_mode': openapi.Schema(type=openapi.TYPE_STRING, title=_('search mode'), |
| 30 | + description=_('search mode')) |
| 31 | + } |
| 32 | + ) |
45 | 33 |
|
46 | 34 | @staticmethod |
47 | 35 | def get_response_body_api(): |
|
0 commit comments