solana-agent 31.2.3__py3-none-any.whl → 31.2.4__py3-none-any.whl

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.
@@ -4,6 +4,8 @@ import asyncio
4
4
  import contextlib
5
5
  import logging
6
6
  from typing import List, AsyncGenerator
7
+ import tempfile
8
+ import os
7
9
 
8
10
  from solana_agent.interfaces.providers.audio import AudioTranscoder
9
11
 
@@ -49,11 +51,45 @@ class FFmpegTranscoder(AudioTranscoder):
49
51
  rate_hz,
50
52
  len(audio_bytes),
51
53
  )
52
- # Prefer to hint format for common containers/codecs; ffmpeg can still autodetect if hint is wrong.
53
- hinted_format = None
54
+ # iOS-recorded MP4/M4A often requires a seekable input for reliable demuxing.
55
+ # Decode from a temporary file instead of stdin for MP4/M4A.
54
56
  if input_mime in ("audio/mp4", "audio/m4a"):
55
- hinted_format = "mp4"
56
- elif input_mime in ("audio/aac",):
57
+ suffix = ".m4a" if input_mime == "audio/m4a" else ".mp4"
58
+ tmp_path = None
59
+ try:
60
+ with tempfile.NamedTemporaryFile(delete=False, suffix=suffix) as tf:
61
+ tmp_path = tf.name
62
+ tf.write(audio_bytes)
63
+ args = [
64
+ "-hide_banner",
65
+ "-loglevel",
66
+ "error",
67
+ "-i",
68
+ tmp_path,
69
+ "-vn", # ignore any video tracks
70
+ "-acodec",
71
+ "pcm_s16le",
72
+ "-ac",
73
+ "1",
74
+ "-ar",
75
+ str(rate_hz),
76
+ "-f",
77
+ "s16le",
78
+ "pipe:1",
79
+ ]
80
+ out = await self._run_ffmpeg(args, b"")
81
+ logger.info(
82
+ "Transcoded (MP4/M4A temp-file) to PCM16: output_len=%d", len(out)
83
+ )
84
+ return out
85
+ finally:
86
+ if tmp_path:
87
+ with contextlib.suppress(Exception):
88
+ os.remove(tmp_path)
89
+
90
+ # For other formats, prefer a format hint when helpful and decode from stdin.
91
+ hinted_format = None
92
+ if input_mime in ("audio/aac",):
57
93
  # Raw AAC is typically in ADTS stream format
58
94
  hinted_format = "adts"
59
95
  elif input_mime in ("audio/ogg", "audio/webm"):
@@ -1037,6 +1037,15 @@ class OpenAIRealtimeWebSocketSession(BaseRealtimeSession):
1037
1037
  if "tools" in patch:
1038
1038
  patch["tools"] = _strip_tool_strict(patch["tools"]) # idempotent
1039
1039
 
1040
+ # Per server requirements, always include session.type and output_modalities
1041
+ try:
1042
+ patch["type"] = "realtime"
1043
+ # Preserve caller-provided output_modalities if present, otherwise default to audio
1044
+ if "output_modalities" not in patch:
1045
+ patch["output_modalities"] = ["audio"]
1046
+ except Exception:
1047
+ pass
1048
+
1040
1049
  payload = {"type": "session.update", "session": patch}
1041
1050
  # Mark awaiting updated and store last patch
1042
1051
  self._last_session_patch = patch or {}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: solana-agent
3
- Version: 31.2.3
3
+ Version: 31.2.4
4
4
  Summary: AI Agents for Solana
5
5
  License: MIT
6
6
  Keywords: solana,solana ai,solana agent,ai,ai agent,ai agents
@@ -335,18 +335,18 @@ async def generate():
335
335
  rt_encode_output=True,
336
336
  rt_voice="marin",
337
337
  output_format="audio",
338
- audio_output_format="m4a",
338
+ audio_output_format="mp3",
339
339
  audio_input_format="mp4",
340
340
  ):
341
341
  yield chunk
342
342
 
343
343
  return StreamingResponse(
344
344
  content=generate(),
345
- media_type="audio/mp4",
345
+ media_type="audio/mp3",
346
346
  headers={
347
347
  "Cache-Control": "no-store",
348
348
  "Pragma": "no-cache",
349
- "Content-Disposition": "inline; filename=stream.m4a",
349
+ "Content-Disposition": "inline; filename=stream.mp3",
350
350
  "X-Accel-Buffering": "no",
351
351
  },
352
352
  )
@@ -1,9 +1,9 @@
1
1
  solana_agent/__init__.py,sha256=iu0PnSAEZ6qzzHFVu7WVCQVbeCZmiZ6axUDDgWRn1j4,1070
2
2
  solana_agent/adapters/__init__.py,sha256=tiEEuuy0NF3ngc_tGEcRTt71zVI58v3dYY9RvMrF2Cg,204
3
- solana_agent/adapters/ffmpeg_transcoder.py,sha256=uq5tp5b2TMvkYptwvQ9_GX4n87mClILMA8SJGNxRWRc,10881
3
+ solana_agent/adapters/ffmpeg_transcoder.py,sha256=d2T6hDBZe_beLkZTJiWSKeeOB47U12-dF4o4PXehnKU,12166
4
4
  solana_agent/adapters/mongodb_adapter.py,sha256=Hq3S8VzfLmnPjV40z8yJXGqUamOJcX5GbOMd-1nNWO4,3175
5
5
  solana_agent/adapters/openai_adapter.py,sha256=U3x6fMRmdvfvNt7M9-RKzV835WtPxNGrV1VRBMiRHV8,26714
6
- solana_agent/adapters/openai_realtime_ws.py,sha256=2AFtfJGft5OE8oYZMRKVw89Yg-a4Wgc7bIrMYeRT49g,77252
6
+ solana_agent/adapters/openai_realtime_ws.py,sha256=ytNanCCkewLlg6Ct37p9-8PFPV7uLPAxuvMlJu1f0j8,77633
7
7
  solana_agent/adapters/pinecone_adapter.py,sha256=XlfOpoKHwzpaU4KZnovO2TnEYbsw-3B53ZKQDtBeDgU,23847
8
8
  solana_agent/cli.py,sha256=FGvTIQmKLp6XsQdyKtuhIIfbBtMmcCCXfigNrj4bzMc,4704
9
9
  solana_agent/client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -41,8 +41,8 @@ solana_agent/services/knowledge_base.py,sha256=ZvOPrSmcNDgUzz4bJIQ4LeRl9vMZiK9hO
41
41
  solana_agent/services/query.py,sha256=oqNFbQsz2FiSswGkt8ZlNaOR8DAz66hgWXD5kHc7c-M,71428
42
42
  solana_agent/services/realtime.py,sha256=6_44-JaKN0V4gkizaisGLPsopM5Z8xymQcCbq5V3yEc,21054
43
43
  solana_agent/services/routing.py,sha256=hsHe8HSGO_xFc0A17WIOGTidLTfLSfApQw3l2HHqkLo,7614
44
- solana_agent-31.2.3.dist-info/LICENSE,sha256=BnSRc-NSFuyF2s496l_4EyrwAP6YimvxWcjPiJ0J7g4,1057
45
- solana_agent-31.2.3.dist-info/METADATA,sha256=FiPGGHeW_QJ6tpSDreJKXFDz5Abbe0bSTZFW0V7C4gM,31168
46
- solana_agent-31.2.3.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
47
- solana_agent-31.2.3.dist-info/entry_points.txt,sha256=-AuT_mfqk8dlZ0pHuAjx1ouAWpTRjpqvEUa6YV3lmc0,53
48
- solana_agent-31.2.3.dist-info/RECORD,,
44
+ solana_agent-31.2.4.dist-info/LICENSE,sha256=BnSRc-NSFuyF2s496l_4EyrwAP6YimvxWcjPiJ0J7g4,1057
45
+ solana_agent-31.2.4.dist-info/METADATA,sha256=zRrJ4pjQ3CEo0DpUT21txy1_vg2JWB4A4BDeQcAw_tI,31168
46
+ solana_agent-31.2.4.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
47
+ solana_agent-31.2.4.dist-info/entry_points.txt,sha256=-AuT_mfqk8dlZ0pHuAjx1ouAWpTRjpqvEUa6YV3lmc0,53
48
+ solana_agent-31.2.4.dist-info/RECORD,,