Spaces:
Sleeping
Sleeping
Dmytro Bobrenko
commited on
Commit
·
c4957f4
1
Parent(s):
151d1dc
Sort imports
Browse files
server.py
CHANGED
@@ -1,26 +1,23 @@
|
|
1 |
import asyncio
|
|
|
2 |
import bittensor as bt
|
3 |
from aiohttp import web
|
4 |
-
from aiohttp_apispec import
|
5 |
-
setup_aiohttp_apispec,
|
6 |
-
validation_middleware,
|
7 |
-
docs,
|
8 |
-
request_schema,
|
9 |
-
response_schema,
|
10 |
-
)
|
11 |
|
12 |
-
from validators import S1ValidatorAPI, QueryValidatorParams, ValidatorAPI
|
13 |
from common import utils
|
14 |
from common.middlewares import api_key_middleware, json_parsing_middleware
|
15 |
from common.schemas import QueryChatSchema, StreamChunkSchema, StreamErrorSchema
|
|
|
16 |
|
17 |
|
18 |
@docs(
|
19 |
tags=["Prompting API"],
|
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:
|
@@ -38,8 +35,10 @@ async def chat(request: web.Request) -> web.StreamResponse:
|
|
38 |
tags=["Prompting API"],
|
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:
|
|
|
1 |
import asyncio
|
2 |
+
|
3 |
import bittensor as bt
|
4 |
from aiohttp import web
|
5 |
+
from aiohttp_apispec import docs, request_schema, response_schema, setup_aiohttp_apispec, validation_middleware
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
|
|
|
7 |
from common import utils
|
8 |
from common.middlewares import api_key_middleware, json_parsing_middleware
|
9 |
from common.schemas import QueryChatSchema, StreamChunkSchema, StreamErrorSchema
|
10 |
+
from validators import QueryValidatorParams, S1ValidatorAPI, ValidatorAPI
|
11 |
|
12 |
|
13 |
@docs(
|
14 |
tags=["Prompting API"],
|
15 |
summary="Chat",
|
16 |
description="Chat endpoint."
|
17 |
+
description="Chat endpoint."
|
18 |
)
|
19 |
@request_schema(QueryChatSchema)
|
20 |
+
@request_schema(QueryChatSchema)
|
21 |
@response_schema(StreamChunkSchema, 200)
|
22 |
@response_schema(StreamErrorSchema, 400)
|
23 |
async def chat(request: web.Request) -> web.StreamResponse:
|
|
|
35 |
tags=["Prompting API"],
|
36 |
summary="Echo test",
|
37 |
description="Echo endpoint for testing purposes."
|
38 |
+
description="Echo endpoint for testing purposes."
|
39 |
)
|
40 |
@request_schema(QueryChatSchema)
|
41 |
+
@request_schema(QueryChatSchema)
|
42 |
@response_schema(StreamChunkSchema, 200)
|
43 |
@response_schema(StreamErrorSchema, 400)
|
44 |
async def echo_stream(request: web.Request) -> web.StreamResponse:
|