octophone 0.1.0__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.
- octophone-0.1.0/LICENSE +21 -0
- octophone-0.1.0/PKG-INFO +182 -0
- octophone-0.1.0/README.md +129 -0
- octophone-0.1.0/octophone/__init__.py +550 -0
- octophone-0.1.0/octophone/gemini.py +361 -0
- octophone-0.1.0/octophone/livekit.py +578 -0
- octophone-0.1.0/octophone/openai.py +459 -0
- octophone-0.1.0/octophone/pipecat.py +543 -0
- octophone-0.1.0/octophone/py.typed +0 -0
- octophone-0.1.0/octophone/webrtc.py +497 -0
- octophone-0.1.0/octophone.egg-info/PKG-INFO +182 -0
- octophone-0.1.0/octophone.egg-info/SOURCES.txt +20 -0
- octophone-0.1.0/octophone.egg-info/dependency_links.txt +1 -0
- octophone-0.1.0/octophone.egg-info/requires.txt +33 -0
- octophone-0.1.0/octophone.egg-info/top_level.txt +1 -0
- octophone-0.1.0/pyproject.toml +88 -0
- octophone-0.1.0/setup.cfg +4 -0
- octophone-0.1.0/tests/test_octophone_client.py +86 -0
- octophone-0.1.0/tests/test_octophone_gemini.py +372 -0
- octophone-0.1.0/tests/test_octophone_livekit.py +340 -0
- octophone-0.1.0/tests/test_octophone_openai.py +372 -0
- octophone-0.1.0/tests/test_octophone_pipecat.py +442 -0
octophone-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Samrat Man Singh
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
octophone-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: octophone
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python SDK for Octophone — the native phone for your voice agents.
|
|
5
|
+
Author-email: Samrat Man Singh <samratmansingh@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://octophone.dev
|
|
8
|
+
Project-URL: Source, https://github.com/samrat/octophone-sdks
|
|
9
|
+
Project-URL: Issues, https://github.com/samrat/octophone-sdks/issues
|
|
10
|
+
Keywords: octophone,voice-ai,webrtc,pipecat,livekit,gemini,openai,realtime,callkit
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Topic :: Communications
|
|
20
|
+
Classifier: Topic :: Multimedia :: Sound/Audio
|
|
21
|
+
Classifier: Typing :: Typed
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
Requires-Dist: websockets>=12.0
|
|
26
|
+
Provides-Extra: webrtc
|
|
27
|
+
Requires-Dist: aiortc>=1.9.0; extra == "webrtc"
|
|
28
|
+
Requires-Dist: av>=12.0.0; extra == "webrtc"
|
|
29
|
+
Requires-Dist: numpy>=1.24.0; extra == "webrtc"
|
|
30
|
+
Provides-Extra: pipecat
|
|
31
|
+
Requires-Dist: pipecat-ai>=1.3.0; extra == "pipecat"
|
|
32
|
+
Requires-Dist: aiortc>=1.9.0; extra == "pipecat"
|
|
33
|
+
Requires-Dist: av>=12.0.0; extra == "pipecat"
|
|
34
|
+
Requires-Dist: numpy>=1.24.0; extra == "pipecat"
|
|
35
|
+
Provides-Extra: livekit
|
|
36
|
+
Requires-Dist: livekit-agents>=1.0.0; extra == "livekit"
|
|
37
|
+
Requires-Dist: aiortc>=1.9.0; extra == "livekit"
|
|
38
|
+
Requires-Dist: av>=12.0.0; extra == "livekit"
|
|
39
|
+
Requires-Dist: numpy>=1.24.0; extra == "livekit"
|
|
40
|
+
Provides-Extra: gemini
|
|
41
|
+
Requires-Dist: google-genai>=1.0.0; extra == "gemini"
|
|
42
|
+
Requires-Dist: aiortc>=1.9.0; extra == "gemini"
|
|
43
|
+
Requires-Dist: av>=12.0.0; extra == "gemini"
|
|
44
|
+
Requires-Dist: numpy>=1.24.0; extra == "gemini"
|
|
45
|
+
Provides-Extra: openai
|
|
46
|
+
Requires-Dist: aiortc>=1.9.0; extra == "openai"
|
|
47
|
+
Requires-Dist: av>=12.0.0; extra == "openai"
|
|
48
|
+
Requires-Dist: numpy>=1.24.0; extra == "openai"
|
|
49
|
+
Provides-Extra: dev
|
|
50
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
51
|
+
Requires-Dist: pytest-asyncio>=0.24; extra == "dev"
|
|
52
|
+
Dynamic: license-file
|
|
53
|
+
|
|
54
|
+
# octophone
|
|
55
|
+
|
|
56
|
+
Python SDK for [**Octophone**](https://octophone.dev) — the native phone for your voice agents.
|
|
57
|
+
|
|
58
|
+
Connect your Pipecat, LiveKit, OpenAI Live, Gemini Live, or custom voice agents straight to your iPhone (native CallKit ringing, 48 kHz HD Opus WebRTC, mid-call sideband approval cards).
|
|
59
|
+
|
|
60
|
+
## Installation
|
|
61
|
+
|
|
62
|
+
```sh
|
|
63
|
+
# Core async WebSocket client
|
|
64
|
+
pip install octophone
|
|
65
|
+
|
|
66
|
+
# With optional framework / WebRTC extras
|
|
67
|
+
pip install "octophone[pipecat]"
|
|
68
|
+
pip install "octophone[livekit]"
|
|
69
|
+
pip install "octophone[gemini]"
|
|
70
|
+
pip install "octophone[openai]"
|
|
71
|
+
pip install "octophone[webrtc]"
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Quickstart
|
|
75
|
+
|
|
76
|
+
### Pipecat
|
|
77
|
+
|
|
78
|
+
```python
|
|
79
|
+
import os
|
|
80
|
+
from pipecat.pipeline.pipeline import Pipeline
|
|
81
|
+
from octophone.pipecat import OctophoneTransport
|
|
82
|
+
|
|
83
|
+
transport = OctophoneTransport(
|
|
84
|
+
token=os.environ["OCTOPHONE_TOKEN"],
|
|
85
|
+
sample_rate=16000,
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
pipeline = Pipeline([
|
|
89
|
+
transport.input(), # iPhone mic -> InputAudioRawFrame
|
|
90
|
+
stt, llm, tts, # your own voice stack
|
|
91
|
+
transport.output(), # audio -> 48 kHz Opus on iPhone
|
|
92
|
+
])
|
|
93
|
+
|
|
94
|
+
await transport.ring(reason="Staging canary passed. Promote?")
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### LiveKit Agents
|
|
98
|
+
|
|
99
|
+
```python
|
|
100
|
+
import os
|
|
101
|
+
from livekit.agents import Agent, AgentSession
|
|
102
|
+
from octophone.livekit import OctophoneIO
|
|
103
|
+
|
|
104
|
+
io = OctophoneIO(token=os.environ["OCTOPHONE_TOKEN"])
|
|
105
|
+
session = AgentSession(
|
|
106
|
+
stt="deepgram/nova-3",
|
|
107
|
+
llm="openai/gpt-4.1-mini",
|
|
108
|
+
tts="cartesia/sonic-2",
|
|
109
|
+
)
|
|
110
|
+
io.attach(session)
|
|
111
|
+
|
|
112
|
+
await io.ring(reason="Deploy v2.4.1 ready for sign-off")
|
|
113
|
+
await io.wait_for_call()
|
|
114
|
+
await session.start(agent=Agent(instructions="Be concise."))
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Gemini Live (Zero Frameworks)
|
|
118
|
+
|
|
119
|
+
```python
|
|
120
|
+
import asyncio
|
|
121
|
+
from octophone import Octophone
|
|
122
|
+
from octophone.gemini import bridge_gemini_live
|
|
123
|
+
|
|
124
|
+
bot = Octophone(mode="realtime") # reads OCTOPHONE_TOKEN
|
|
125
|
+
|
|
126
|
+
@bot.on_call_started
|
|
127
|
+
async def on_call(ev):
|
|
128
|
+
peer = await bot.join_webrtc(ev["call_id"])
|
|
129
|
+
await bridge_gemini_live(peer)
|
|
130
|
+
|
|
131
|
+
asyncio.run(bot.run())
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### OpenAI Live (Zero Frameworks)
|
|
135
|
+
|
|
136
|
+
```python
|
|
137
|
+
import asyncio
|
|
138
|
+
from octophone import Octophone
|
|
139
|
+
from octophone.openai import bridge_openai_live
|
|
140
|
+
|
|
141
|
+
bot = Octophone(mode="realtime") # reads OCTOPHONE_TOKEN
|
|
142
|
+
|
|
143
|
+
@bot.on_call_started
|
|
144
|
+
async def on_call(ev):
|
|
145
|
+
peer = await bot.join_webrtc(ev["call_id"])
|
|
146
|
+
await bridge_openai_live(peer)
|
|
147
|
+
|
|
148
|
+
asyncio.run(bot.run())
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Managed Voice & Chat (`text_bridge`)
|
|
152
|
+
|
|
153
|
+
```python
|
|
154
|
+
import asyncio
|
|
155
|
+
from octophone import Octophone
|
|
156
|
+
|
|
157
|
+
bot = Octophone() # reads OCTOPHONE_TOKEN
|
|
158
|
+
|
|
159
|
+
@bot.on_turn
|
|
160
|
+
async def handle(turn):
|
|
161
|
+
await turn.delta(f"Heard you say: {turn.text}")
|
|
162
|
+
await turn.done()
|
|
163
|
+
|
|
164
|
+
asyncio.run(bot.run())
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Configuration
|
|
168
|
+
|
|
169
|
+
| Environment Variable | Default | Purpose |
|
|
170
|
+
| --- | --- | --- |
|
|
171
|
+
| `OCTOPHONE_TOKEN` | *(required; falls back to `BOT_TOKEN`)* | Bot contact token |
|
|
172
|
+
| `OCTOPHONE_URL` | `wss://api.octophone.dev/bot/v1` | WebSocket gateway URL (override for local/self-hosted dev) |
|
|
173
|
+
|
|
174
|
+
## Links
|
|
175
|
+
|
|
176
|
+
- Homepage: <https://octophone.dev>
|
|
177
|
+
- Source & Examples: <https://github.com/samrat/octophone-sdks>
|
|
178
|
+
- Issues: <https://github.com/samrat/octophone-sdks/issues>
|
|
179
|
+
|
|
180
|
+
## License
|
|
181
|
+
|
|
182
|
+
MIT
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# octophone
|
|
2
|
+
|
|
3
|
+
Python SDK for [**Octophone**](https://octophone.dev) — the native phone for your voice agents.
|
|
4
|
+
|
|
5
|
+
Connect your Pipecat, LiveKit, OpenAI Live, Gemini Live, or custom voice agents straight to your iPhone (native CallKit ringing, 48 kHz HD Opus WebRTC, mid-call sideband approval cards).
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
# Core async WebSocket client
|
|
11
|
+
pip install octophone
|
|
12
|
+
|
|
13
|
+
# With optional framework / WebRTC extras
|
|
14
|
+
pip install "octophone[pipecat]"
|
|
15
|
+
pip install "octophone[livekit]"
|
|
16
|
+
pip install "octophone[gemini]"
|
|
17
|
+
pip install "octophone[openai]"
|
|
18
|
+
pip install "octophone[webrtc]"
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Quickstart
|
|
22
|
+
|
|
23
|
+
### Pipecat
|
|
24
|
+
|
|
25
|
+
```python
|
|
26
|
+
import os
|
|
27
|
+
from pipecat.pipeline.pipeline import Pipeline
|
|
28
|
+
from octophone.pipecat import OctophoneTransport
|
|
29
|
+
|
|
30
|
+
transport = OctophoneTransport(
|
|
31
|
+
token=os.environ["OCTOPHONE_TOKEN"],
|
|
32
|
+
sample_rate=16000,
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
pipeline = Pipeline([
|
|
36
|
+
transport.input(), # iPhone mic -> InputAudioRawFrame
|
|
37
|
+
stt, llm, tts, # your own voice stack
|
|
38
|
+
transport.output(), # audio -> 48 kHz Opus on iPhone
|
|
39
|
+
])
|
|
40
|
+
|
|
41
|
+
await transport.ring(reason="Staging canary passed. Promote?")
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### LiveKit Agents
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
import os
|
|
48
|
+
from livekit.agents import Agent, AgentSession
|
|
49
|
+
from octophone.livekit import OctophoneIO
|
|
50
|
+
|
|
51
|
+
io = OctophoneIO(token=os.environ["OCTOPHONE_TOKEN"])
|
|
52
|
+
session = AgentSession(
|
|
53
|
+
stt="deepgram/nova-3",
|
|
54
|
+
llm="openai/gpt-4.1-mini",
|
|
55
|
+
tts="cartesia/sonic-2",
|
|
56
|
+
)
|
|
57
|
+
io.attach(session)
|
|
58
|
+
|
|
59
|
+
await io.ring(reason="Deploy v2.4.1 ready for sign-off")
|
|
60
|
+
await io.wait_for_call()
|
|
61
|
+
await session.start(agent=Agent(instructions="Be concise."))
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Gemini Live (Zero Frameworks)
|
|
65
|
+
|
|
66
|
+
```python
|
|
67
|
+
import asyncio
|
|
68
|
+
from octophone import Octophone
|
|
69
|
+
from octophone.gemini import bridge_gemini_live
|
|
70
|
+
|
|
71
|
+
bot = Octophone(mode="realtime") # reads OCTOPHONE_TOKEN
|
|
72
|
+
|
|
73
|
+
@bot.on_call_started
|
|
74
|
+
async def on_call(ev):
|
|
75
|
+
peer = await bot.join_webrtc(ev["call_id"])
|
|
76
|
+
await bridge_gemini_live(peer)
|
|
77
|
+
|
|
78
|
+
asyncio.run(bot.run())
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### OpenAI Live (Zero Frameworks)
|
|
82
|
+
|
|
83
|
+
```python
|
|
84
|
+
import asyncio
|
|
85
|
+
from octophone import Octophone
|
|
86
|
+
from octophone.openai import bridge_openai_live
|
|
87
|
+
|
|
88
|
+
bot = Octophone(mode="realtime") # reads OCTOPHONE_TOKEN
|
|
89
|
+
|
|
90
|
+
@bot.on_call_started
|
|
91
|
+
async def on_call(ev):
|
|
92
|
+
peer = await bot.join_webrtc(ev["call_id"])
|
|
93
|
+
await bridge_openai_live(peer)
|
|
94
|
+
|
|
95
|
+
asyncio.run(bot.run())
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Managed Voice & Chat (`text_bridge`)
|
|
99
|
+
|
|
100
|
+
```python
|
|
101
|
+
import asyncio
|
|
102
|
+
from octophone import Octophone
|
|
103
|
+
|
|
104
|
+
bot = Octophone() # reads OCTOPHONE_TOKEN
|
|
105
|
+
|
|
106
|
+
@bot.on_turn
|
|
107
|
+
async def handle(turn):
|
|
108
|
+
await turn.delta(f"Heard you say: {turn.text}")
|
|
109
|
+
await turn.done()
|
|
110
|
+
|
|
111
|
+
asyncio.run(bot.run())
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Configuration
|
|
115
|
+
|
|
116
|
+
| Environment Variable | Default | Purpose |
|
|
117
|
+
| --- | --- | --- |
|
|
118
|
+
| `OCTOPHONE_TOKEN` | *(required; falls back to `BOT_TOKEN`)* | Bot contact token |
|
|
119
|
+
| `OCTOPHONE_URL` | `wss://api.octophone.dev/bot/v1` | WebSocket gateway URL (override for local/self-hosted dev) |
|
|
120
|
+
|
|
121
|
+
## Links
|
|
122
|
+
|
|
123
|
+
- Homepage: <https://octophone.dev>
|
|
124
|
+
- Source & Examples: <https://github.com/samrat/octophone-sdks>
|
|
125
|
+
- Issues: <https://github.com/samrat/octophone-sdks/issues>
|
|
126
|
+
|
|
127
|
+
## License
|
|
128
|
+
|
|
129
|
+
MIT
|