Spaces:
Sleeping
Sleeping
Dmytro Bobrenko
commited on
Commit
·
60fe698
1
Parent(s):
e842043
Rename query schema
Browse files- common/schemas.py +1 -1
- server.py +3 -3
common/schemas.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
from marshmallow import Schema, fields
|
2 |
|
3 |
|
4 |
-
class
|
5 |
k = fields.Int(description="The number of miners from which to request responses.")
|
6 |
exclude = fields.List(fields.Str(), description="A list of roles or agents to exclude from querying.")
|
7 |
roles = fields.List(fields.Str(), required=True, description="The roles of the agents to query.")
|
|
|
1 |
from marshmallow import Schema, fields
|
2 |
|
3 |
|
4 |
+
class QueryChatSchema(Schema):
|
5 |
k = fields.Int(description="The number of miners from which to request responses.")
|
6 |
exclude = fields.List(fields.Str(), description="A list of roles or agents to exclude from querying.")
|
7 |
roles = fields.List(fields.Str(), required=True, description="The roles of the agents to query.")
|
server.py
CHANGED
@@ -12,7 +12,7 @@ from aiohttp_apispec import (
|
|
12 |
|
13 |
from validators import S1ValidatorAPI, QueryValidatorParams, ValidatorAPI
|
14 |
from common.middlewares import api_key_middleware, json_parsing_middleware
|
15 |
-
from common.schemas import
|
16 |
|
17 |
|
18 |
@docs(
|
@@ -20,7 +20,7 @@ from common.schemas import QueryValidatorParamsSchema, StreamChunkSchema, Stream
|
|
20 |
summary="Chat",
|
21 |
description="Chat endpoint.",
|
22 |
)
|
23 |
-
@request_schema(
|
24 |
@response_schema(StreamChunkSchema, 200)
|
25 |
@response_schema(StreamErrorSchema, 400)
|
26 |
async def chat(request: web.Request) -> web.StreamResponse:
|
@@ -39,7 +39,7 @@ async def chat(request: web.Request) -> web.StreamResponse:
|
|
39 |
summary="Echo test",
|
40 |
description="Echo endpoint for testing purposes.",
|
41 |
)
|
42 |
-
@request_schema(
|
43 |
@response_schema(StreamChunkSchema, 200)
|
44 |
@response_schema(StreamErrorSchema, 400)
|
45 |
async def echo_stream(request: web.Request) -> web.StreamResponse:
|
|
|
12 |
|
13 |
from validators import S1ValidatorAPI, QueryValidatorParams, ValidatorAPI
|
14 |
from common.middlewares import api_key_middleware, json_parsing_middleware
|
15 |
+
from common.schemas import QueryChatSchema, StreamChunkSchema, StreamErrorSchema
|
16 |
|
17 |
|
18 |
@docs(
|
|
|
20 |
summary="Chat",
|
21 |
description="Chat endpoint.",
|
22 |
)
|
23 |
+
@request_schema(QueryChatSchema)
|
24 |
@response_schema(StreamChunkSchema, 200)
|
25 |
@response_schema(StreamErrorSchema, 400)
|
26 |
async def chat(request: web.Request) -> web.StreamResponse:
|
|
|
39 |
summary="Echo test",
|
40 |
description="Echo endpoint for testing purposes.",
|
41 |
)
|
42 |
+
@request_schema(QueryChatSchema)
|
43 |
@response_schema(StreamChunkSchema, 200)
|
44 |
@response_schema(StreamErrorSchema, 400)
|
45 |
async def echo_stream(request: web.Request) -> web.StreamResponse:
|