ojin-client 0.1.7.dev5__tar.gz → 0.1.7.dev6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ojin-client
3
- Version: 0.1.7.dev5
3
+ Version: 0.1.7.dev6
4
4
  Summary: Ojin platform services
5
5
  Author: Journee
6
6
  License: Apache-2.0
@@ -87,10 +87,9 @@ class OjinPersonaClient(IOjinPersonaClient):
87
87
  self._receive_task: Optional[asyncio.Task] = None
88
88
  self._inference_server_ready: bool = False
89
89
  self._cancelled: bool = False
90
- self._cancelled_interaction_id: str | None = None
91
90
  self.active_interaction_id: str | None = None
92
91
  self._split_audio_task: Optional[asyncio.Task] = None
93
- self._audio_queue: asyncio.Queue[bytes] = asyncio.Queue()
92
+ self._audio_queue: asyncio.Queue[OjinPersonaInteractionInputMessage] = asyncio.Queue()
94
93
 
95
94
  async def connect(self) -> None:
96
95
  """Establish WebSocket connection and authenticate with the service."""
@@ -300,9 +299,7 @@ class OjinPersonaClient(IOjinPersonaClient):
300
299
  except asyncio.QueueEmpty:
301
300
  break
302
301
 
303
-
304
302
  self._cancelled = False
305
- self._cancelled_interaction_id = message.interaction_id
306
303
 
307
304
  return
308
305
 
@@ -328,7 +325,7 @@ class OjinPersonaClient(IOjinPersonaClient):
328
325
  raise ValueError("Audio cannot be empty")
329
326
 
330
327
 
331
- await self._audio_queue.put(message.audio_int16_bytes)
328
+ await self._audio_queue.put(message)
332
329
  # Split audio bytes into chunks of max 3200 samples
333
330
  # max_chunk_size = 3200 * 2
334
331
  # audio_chunks = [
@@ -370,7 +367,7 @@ class OjinPersonaClient(IOjinPersonaClient):
370
367
 
371
368
  async def _split_audio(self) -> None:
372
369
  while True:
373
- message_audio: bytes | None = None
370
+ message_audio: OjinPersonaInteractionInputMessage| None = None
374
371
  if self._cancelled:
375
372
  pass
376
373
 
@@ -384,8 +381,8 @@ class OjinPersonaClient(IOjinPersonaClient):
384
381
 
385
382
  max_chunk_size = 3200 * 2
386
383
  audio_chunks = [
387
- message_audio[i : i + max_chunk_size]
388
- for i in range(0, len(message_audio), max_chunk_size)
384
+ message_audio.audio_int16_bytes[i : i + max_chunk_size]
385
+ for i in range(0, len(message_audio.audio_int16_bytes), max_chunk_size)
389
386
  ]
390
387
  logger.info(
391
388
  "Split audio into %d chunks of max %d bytes",
@@ -393,15 +390,15 @@ class OjinPersonaClient(IOjinPersonaClient):
393
390
  )
394
391
 
395
392
  for i, chunk in enumerate(audio_chunks):
396
- is_last = i == len(audio_chunks) - 1 and message.is_last_input
393
+ is_last = i == len(audio_chunks) - 1 and message_audio.is_last_input
397
394
 
398
395
  interaction_input = InteractionInput(
399
- interaction_id=message.interaction_id,
396
+ interaction_id=message_audio.interaction_id,
400
397
  is_final_input=is_last,
401
398
  payload_type="audio",
402
399
  payload=chunk,
403
400
  timestamp=int(time.monotonic() * 1000),
404
- params=message.params if i == 0 else None,
401
+ params=message_audio.params if i == 0 else None,
405
402
  )
406
403
  proxy_message = InteractionInputMessage(payload=interaction_input)
407
404
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ojin-client
3
- Version: 0.1.7.dev5
3
+ Version: 0.1.7.dev6
4
4
  Summary: Ojin platform services
5
5
  Author: Journee
6
6
  License: Apache-2.0
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "ojin-client"
3
- version = "0.1.7dev5"
3
+ version = "0.1.7dev6"
4
4
  description = "Ojin platform services"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"