@@ -58,11 +58,10 @@ class OutgoingAudioTrackOptions:
5858
5959@dataclass (frozen = True )
6060class OutgoingTrack :
61- """
62- Represents an outgoing track of an agent connected to Fishjam,
63- created by :func:`Agent.add_track`.
64- """
61+ """Represents an outgoing track of an agent connected to Fishjam.
6562
63+ This is created by :func:`Agent.add_track`.
64+ """
6665 id : str
6766 """The global identifier of the track."""
6867 session : AgentSession
@@ -71,8 +70,7 @@ class OutgoingTrack:
7170 """The parameters used to create the track."""
7271
7372 async def send_chunk (self , data : bytes ):
74- """
75- Send a chunk of audio to Fishjam on this track.
73+ """Send a chunk of audio to Fishjam on this track.
7674
7775 Peers connected to the room of the agent will receive this data.
7876 """
@@ -86,8 +84,7 @@ async def send_chunk(self, data: bytes):
8684 await self .session ._send (message )
8785
8886 async def interrupt (self ):
89- """
90- Interrupt current track.
87+ """Interrupt current track.
9188
9289 Any audio that has been sent, but not played
9390 will be cleared and be prevented from playing.
@@ -111,10 +108,7 @@ def __init__(self, agent: Agent, websocket: ClientConnection):
111108 self ._closed = False
112109
113110 async def receive (self ) -> AsyncIterator [IncomingAgentMessage ]:
114- """
115- Returns an infinite async iterator over the incoming messages from Fishjam to
116- the agent.
117- """
111+ """Returns an infinite async iterator over incoming messages from Fishjam."""
118112 while message := await self ._ws .recv (decode = False ):
119113 parsed = AgentResponse ().parse (message )
120114 _ , msg = betterproto .which_one_of (parsed , "content" )
@@ -123,8 +117,7 @@ async def receive(self) -> AsyncIterator[IncomingAgentMessage]:
123117 yield content
124118
125119 async def add_track (self , options : OutgoingAudioTrackOptions ):
126- """
127- Adds a track to the connected agent, with the specified options and metadata.
120+ """Adds a track to the connected agent, with the specified options and metadata.
128121
129122 Returns an instance of :class:`OutgoingTrack`, which can be used to send data
130123 over the added track.
@@ -152,27 +145,25 @@ async def _send(self, message: AgentRequest):
152145 await self ._ws .send (bytes (message ), text = False )
153146
154147 async def disconnect (self ):
155- """
156- Ends the agent session by closing the websocket connection.
148+ """Ends the agent session by closing the websocket connection.
149+
157150 Useful when you don't use the context manager to obtain the session.
158151 """
159152 await self ._ws .close ()
160153
161154
162155class Agent :
163- """
164- Allows for connecting to a Fishjam room as an agent peer.
156+ """Allows for connecting to a Fishjam room as an agent peer.
157+
165158 Provides callbacks for receiving audio.
166159 """
167160
168161 def __init__ (self , id : str , room_id : str , token : str , fishjam_url : str ):
169- """
170- Create Agent instance, providing the fishjam id and management token.
162+ """Create Agent instance, providing the fishjam id and management token.
171163
172164 This constructor should not be called directly.
173165 Instead, you should call :func:`fishjam.FishjamClient.create_agent`.
174166 """
175-
176167 self .id = id
177168 self .room_id = room_id
178169
@@ -181,8 +172,7 @@ def __init__(self, id: str, room_id: str, token: str, fishjam_url: str):
181172
182173 @asynccontextmanager
183174 async def connect (self ):
184- """
185- Connect the agent to Fishjam to start receiving messages.
175+ """Connect the agent to Fishjam to start receiving messages.
186176
187177 Incoming messages from Fishjam will be routed to handlers
188178 defined with :func:`on_track_data`.
0 commit comments