Skip to content

Commit

Permalink
Add docstrings to Node documentation endpoints
Browse files Browse the repository at this point in the history
Remove duplicate docstring not included in OpanAPI pages
  • Loading branch information
NeonDaniel committed Oct 7, 2024
1 parent 2970e1d commit 832c5d9
Showing 1 changed file with 25 additions and 5 deletions.
30 changes: 25 additions & 5 deletions neon_hana/app/routers/node_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from time import sleep
from typing import Optional, Union

from fastapi import APIRouter, WebSocket, HTTPException, Request
from fastapi import APIRouter, WebSocket, HTTPException
from starlette.websockets import WebSocketDisconnect

from neon_hana.app.dependencies import config, client_manager
Expand Down Expand Up @@ -71,10 +71,6 @@ async def node_v1_endpoint(websocket: WebSocket, token: str):

@node_route.websocket("/v1/stream")
async def node_v1_stream_endpoint(websocket: WebSocket, token: str):
"""
Endpoint to handle a stream of raw audio bytes. A client using this endpoint
must first establish a connection to the `/v1` endpoint.
"""
client_id = client_manager.get_client_id(token)

# Handle problem clients that don't explicitly wait for the Node WS to
Expand Down Expand Up @@ -103,4 +99,28 @@ async def node_v1_doc(_: Optional[Union[NodeAudioInput, NodeGetStt,
NodeGetTts]]) -> \
Optional[Union[NodeKlatResponse, NodeAudioInputResponse,
NodeGetSttResponse, NodeGetTtsResponse]]:
"""
The node endpoint (`/node/v1`) accepts and returns JSON objects representing
Messages. All inputs and responses will contain keys:
`msg_type`, `data`, `context`.
"""
pass


@node_route.get("/v1/stream/doc")
async def node_v1_stream_doc():
"""
The stream endpoint accepts input audio as raw bytes. It expects inputs to
have:
- sample_rate=16000
- sample_width=2
- sample_channels=1
- chunk_size=4096
Response audio is WAV audio as raw bytes, with each message containing one
full audio file. A client should queue all responses for playback.
Any client accessing the stream endpoint (`/node/v1/stream`), must first
establish a connection to the node endpoint (`/node/v1`).
"""
pass

0 comments on commit 832c5d9

Please sign in to comment.