swarmauri_live_model_openai 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.
- swarmauri_live_model_openai-0.1.0/LICENSE +13 -0
- swarmauri_live_model_openai-0.1.0/NOTICE +7 -0
- swarmauri_live_model_openai-0.1.0/PKG-INFO +328 -0
- swarmauri_live_model_openai-0.1.0/README.md +304 -0
- swarmauri_live_model_openai-0.1.0/pyproject.toml +87 -0
- swarmauri_live_model_openai-0.1.0/swarmauri_live_model_openai/OpenAIRealtimeCodec.py +184 -0
- swarmauri_live_model_openai-0.1.0/swarmauri_live_model_openai/OpenAIRealtimeConfigMapper.py +19 -0
- swarmauri_live_model_openai-0.1.0/swarmauri_live_model_openai/OpenAIRealtimeModel.py +42 -0
- swarmauri_live_model_openai-0.1.0/swarmauri_live_model_openai/OpenAIRealtimeSession.py +64 -0
- swarmauri_live_model_openai-0.1.0/swarmauri_live_model_openai/OpenAIRealtimeToolAdapter.py +10 -0
- swarmauri_live_model_openai-0.1.0/swarmauri_live_model_openai/OpenAIResponsesWSModel.py +23 -0
- swarmauri_live_model_openai-0.1.0/swarmauri_live_model_openai/__init__.py +15 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Copyright 2024 Jacob Stewart
|
|
2
|
+
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License.
|
|
5
|
+
You may obtain a copy of the License at
|
|
6
|
+
|
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
|
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
See the License for the specific language governing permissions and
|
|
13
|
+
limitations under the License.
|
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: swarmauri_live_model_openai
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: OpenAI Realtime and persistent Responses WebSocket model adapters for Swarmauri.
|
|
5
|
+
License-Expression: Apache-2.0
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
License-File: NOTICE
|
|
8
|
+
Keywords: swarmauri,openai realtime,websocket,audio,tools
|
|
9
|
+
Author: Jacob Stewart
|
|
10
|
+
Author-email: jacob@swarmauri.com
|
|
11
|
+
Requires-Python: >=3.10,<3.15
|
|
12
|
+
Classifier: Development Status :: 1 - Planning
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
18
|
+
Requires-Dist: swarmauri_base (>=0.11.0,<0.12)
|
|
19
|
+
Requires-Dist: swarmauri_core (>=0.11.0,<0.12)
|
|
20
|
+
Requires-Dist: swarmauri_provider_openai (>=0.1.0)
|
|
21
|
+
Requires-Dist: swarmauri_transport_websocket (>=0.1.0)
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
|
|
24
|
+
# swarmauri_live_model_openai
|
|
25
|
+
|
|
26
|
+
<!-- readme-standards:begin branding -->
|
|
27
|
+
<p align="center"><a href="https://github.com/swarmauri/swarmauri-sdk"><img src="https://raw.githubusercontent.com/swarmauri/swarmauri-sdk/master/assets/swarmauri.brand.theme.svg" alt="Swarmauri SDK" width="300"></a></p>
|
|
28
|
+
<p align="center"><strong>swarmauri_live_model_openai</strong></p>
|
|
29
|
+
<p align="center">OpenAI Realtime and persistent Responses WebSocket model adapters for Swarmauri.</p>
|
|
30
|
+
<p align="center">
|
|
31
|
+
<a href="https://pypi.org/project/swarmauri_live_model_openai/"><img alt="pypi: swarmauri_live_model_openai" src="https://img.shields.io/pypi/v/swarmauri_live_model_openai?labelColor=1E293B&color=1D4ED8"></a>
|
|
32
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/pyproject.toml"><img alt="Source version: 0.1.0" src="https://img.shields.io/static/v1?label=Source%20version&message=0.1.0&labelColor=1E293B&color=4338CA"></a>
|
|
33
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/pyproject.toml"><img alt="Python: >=3.10,<3.15" src="https://img.shields.io/static/v1?label=Python&message=%3E%3D3.10%2C%3C3.15&labelColor=1E293B&color=0F766E"></a>
|
|
34
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/pyproject.toml"><img alt="Layer: community" src="https://img.shields.io/static/v1?label=Layer&message=community&labelColor=1E293B&color=6D28D9"></a>
|
|
35
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/README.md#lifecycle-and-migration"><img alt="Lifecycle: active" src="https://img.shields.io/static/v1?label=Lifecycle&message=active&labelColor=1E293B&color=166534"></a>
|
|
36
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/LICENSE"><img alt="License: Apache-2.0" src="https://img.shields.io/static/v1?label=License&message=Apache-2.0&labelColor=1E293B&color=86198F"></a>
|
|
37
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/NOTICE"><img alt="Notice: attribution" src="https://img.shields.io/static/v1?label=Notice&message=attribution&labelColor=1E293B&color=86198F"></a>
|
|
38
|
+
</p>
|
|
39
|
+
<p align="center">
|
|
40
|
+
<a href="https://pypi.org/project/swarmauri_live_model_openai/"><img alt="Monthly PyPI downloads: swarmauri_live_model_openai" src="https://img.shields.io/pypi/dm/swarmauri_live_model_openai?labelColor=1E293B&color=0E7490"></a>
|
|
41
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/README.md"><img alt="README hits: swarmauri_live_model_openai" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/pkgs/50-community/swarmauri_live_model_openai/README.md.svg?label=README%20hits&labelColor=1E293B&color=0E7490"></a>
|
|
42
|
+
</p>
|
|
43
|
+
<p align="center">
|
|
44
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/actions/workflows/readme-standards.yml"><img alt="README standards: CI gate" src="https://img.shields.io/static/v1?label=README%20standards&message=CI%20gate&labelColor=1E293B&color=1D4ED8"></a>
|
|
45
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/tests/unit/test_readme_sources.py"><img alt="Tests: example source" src="https://img.shields.io/static/v1?label=Tests&message=example%20source&labelColor=1E293B&color=0F766E"></a>
|
|
46
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/README.md#certification-status"><img alt="Certification: not certified" src="https://img.shields.io/static/v1?label=Certification&message=not%20certified&labelColor=1E293B&color=92400E"></a>
|
|
47
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/tools/readme/POLICY.md"><img alt="Governance: repository policy" src="https://img.shields.io/static/v1?label=Governance&message=repository%20policy&labelColor=1E293B&color=4338CA"></a>
|
|
48
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/actions/workflows/readme-standards.yml"><img alt="Evidence: source and CI" src="https://img.shields.io/static/v1?label=Evidence&message=source%20and%20CI&labelColor=1E293B&color=6D28D9"></a>
|
|
49
|
+
</p>
|
|
50
|
+
<p align="center"><a href="#overview">Overview</a> · <a href="#installation">Installation</a> · <a href="#quick-start">Quick Start</a> · <a href="#usage">Usage</a> · <a href="#public-api-and-import-surfaces">API</a> · <a href="#contributing">Contributing</a> · <a href="#governance">Governance</a> · <a href="#license">License</a></p>
|
|
51
|
+
<!-- readme-standards:end branding -->
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Overview
|
|
56
|
+
|
|
57
|
+
### Summary
|
|
58
|
+
|
|
59
|
+
[](https://pypi.org/project/swarmauri_live_model_openai/) [](https://pypi.org/project/swarmauri_live_model_openai/) [](LICENSE) [](https://pepy.tech/project/swarmauri_live_model_openai) [](https://hits.sh/github.com/swarmauri/swarmauri-sdk/)
|
|
60
|
+
|
|
61
|
+
### Why This Package
|
|
62
|
+
|
|
63
|
+
`swarmauri_live_model_openai` isolates this responsibility: OpenAI Realtime and persistent Responses WebSocket model adapters for Swarmauri. Its [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/swarmauri_live_model_openai/__init__.py) exposes `OpenAIRealtimeCodec`, `OpenAIRealtimeConfigMapper`, `OpenAIRealtimeModel`, `OpenAIRealtimeSession`, `OpenAIRealtimeToolAdapter`, `OpenAIResponsesWSModel`, allowing consumers to select this package without treating adjacent packages as part of its public contract.
|
|
64
|
+
|
|
65
|
+
### When to Use
|
|
66
|
+
|
|
67
|
+
Choose `swarmauri_live_model_openai` when your integration needs openAI Realtime and persistent Responses WebSocket model adapters for Swarmauri. Match the imports below to your application boundary and install its declared dependencies before using the example.
|
|
68
|
+
|
|
69
|
+
### Features
|
|
70
|
+
|
|
71
|
+
- OpenAI Realtime multimodal conversations over WebSocket.
|
|
72
|
+
- Persistent Responses WebSocket adapter.
|
|
73
|
+
- Typed text, audio, transcripts, tools, interruption, and usage events.
|
|
74
|
+
|
|
75
|
+
### Non-Goals
|
|
76
|
+
|
|
77
|
+
`swarmauri_live_model_openai` owns openAI Realtime and persistent Responses WebSocket model adapters for Swarmauri. Its imports do not by themselves configure credentials, deploy a service, or certify the behavior of its consumers. Dependencies and neighboring packages retain their own documented responsibilities.
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Getting Started
|
|
82
|
+
|
|
83
|
+
### Prerequisites
|
|
84
|
+
|
|
85
|
+
Python `>=3.10,<3.15` is required. The [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/pyproject.toml) declares runtime dependencies including `swarmauri-core`, `swarmauri-base`, `swarmauri-provider-openai`, `swarmauri-transport-websocket`. Read the example’s inputs and service requirements before execution.
|
|
86
|
+
|
|
87
|
+
### Installation
|
|
88
|
+
|
|
89
|
+
`uv add swarmauri_live_model_openai` or `pip install swarmauri_live_model_openai`.
|
|
90
|
+
|
|
91
|
+
#### uv
|
|
92
|
+
|
|
93
|
+
<!-- readme-standards:begin installation.uv -->
|
|
94
|
+
```bash
|
|
95
|
+
uv add swarmauri_live_model_openai
|
|
96
|
+
```
|
|
97
|
+
<!-- readme-standards:end installation.uv -->
|
|
98
|
+
|
|
99
|
+
#### pip
|
|
100
|
+
|
|
101
|
+
<!-- readme-standards:begin installation.pip -->
|
|
102
|
+
```bash
|
|
103
|
+
python -m pip install swarmauri_live_model_openai
|
|
104
|
+
```
|
|
105
|
+
<!-- readme-standards:end installation.pip -->
|
|
106
|
+
|
|
107
|
+
#### Poetry
|
|
108
|
+
|
|
109
|
+
<!-- readme-standards:begin installation.poetry -->
|
|
110
|
+
```bash
|
|
111
|
+
poetry add swarmauri_live_model_openai
|
|
112
|
+
```
|
|
113
|
+
<!-- readme-standards:end installation.poetry -->
|
|
114
|
+
|
|
115
|
+
### Quick Start
|
|
116
|
+
|
|
117
|
+
#### Example
|
|
118
|
+
|
|
119
|
+
<!-- readme-standards:begin example.quick-start -->
|
|
120
|
+
Source: [docs/readme/quick_start.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/docs/readme/quick_start.py).
|
|
121
|
+
|
|
122
|
+
```python
|
|
123
|
+
import importlib
|
|
124
|
+
|
|
125
|
+
package = importlib.import_module("swarmauri_live_model_openai")
|
|
126
|
+
assert package.__name__ == "swarmauri_live_model_openai"
|
|
127
|
+
```
|
|
128
|
+
<!-- readme-standards:end example.quick-start -->
|
|
129
|
+
|
|
130
|
+
#### Expected Result
|
|
131
|
+
|
|
132
|
+
This quick start is explicitly an import smoke check for `swarmauri_live_model_openai`. It confirms that the documented namespace loads; it does not demonstrate or certify a complete application workflow. The detailed source and retained usage guidance below describe the integration boundary.
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## Usage
|
|
137
|
+
|
|
138
|
+
### Common Workflows
|
|
139
|
+
|
|
140
|
+
<!-- readme-standards:begin example.usage -->
|
|
141
|
+
Source: [docs/readme/usage.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/docs/readme/usage.py).
|
|
142
|
+
|
|
143
|
+
```python
|
|
144
|
+
import importlib
|
|
145
|
+
|
|
146
|
+
package = importlib.import_module("swarmauri_live_model_openai")
|
|
147
|
+
assert package.__name__ == "swarmauri_live_model_openai"
|
|
148
|
+
```
|
|
149
|
+
<!-- readme-standards:end example.usage -->
|
|
150
|
+
|
|
151
|
+
Inject an `OpenAIProvider`, connect with `LiveConfigBase`, send typed inputs, and consume the session event stream.
|
|
152
|
+
|
|
153
|
+
### Configuration
|
|
154
|
+
|
|
155
|
+
Configure `swarmauri_live_model_openai` through the APIs in [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/swarmauri_live_model_openai/__init__.py); its [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/pyproject.toml) describes installation requirements, not an implicit service configuration. No additional package-global configuration contract is inferred from dependencies.
|
|
156
|
+
|
|
157
|
+
### Error Handling
|
|
158
|
+
|
|
159
|
+
The inspected `swarmauri_live_model_openai` source raises `ValueError`. Handle these at the calling boundary and consult the implementation for the triggering conditions.
|
|
160
|
+
|
|
161
|
+
### Best Practices
|
|
162
|
+
|
|
163
|
+
Use the explicit `swarmauri_live_model_openai` imports documented below and keep collaborator configuration with the caller. Run the package’s relevant tests after changing `OpenAIRealtimeCodec`, `OpenAIRealtimeConfigMapper`, `OpenAIRealtimeModel`, `OpenAIRealtimeSession`, `OpenAIRealtimeToolAdapter`, `OpenAIResponsesWSModel`; an import or successful installation alone does not establish its runtime guarantees.
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## Package Boundary
|
|
168
|
+
|
|
169
|
+
### What It Owns
|
|
170
|
+
|
|
171
|
+
`swarmauri_live_model_openai` is located in `community` and owns openAI Realtime and persistent Responses WebSocket model adapters for Swarmauri. Source-declared APIs include `OpenAIRealtimeCodec`, `OpenAIRealtimeConfigMapper`, `OpenAIRealtimeModel`, `OpenAIRealtimeSession`, `OpenAIRealtimeToolAdapter`, `OpenAIResponsesWSModel`. The [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/pyproject.toml) records its direct dependency boundary.
|
|
172
|
+
|
|
173
|
+
### Public API and Import Surfaces
|
|
174
|
+
|
|
175
|
+
Import namespace: `swarmauri_live_model_openai`.
|
|
176
|
+
|
|
177
|
+
Source-declared exports or types: `OpenAIRealtimeCodec`, `OpenAIRealtimeConfigMapper`, `OpenAIRealtimeModel`, `OpenAIRealtimeSession`, `OpenAIRealtimeToolAdapter`, `OpenAIResponsesWSModel`.
|
|
178
|
+
|
|
179
|
+
Inspect [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/swarmauri_live_model_openai/__init__.py) for exact signatures; this inventory does not designate every internal module as stable.
|
|
180
|
+
|
|
181
|
+
### Entry Points
|
|
182
|
+
|
|
183
|
+
<!-- readme-standards:begin entry-points -->
|
|
184
|
+
- `swarmauri.live_models` → `OpenAIRealtimeModel` → `swarmauri_live_model_openai:OpenAIRealtimeModel`
|
|
185
|
+
- `swarmauri.live_models` → `OpenAIResponsesWSModel` → `swarmauri_live_model_openai:OpenAIResponsesWSModel`
|
|
186
|
+
<!-- readme-standards:end entry-points -->
|
|
187
|
+
|
|
188
|
+
### Injected Dependencies
|
|
189
|
+
|
|
190
|
+
The direct installation dependencies of `swarmauri_live_model_openai` are `swarmauri-core`, `swarmauri-base`, `swarmauri-provider-openai`, `swarmauri-transport-websocket`. These declarations do not imply automatic provider selection. Pass collaborators through the explicit constructors or call signatures in [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/swarmauri_live_model_openai/__init__.py).
|
|
191
|
+
|
|
192
|
+
### Protocol Consumers
|
|
193
|
+
|
|
194
|
+
No direct package-manifest dependency on `swarmauri_live_model_openai` was found in the audited three-repository inventory. External consumers may still use its documented imports or commands.
|
|
195
|
+
|
|
196
|
+
### Extensions
|
|
197
|
+
|
|
198
|
+
For `swarmauri_live_model_openai`, use the source-declared public interfaces (`OpenAIRealtimeCodec`, `OpenAIRealtimeConfigMapper`, `OpenAIRealtimeModel`, `OpenAIRealtimeSession`, `OpenAIRealtimeToolAdapter`, `OpenAIResponsesWSModel`) when composing or extending behavior. Its entry-point section below is authoritative for registered plugins; no additional extension loader is inferred from the package name.
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## Operations and Readiness
|
|
203
|
+
|
|
204
|
+
### Operational Requirements
|
|
205
|
+
|
|
206
|
+
Operate `swarmauri_live_model_openai` according to its actual entry points and collaborators. The dependency and Python requirements in the [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/pyproject.toml) are prerequisites; deployment topology, credentials, and readiness remain the responsibility of the consuming application unless explicitly documented above.
|
|
207
|
+
|
|
208
|
+
### Health and Observability
|
|
209
|
+
|
|
210
|
+
This README does not establish a standalone health endpoint for `swarmauri_live_model_openai`. Observe the concrete caller’s results, exceptions, and existing test reports. An application that embeds this package must define its own health and telemetry contract.
|
|
211
|
+
|
|
212
|
+
### Security and Resource Limits
|
|
213
|
+
|
|
214
|
+
Apply the input, credential, and resource constraints implemented in [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/swarmauri_live_model_openai/__init__.py). The `swarmauri_live_model_openai` README gate is a documentation check, not a security review or a substitute for the implementation’s limits and caller authorization.
|
|
215
|
+
|
|
216
|
+
### Compatibility
|
|
217
|
+
|
|
218
|
+
This source version of `swarmauri_live_model_openai` declares Python `>=3.10,<3.15`. Consult its dependency constraints before upgrading. Source-version and registry-version badges have separate meanings; this migration makes no additional platform or interoperability certification claim.
|
|
219
|
+
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
## Verification
|
|
223
|
+
|
|
224
|
+
### Tests
|
|
225
|
+
|
|
226
|
+
Run `python -m pytest tests/unit/test_readme_sources.py` from the `swarmauri_live_model_openai` package directory for the maintained example source checks (Python compilation and non-Python file presence). Existing package tests include:
|
|
227
|
+
|
|
228
|
+
- [tests/unit/test_helper_methods.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/tests/unit/test_helper_methods.py)
|
|
229
|
+
- [tests/unit/test_openai_live_connections.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/tests/unit/test_openai_live_connections.py)
|
|
230
|
+
- [tests/unit/test_openai_realtime_codec.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/tests/unit/test_openai_realtime_codec.py)
|
|
231
|
+
- [tests/unit/test_openai_realtime_session.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/tests/unit/test_openai_realtime_session.py)
|
|
232
|
+
- [tests/unit/test_package_contract.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/tests/unit/test_package_contract.py)
|
|
233
|
+
|
|
234
|
+
The repository README gate also checks the required heading tree, metadata, managed fragments, and referenced files.
|
|
235
|
+
|
|
236
|
+
### Certification Status
|
|
237
|
+
|
|
238
|
+
No external certification is asserted for `swarmauri_live_model_openai` by this documentation migration. README conformance, example syntax, runtime tests, and protocol or security certification are distinct evidence scopes.
|
|
239
|
+
|
|
240
|
+
### Evidence
|
|
241
|
+
|
|
242
|
+
The [README standards CI](https://github.com/swarmauri/swarmauri-sdk/actions/workflows/readme-standards.yml) records mechanical documentation results for its tested commit. The [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/swarmauri_live_model_openai/__init__.py) and example sources support the package-boundary description; external runtime behavior requires its own test evidence.
|
|
243
|
+
|
|
244
|
+
---
|
|
245
|
+
|
|
246
|
+
## FAQ
|
|
247
|
+
|
|
248
|
+
### Why
|
|
249
|
+
|
|
250
|
+
**Why select this package?** `swarmauri_live_model_openai` provides openAI Realtime and persistent Responses WebSocket model adapters for Swarmauri; use its own API boundary rather than assuming neighboring packages are bundled or configured automatically.
|
|
251
|
+
|
|
252
|
+
### How
|
|
253
|
+
|
|
254
|
+
**How do I start?** Install or synchronize the environment under Getting Started, follow the maintained example for `swarmauri_live_model_openai`, and consult [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/swarmauri_live_model_openai/__init__.py) for the exact types and signatures involved.
|
|
255
|
+
|
|
256
|
+
### When
|
|
257
|
+
|
|
258
|
+
**When should I validate an upgrade?** Recheck `swarmauri_live_model_openai` whenever its source version, declared collaborators, configuration, or caller changes. Run relevant behavioral tests in addition to the README gate before promotion.
|
|
259
|
+
|
|
260
|
+
---
|
|
261
|
+
|
|
262
|
+
## Documentation and Related Packages
|
|
263
|
+
|
|
264
|
+
### More Documentation
|
|
265
|
+
|
|
266
|
+
The [repository contribution guide](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md), [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/swarmauri_live_model_openai/__init__.py), and [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/pyproject.toml) provide the supporting context for `swarmauri_live_model_openai`. The [README policy](https://github.com/groupsum/readme-standards/blob/master/docs/outline.md) defines the common document structure.
|
|
267
|
+
|
|
268
|
+
### Related Packages
|
|
269
|
+
|
|
270
|
+
- [swarmauri_base](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/20-bases/swarmauri_base/README.md): Reusable Swarmauri base classes, mixins, and dynamic Pydantic component models for composable intelligence infrastructure.
|
|
271
|
+
- [swarmauri_provider_openai](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_provider_openai/README.md): Aggregated OpenAI provider resources for Swarmauri models.
|
|
272
|
+
- [swarmauri_core](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/10-interfaces/swarmauri_core/README.md): Core interface contracts and shared types for Swarmauri composable intelligence infrastructure components.
|
|
273
|
+
- [swarmauri_transport_websocket](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_transport_websocket/README.md): Synchronous and asynchronous WebSocket client transport for Swarmauri.
|
|
274
|
+
|
|
275
|
+
### Project Links
|
|
276
|
+
|
|
277
|
+
<!-- readme-standards:begin project-links -->
|
|
278
|
+
- [pypi: swarmauri_live_model_openai](https://pypi.org/project/swarmauri_live_model_openai/)
|
|
279
|
+
<!-- readme-standards:end project-links -->
|
|
280
|
+
|
|
281
|
+
---
|
|
282
|
+
|
|
283
|
+
## Contributing
|
|
284
|
+
|
|
285
|
+
### How to Contribute
|
|
286
|
+
|
|
287
|
+
Follow the [contribution guide](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md) and include a focused example or regression for changes to `swarmauri_live_model_openai`. Keep package behavior, its documented boundary, and its tests aligned.
|
|
288
|
+
|
|
289
|
+
### Development Setup
|
|
290
|
+
|
|
291
|
+
Work from the `pkgs/50-community/swarmauri_live_model_openai` checkout. Synchronize its declared development environment with uv, then run the relevant package tests and `python -m pytest tests/unit/test_readme_sources.py`. The repository’s dedicated README job installs `readme-standards==0.1.3` without resolving unrelated runtime packages.
|
|
292
|
+
|
|
293
|
+
### Notes for Maintainers
|
|
294
|
+
|
|
295
|
+
Edit authored prose directly in this `swarmauri_live_model_openai` README. Update source examples in `docs/readme/`, then run `readme-standards render --root . --write` from the package directory and review the diff. Required headings and generated blocks come from package-guide-v1.
|
|
296
|
+
|
|
297
|
+
---
|
|
298
|
+
|
|
299
|
+
## Governance
|
|
300
|
+
|
|
301
|
+
### Ownership and Decision Making
|
|
302
|
+
|
|
303
|
+
Changes to `swarmauri_live_model_openai` follow the maintainer review process of [swarmauri/swarmauri-sdk](https://github.com/swarmauri/swarmauri-sdk) and its contribution guide. Author attribution remains in the [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/pyproject.toml); this README does not assign new publishing or administrative authority.
|
|
304
|
+
|
|
305
|
+
### Standards and Policies
|
|
306
|
+
|
|
307
|
+
`swarmauri_live_model_openai` follows the versioned [package-guide-v1 outline](https://github.com/groupsum/readme-standards/blob/master/docs/outline.md). All fixed headings, hierarchy, order, separators, and package-specific branding are checked by CI; reviewers assess the accuracy and usefulness of authored claims.
|
|
308
|
+
|
|
309
|
+
### Lifecycle and Migration
|
|
310
|
+
|
|
311
|
+
The `swarmauri_live_model_openai` source version is `0.1.0`.
|
|
312
|
+
|
|
313
|
+
---
|
|
314
|
+
|
|
315
|
+
## License and Attribution
|
|
316
|
+
|
|
317
|
+
### License
|
|
318
|
+
|
|
319
|
+
<!-- readme-standards:begin license -->
|
|
320
|
+
Licensed under `Apache-2.0`. See [LICENSE](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/LICENSE).
|
|
321
|
+
<!-- readme-standards:end license -->
|
|
322
|
+
|
|
323
|
+
### Notices
|
|
324
|
+
|
|
325
|
+
<!-- readme-standards:begin notices -->
|
|
326
|
+
See [NOTICE](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/NOTICE) for attribution.
|
|
327
|
+
<!-- readme-standards:end notices -->
|
|
328
|
+
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
# swarmauri_live_model_openai
|
|
2
|
+
|
|
3
|
+
<!-- readme-standards:begin branding -->
|
|
4
|
+
<p align="center"><a href="https://github.com/swarmauri/swarmauri-sdk"><img src="https://raw.githubusercontent.com/swarmauri/swarmauri-sdk/master/assets/swarmauri.brand.theme.svg" alt="Swarmauri SDK" width="300"></a></p>
|
|
5
|
+
<p align="center"><strong>swarmauri_live_model_openai</strong></p>
|
|
6
|
+
<p align="center">OpenAI Realtime and persistent Responses WebSocket model adapters for Swarmauri.</p>
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://pypi.org/project/swarmauri_live_model_openai/"><img alt="pypi: swarmauri_live_model_openai" src="https://img.shields.io/pypi/v/swarmauri_live_model_openai?labelColor=1E293B&color=1D4ED8"></a>
|
|
9
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/pyproject.toml"><img alt="Source version: 0.1.0" src="https://img.shields.io/static/v1?label=Source%20version&message=0.1.0&labelColor=1E293B&color=4338CA"></a>
|
|
10
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/pyproject.toml"><img alt="Python: >=3.10,<3.15" src="https://img.shields.io/static/v1?label=Python&message=%3E%3D3.10%2C%3C3.15&labelColor=1E293B&color=0F766E"></a>
|
|
11
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/pyproject.toml"><img alt="Layer: community" src="https://img.shields.io/static/v1?label=Layer&message=community&labelColor=1E293B&color=6D28D9"></a>
|
|
12
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/README.md#lifecycle-and-migration"><img alt="Lifecycle: active" src="https://img.shields.io/static/v1?label=Lifecycle&message=active&labelColor=1E293B&color=166534"></a>
|
|
13
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/LICENSE"><img alt="License: Apache-2.0" src="https://img.shields.io/static/v1?label=License&message=Apache-2.0&labelColor=1E293B&color=86198F"></a>
|
|
14
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/NOTICE"><img alt="Notice: attribution" src="https://img.shields.io/static/v1?label=Notice&message=attribution&labelColor=1E293B&color=86198F"></a>
|
|
15
|
+
</p>
|
|
16
|
+
<p align="center">
|
|
17
|
+
<a href="https://pypi.org/project/swarmauri_live_model_openai/"><img alt="Monthly PyPI downloads: swarmauri_live_model_openai" src="https://img.shields.io/pypi/dm/swarmauri_live_model_openai?labelColor=1E293B&color=0E7490"></a>
|
|
18
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/README.md"><img alt="README hits: swarmauri_live_model_openai" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/pkgs/50-community/swarmauri_live_model_openai/README.md.svg?label=README%20hits&labelColor=1E293B&color=0E7490"></a>
|
|
19
|
+
</p>
|
|
20
|
+
<p align="center">
|
|
21
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/actions/workflows/readme-standards.yml"><img alt="README standards: CI gate" src="https://img.shields.io/static/v1?label=README%20standards&message=CI%20gate&labelColor=1E293B&color=1D4ED8"></a>
|
|
22
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/tests/unit/test_readme_sources.py"><img alt="Tests: example source" src="https://img.shields.io/static/v1?label=Tests&message=example%20source&labelColor=1E293B&color=0F766E"></a>
|
|
23
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/README.md#certification-status"><img alt="Certification: not certified" src="https://img.shields.io/static/v1?label=Certification&message=not%20certified&labelColor=1E293B&color=92400E"></a>
|
|
24
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/tools/readme/POLICY.md"><img alt="Governance: repository policy" src="https://img.shields.io/static/v1?label=Governance&message=repository%20policy&labelColor=1E293B&color=4338CA"></a>
|
|
25
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/actions/workflows/readme-standards.yml"><img alt="Evidence: source and CI" src="https://img.shields.io/static/v1?label=Evidence&message=source%20and%20CI&labelColor=1E293B&color=6D28D9"></a>
|
|
26
|
+
</p>
|
|
27
|
+
<p align="center"><a href="#overview">Overview</a> · <a href="#installation">Installation</a> · <a href="#quick-start">Quick Start</a> · <a href="#usage">Usage</a> · <a href="#public-api-and-import-surfaces">API</a> · <a href="#contributing">Contributing</a> · <a href="#governance">Governance</a> · <a href="#license">License</a></p>
|
|
28
|
+
<!-- readme-standards:end branding -->
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Overview
|
|
33
|
+
|
|
34
|
+
### Summary
|
|
35
|
+
|
|
36
|
+
[](https://pypi.org/project/swarmauri_live_model_openai/) [](https://pypi.org/project/swarmauri_live_model_openai/) [](LICENSE) [](https://pepy.tech/project/swarmauri_live_model_openai) [](https://hits.sh/github.com/swarmauri/swarmauri-sdk/)
|
|
37
|
+
|
|
38
|
+
### Why This Package
|
|
39
|
+
|
|
40
|
+
`swarmauri_live_model_openai` isolates this responsibility: OpenAI Realtime and persistent Responses WebSocket model adapters for Swarmauri. Its [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/swarmauri_live_model_openai/__init__.py) exposes `OpenAIRealtimeCodec`, `OpenAIRealtimeConfigMapper`, `OpenAIRealtimeModel`, `OpenAIRealtimeSession`, `OpenAIRealtimeToolAdapter`, `OpenAIResponsesWSModel`, allowing consumers to select this package without treating adjacent packages as part of its public contract.
|
|
41
|
+
|
|
42
|
+
### When to Use
|
|
43
|
+
|
|
44
|
+
Choose `swarmauri_live_model_openai` when your integration needs openAI Realtime and persistent Responses WebSocket model adapters for Swarmauri. Match the imports below to your application boundary and install its declared dependencies before using the example.
|
|
45
|
+
|
|
46
|
+
### Features
|
|
47
|
+
|
|
48
|
+
- OpenAI Realtime multimodal conversations over WebSocket.
|
|
49
|
+
- Persistent Responses WebSocket adapter.
|
|
50
|
+
- Typed text, audio, transcripts, tools, interruption, and usage events.
|
|
51
|
+
|
|
52
|
+
### Non-Goals
|
|
53
|
+
|
|
54
|
+
`swarmauri_live_model_openai` owns openAI Realtime and persistent Responses WebSocket model adapters for Swarmauri. Its imports do not by themselves configure credentials, deploy a service, or certify the behavior of its consumers. Dependencies and neighboring packages retain their own documented responsibilities.
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Getting Started
|
|
59
|
+
|
|
60
|
+
### Prerequisites
|
|
61
|
+
|
|
62
|
+
Python `>=3.10,<3.15` is required. The [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/pyproject.toml) declares runtime dependencies including `swarmauri-core`, `swarmauri-base`, `swarmauri-provider-openai`, `swarmauri-transport-websocket`. Read the example’s inputs and service requirements before execution.
|
|
63
|
+
|
|
64
|
+
### Installation
|
|
65
|
+
|
|
66
|
+
`uv add swarmauri_live_model_openai` or `pip install swarmauri_live_model_openai`.
|
|
67
|
+
|
|
68
|
+
#### uv
|
|
69
|
+
|
|
70
|
+
<!-- readme-standards:begin installation.uv -->
|
|
71
|
+
```bash
|
|
72
|
+
uv add swarmauri_live_model_openai
|
|
73
|
+
```
|
|
74
|
+
<!-- readme-standards:end installation.uv -->
|
|
75
|
+
|
|
76
|
+
#### pip
|
|
77
|
+
|
|
78
|
+
<!-- readme-standards:begin installation.pip -->
|
|
79
|
+
```bash
|
|
80
|
+
python -m pip install swarmauri_live_model_openai
|
|
81
|
+
```
|
|
82
|
+
<!-- readme-standards:end installation.pip -->
|
|
83
|
+
|
|
84
|
+
#### Poetry
|
|
85
|
+
|
|
86
|
+
<!-- readme-standards:begin installation.poetry -->
|
|
87
|
+
```bash
|
|
88
|
+
poetry add swarmauri_live_model_openai
|
|
89
|
+
```
|
|
90
|
+
<!-- readme-standards:end installation.poetry -->
|
|
91
|
+
|
|
92
|
+
### Quick Start
|
|
93
|
+
|
|
94
|
+
#### Example
|
|
95
|
+
|
|
96
|
+
<!-- readme-standards:begin example.quick-start -->
|
|
97
|
+
Source: [docs/readme/quick_start.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/docs/readme/quick_start.py).
|
|
98
|
+
|
|
99
|
+
```python
|
|
100
|
+
import importlib
|
|
101
|
+
|
|
102
|
+
package = importlib.import_module("swarmauri_live_model_openai")
|
|
103
|
+
assert package.__name__ == "swarmauri_live_model_openai"
|
|
104
|
+
```
|
|
105
|
+
<!-- readme-standards:end example.quick-start -->
|
|
106
|
+
|
|
107
|
+
#### Expected Result
|
|
108
|
+
|
|
109
|
+
This quick start is explicitly an import smoke check for `swarmauri_live_model_openai`. It confirms that the documented namespace loads; it does not demonstrate or certify a complete application workflow. The detailed source and retained usage guidance below describe the integration boundary.
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## Usage
|
|
114
|
+
|
|
115
|
+
### Common Workflows
|
|
116
|
+
|
|
117
|
+
<!-- readme-standards:begin example.usage -->
|
|
118
|
+
Source: [docs/readme/usage.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/docs/readme/usage.py).
|
|
119
|
+
|
|
120
|
+
```python
|
|
121
|
+
import importlib
|
|
122
|
+
|
|
123
|
+
package = importlib.import_module("swarmauri_live_model_openai")
|
|
124
|
+
assert package.__name__ == "swarmauri_live_model_openai"
|
|
125
|
+
```
|
|
126
|
+
<!-- readme-standards:end example.usage -->
|
|
127
|
+
|
|
128
|
+
Inject an `OpenAIProvider`, connect with `LiveConfigBase`, send typed inputs, and consume the session event stream.
|
|
129
|
+
|
|
130
|
+
### Configuration
|
|
131
|
+
|
|
132
|
+
Configure `swarmauri_live_model_openai` through the APIs in [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/swarmauri_live_model_openai/__init__.py); its [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/pyproject.toml) describes installation requirements, not an implicit service configuration. No additional package-global configuration contract is inferred from dependencies.
|
|
133
|
+
|
|
134
|
+
### Error Handling
|
|
135
|
+
|
|
136
|
+
The inspected `swarmauri_live_model_openai` source raises `ValueError`. Handle these at the calling boundary and consult the implementation for the triggering conditions.
|
|
137
|
+
|
|
138
|
+
### Best Practices
|
|
139
|
+
|
|
140
|
+
Use the explicit `swarmauri_live_model_openai` imports documented below and keep collaborator configuration with the caller. Run the package’s relevant tests after changing `OpenAIRealtimeCodec`, `OpenAIRealtimeConfigMapper`, `OpenAIRealtimeModel`, `OpenAIRealtimeSession`, `OpenAIRealtimeToolAdapter`, `OpenAIResponsesWSModel`; an import or successful installation alone does not establish its runtime guarantees.
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## Package Boundary
|
|
145
|
+
|
|
146
|
+
### What It Owns
|
|
147
|
+
|
|
148
|
+
`swarmauri_live_model_openai` is located in `community` and owns openAI Realtime and persistent Responses WebSocket model adapters for Swarmauri. Source-declared APIs include `OpenAIRealtimeCodec`, `OpenAIRealtimeConfigMapper`, `OpenAIRealtimeModel`, `OpenAIRealtimeSession`, `OpenAIRealtimeToolAdapter`, `OpenAIResponsesWSModel`. The [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/pyproject.toml) records its direct dependency boundary.
|
|
149
|
+
|
|
150
|
+
### Public API and Import Surfaces
|
|
151
|
+
|
|
152
|
+
Import namespace: `swarmauri_live_model_openai`.
|
|
153
|
+
|
|
154
|
+
Source-declared exports or types: `OpenAIRealtimeCodec`, `OpenAIRealtimeConfigMapper`, `OpenAIRealtimeModel`, `OpenAIRealtimeSession`, `OpenAIRealtimeToolAdapter`, `OpenAIResponsesWSModel`.
|
|
155
|
+
|
|
156
|
+
Inspect [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/swarmauri_live_model_openai/__init__.py) for exact signatures; this inventory does not designate every internal module as stable.
|
|
157
|
+
|
|
158
|
+
### Entry Points
|
|
159
|
+
|
|
160
|
+
<!-- readme-standards:begin entry-points -->
|
|
161
|
+
- `swarmauri.live_models` → `OpenAIRealtimeModel` → `swarmauri_live_model_openai:OpenAIRealtimeModel`
|
|
162
|
+
- `swarmauri.live_models` → `OpenAIResponsesWSModel` → `swarmauri_live_model_openai:OpenAIResponsesWSModel`
|
|
163
|
+
<!-- readme-standards:end entry-points -->
|
|
164
|
+
|
|
165
|
+
### Injected Dependencies
|
|
166
|
+
|
|
167
|
+
The direct installation dependencies of `swarmauri_live_model_openai` are `swarmauri-core`, `swarmauri-base`, `swarmauri-provider-openai`, `swarmauri-transport-websocket`. These declarations do not imply automatic provider selection. Pass collaborators through the explicit constructors or call signatures in [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/swarmauri_live_model_openai/__init__.py).
|
|
168
|
+
|
|
169
|
+
### Protocol Consumers
|
|
170
|
+
|
|
171
|
+
No direct package-manifest dependency on `swarmauri_live_model_openai` was found in the audited three-repository inventory. External consumers may still use its documented imports or commands.
|
|
172
|
+
|
|
173
|
+
### Extensions
|
|
174
|
+
|
|
175
|
+
For `swarmauri_live_model_openai`, use the source-declared public interfaces (`OpenAIRealtimeCodec`, `OpenAIRealtimeConfigMapper`, `OpenAIRealtimeModel`, `OpenAIRealtimeSession`, `OpenAIRealtimeToolAdapter`, `OpenAIResponsesWSModel`) when composing or extending behavior. Its entry-point section below is authoritative for registered plugins; no additional extension loader is inferred from the package name.
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## Operations and Readiness
|
|
180
|
+
|
|
181
|
+
### Operational Requirements
|
|
182
|
+
|
|
183
|
+
Operate `swarmauri_live_model_openai` according to its actual entry points and collaborators. The dependency and Python requirements in the [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/pyproject.toml) are prerequisites; deployment topology, credentials, and readiness remain the responsibility of the consuming application unless explicitly documented above.
|
|
184
|
+
|
|
185
|
+
### Health and Observability
|
|
186
|
+
|
|
187
|
+
This README does not establish a standalone health endpoint for `swarmauri_live_model_openai`. Observe the concrete caller’s results, exceptions, and existing test reports. An application that embeds this package must define its own health and telemetry contract.
|
|
188
|
+
|
|
189
|
+
### Security and Resource Limits
|
|
190
|
+
|
|
191
|
+
Apply the input, credential, and resource constraints implemented in [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/swarmauri_live_model_openai/__init__.py). The `swarmauri_live_model_openai` README gate is a documentation check, not a security review or a substitute for the implementation’s limits and caller authorization.
|
|
192
|
+
|
|
193
|
+
### Compatibility
|
|
194
|
+
|
|
195
|
+
This source version of `swarmauri_live_model_openai` declares Python `>=3.10,<3.15`. Consult its dependency constraints before upgrading. Source-version and registry-version badges have separate meanings; this migration makes no additional platform or interoperability certification claim.
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
## Verification
|
|
200
|
+
|
|
201
|
+
### Tests
|
|
202
|
+
|
|
203
|
+
Run `python -m pytest tests/unit/test_readme_sources.py` from the `swarmauri_live_model_openai` package directory for the maintained example source checks (Python compilation and non-Python file presence). Existing package tests include:
|
|
204
|
+
|
|
205
|
+
- [tests/unit/test_helper_methods.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/tests/unit/test_helper_methods.py)
|
|
206
|
+
- [tests/unit/test_openai_live_connections.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/tests/unit/test_openai_live_connections.py)
|
|
207
|
+
- [tests/unit/test_openai_realtime_codec.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/tests/unit/test_openai_realtime_codec.py)
|
|
208
|
+
- [tests/unit/test_openai_realtime_session.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/tests/unit/test_openai_realtime_session.py)
|
|
209
|
+
- [tests/unit/test_package_contract.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/tests/unit/test_package_contract.py)
|
|
210
|
+
|
|
211
|
+
The repository README gate also checks the required heading tree, metadata, managed fragments, and referenced files.
|
|
212
|
+
|
|
213
|
+
### Certification Status
|
|
214
|
+
|
|
215
|
+
No external certification is asserted for `swarmauri_live_model_openai` by this documentation migration. README conformance, example syntax, runtime tests, and protocol or security certification are distinct evidence scopes.
|
|
216
|
+
|
|
217
|
+
### Evidence
|
|
218
|
+
|
|
219
|
+
The [README standards CI](https://github.com/swarmauri/swarmauri-sdk/actions/workflows/readme-standards.yml) records mechanical documentation results for its tested commit. The [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/swarmauri_live_model_openai/__init__.py) and example sources support the package-boundary description; external runtime behavior requires its own test evidence.
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
## FAQ
|
|
224
|
+
|
|
225
|
+
### Why
|
|
226
|
+
|
|
227
|
+
**Why select this package?** `swarmauri_live_model_openai` provides openAI Realtime and persistent Responses WebSocket model adapters for Swarmauri; use its own API boundary rather than assuming neighboring packages are bundled or configured automatically.
|
|
228
|
+
|
|
229
|
+
### How
|
|
230
|
+
|
|
231
|
+
**How do I start?** Install or synchronize the environment under Getting Started, follow the maintained example for `swarmauri_live_model_openai`, and consult [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/swarmauri_live_model_openai/__init__.py) for the exact types and signatures involved.
|
|
232
|
+
|
|
233
|
+
### When
|
|
234
|
+
|
|
235
|
+
**When should I validate an upgrade?** Recheck `swarmauri_live_model_openai` whenever its source version, declared collaborators, configuration, or caller changes. Run relevant behavioral tests in addition to the README gate before promotion.
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
239
|
+
## Documentation and Related Packages
|
|
240
|
+
|
|
241
|
+
### More Documentation
|
|
242
|
+
|
|
243
|
+
The [repository contribution guide](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md), [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/swarmauri_live_model_openai/__init__.py), and [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/pyproject.toml) provide the supporting context for `swarmauri_live_model_openai`. The [README policy](https://github.com/groupsum/readme-standards/blob/master/docs/outline.md) defines the common document structure.
|
|
244
|
+
|
|
245
|
+
### Related Packages
|
|
246
|
+
|
|
247
|
+
- [swarmauri_base](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/20-bases/swarmauri_base/README.md): Reusable Swarmauri base classes, mixins, and dynamic Pydantic component models for composable intelligence infrastructure.
|
|
248
|
+
- [swarmauri_provider_openai](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_provider_openai/README.md): Aggregated OpenAI provider resources for Swarmauri models.
|
|
249
|
+
- [swarmauri_core](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/10-interfaces/swarmauri_core/README.md): Core interface contracts and shared types for Swarmauri composable intelligence infrastructure components.
|
|
250
|
+
- [swarmauri_transport_websocket](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/40-standards/swarmauri_transport_websocket/README.md): Synchronous and asynchronous WebSocket client transport for Swarmauri.
|
|
251
|
+
|
|
252
|
+
### Project Links
|
|
253
|
+
|
|
254
|
+
<!-- readme-standards:begin project-links -->
|
|
255
|
+
- [pypi: swarmauri_live_model_openai](https://pypi.org/project/swarmauri_live_model_openai/)
|
|
256
|
+
<!-- readme-standards:end project-links -->
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
## Contributing
|
|
261
|
+
|
|
262
|
+
### How to Contribute
|
|
263
|
+
|
|
264
|
+
Follow the [contribution guide](https://github.com/swarmauri/swarmauri-sdk/blob/master/CONTRIBUTING.md) and include a focused example or regression for changes to `swarmauri_live_model_openai`. Keep package behavior, its documented boundary, and its tests aligned.
|
|
265
|
+
|
|
266
|
+
### Development Setup
|
|
267
|
+
|
|
268
|
+
Work from the `pkgs/50-community/swarmauri_live_model_openai` checkout. Synchronize its declared development environment with uv, then run the relevant package tests and `python -m pytest tests/unit/test_readme_sources.py`. The repository’s dedicated README job installs `readme-standards==0.1.3` without resolving unrelated runtime packages.
|
|
269
|
+
|
|
270
|
+
### Notes for Maintainers
|
|
271
|
+
|
|
272
|
+
Edit authored prose directly in this `swarmauri_live_model_openai` README. Update source examples in `docs/readme/`, then run `readme-standards render --root . --write` from the package directory and review the diff. Required headings and generated blocks come from package-guide-v1.
|
|
273
|
+
|
|
274
|
+
---
|
|
275
|
+
|
|
276
|
+
## Governance
|
|
277
|
+
|
|
278
|
+
### Ownership and Decision Making
|
|
279
|
+
|
|
280
|
+
Changes to `swarmauri_live_model_openai` follow the maintainer review process of [swarmauri/swarmauri-sdk](https://github.com/swarmauri/swarmauri-sdk) and its contribution guide. Author attribution remains in the [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/pyproject.toml); this README does not assign new publishing or administrative authority.
|
|
281
|
+
|
|
282
|
+
### Standards and Policies
|
|
283
|
+
|
|
284
|
+
`swarmauri_live_model_openai` follows the versioned [package-guide-v1 outline](https://github.com/groupsum/readme-standards/blob/master/docs/outline.md). All fixed headings, hierarchy, order, separators, and package-specific branding are checked by CI; reviewers assess the accuracy and usefulness of authored claims.
|
|
285
|
+
|
|
286
|
+
### Lifecycle and Migration
|
|
287
|
+
|
|
288
|
+
The `swarmauri_live_model_openai` source version is `0.1.0`.
|
|
289
|
+
|
|
290
|
+
---
|
|
291
|
+
|
|
292
|
+
## License and Attribution
|
|
293
|
+
|
|
294
|
+
### License
|
|
295
|
+
|
|
296
|
+
<!-- readme-standards:begin license -->
|
|
297
|
+
Licensed under `Apache-2.0`. See [LICENSE](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/LICENSE).
|
|
298
|
+
<!-- readme-standards:end license -->
|
|
299
|
+
|
|
300
|
+
### Notices
|
|
301
|
+
|
|
302
|
+
<!-- readme-standards:begin notices -->
|
|
303
|
+
See [NOTICE](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/NOTICE) for attribution.
|
|
304
|
+
<!-- readme-standards:end notices -->
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "swarmauri_live_model_openai"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "OpenAI Realtime and persistent Responses WebSocket model adapters for Swarmauri."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.10,<3.15"
|
|
7
|
+
authors = [{ name = "Jacob Stewart", email = "jacob@swarmauri.com" }]
|
|
8
|
+
license = "Apache-2.0"
|
|
9
|
+
dependencies = ["swarmauri_core<0.12,>=0.11.0", "swarmauri_base<0.12,>=0.11.0", "swarmauri_provider_openai>=0.1.0", "swarmauri_transport_websocket>=0.1.0"]
|
|
10
|
+
classifiers = [
|
|
11
|
+
"Development Status :: 1 - Planning",
|
|
12
|
+
"Programming Language :: Python :: 3.10",
|
|
13
|
+
"Programming Language :: Python :: 3.11",
|
|
14
|
+
"Programming Language :: Python :: 3.12",
|
|
15
|
+
"Programming Language :: Python :: 3.13",
|
|
16
|
+
"Programming Language :: Python :: 3.14",
|
|
17
|
+
]
|
|
18
|
+
keywords = ["swarmauri", "openai realtime", "websocket", "audio", "tools"]
|
|
19
|
+
license-files = ["LICENSE", "NOTICE"]
|
|
20
|
+
[tool.uv.sources]
|
|
21
|
+
swarmauri_core = { workspace = true }
|
|
22
|
+
swarmauri_base = { workspace = true }
|
|
23
|
+
swarmauri_provider_openai = { workspace = true }
|
|
24
|
+
swarmauri_transport_websocket = { workspace = true }
|
|
25
|
+
|
|
26
|
+
[tool.readme_standards]
|
|
27
|
+
policy = "package-guide-v1"
|
|
28
|
+
readme = "README.md"
|
|
29
|
+
brand = "swarmauri"
|
|
30
|
+
brand_catalog = "../../../tools/readme/brands.toml"
|
|
31
|
+
repository = "https://github.com/swarmauri/swarmauri-sdk"
|
|
32
|
+
ref = "master"
|
|
33
|
+
package_path = "pkgs/50-community/swarmauri_live_model_openai"
|
|
34
|
+
layer = "community"
|
|
35
|
+
lifecycle = "active"
|
|
36
|
+
license_file = "LICENSE"
|
|
37
|
+
notice_file = "NOTICE"
|
|
38
|
+
|
|
39
|
+
[tool.readme_standards.distributions.pypi]
|
|
40
|
+
name = "swarmauri_live_model_openai"
|
|
41
|
+
published = true
|
|
42
|
+
|
|
43
|
+
[tool.readme_standards.examples.quick_start]
|
|
44
|
+
source = "docs/readme/quick_start.py"
|
|
45
|
+
test = "tests/unit/test_readme_sources.py"
|
|
46
|
+
language = "python"
|
|
47
|
+
expected_exit_code = 0
|
|
48
|
+
|
|
49
|
+
[tool.readme_standards.examples.usage]
|
|
50
|
+
source = "docs/readme/usage.py"
|
|
51
|
+
test = "tests/unit/test_readme_sources.py"
|
|
52
|
+
language = "python"
|
|
53
|
+
expected_exit_code = 0
|
|
54
|
+
|
|
55
|
+
[tool.readme_standards.statuses.readme]
|
|
56
|
+
label = "CI gate"
|
|
57
|
+
url = "https://github.com/swarmauri/swarmauri-sdk/actions/workflows/readme-standards.yml"
|
|
58
|
+
|
|
59
|
+
[tool.readme_standards.statuses.tests]
|
|
60
|
+
label = "example source"
|
|
61
|
+
url = "https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/tests/unit/test_readme_sources.py"
|
|
62
|
+
|
|
63
|
+
[tool.readme_standards.statuses.certification]
|
|
64
|
+
label = "not certified"
|
|
65
|
+
url = "https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_openai/README.md#certification-status"
|
|
66
|
+
|
|
67
|
+
[tool.readme_standards.statuses.governance]
|
|
68
|
+
label = "repository policy"
|
|
69
|
+
url = "https://github.com/swarmauri/swarmauri-sdk/blob/master/tools/readme/POLICY.md"
|
|
70
|
+
|
|
71
|
+
[tool.readme_standards.statuses.evidence]
|
|
72
|
+
label = "source and CI"
|
|
73
|
+
url = "https://github.com/swarmauri/swarmauri-sdk/actions/workflows/readme-standards.yml"
|
|
74
|
+
[project.entry-points."swarmauri.live_models"]
|
|
75
|
+
OpenAIRealtimeModel = "swarmauri_live_model_openai:OpenAIRealtimeModel"
|
|
76
|
+
OpenAIResponsesWSModel = "swarmauri_live_model_openai:OpenAIResponsesWSModel"
|
|
77
|
+
[build-system]
|
|
78
|
+
requires = ["poetry-core>=1.8.0"]
|
|
79
|
+
build-backend = "poetry.core.masonry.api"
|
|
80
|
+
[dependency-groups]
|
|
81
|
+
dev = ["pytest>=8.0", "pytest-asyncio>=0.24", "ruff>=0.9.9", "swarmauri_tests_component", "readme-standards==0.1.3; python_version >= \"3.11\""]
|
|
82
|
+
|
|
83
|
+
[tool.ruff]
|
|
84
|
+
extend = "../../pyproject.toml"
|
|
85
|
+
|
|
86
|
+
[tool.ruff.lint]
|
|
87
|
+
ignore = ["BLE001", "N999"]
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import base64
|
|
2
|
+
import json
|
|
3
|
+
from typing import Any
|
|
4
|
+
|
|
5
|
+
from swarmauri_base.live_models.events.AudioDeltaEvent import AudioDeltaEvent
|
|
6
|
+
from swarmauri_base.live_models.events.InputTranscriptDeltaEvent import (
|
|
7
|
+
InputTranscriptDeltaEvent,
|
|
8
|
+
)
|
|
9
|
+
from swarmauri_base.live_models.events.InterruptionEvent import (
|
|
10
|
+
InterruptionEvent,
|
|
11
|
+
)
|
|
12
|
+
from swarmauri_base.live_models.events.OutputTranscriptDeltaEvent import (
|
|
13
|
+
OutputTranscriptDeltaEvent,
|
|
14
|
+
)
|
|
15
|
+
from swarmauri_base.live_models.events.SessionErrorEvent import (
|
|
16
|
+
SessionErrorEvent,
|
|
17
|
+
)
|
|
18
|
+
from swarmauri_base.live_models.events.TextDeltaEvent import TextDeltaEvent
|
|
19
|
+
from swarmauri_base.live_models.events.ToolCallEvent import ToolCallEvent
|
|
20
|
+
from swarmauri_base.live_models.events.TurnCompleteEvent import (
|
|
21
|
+
TurnCompleteEvent,
|
|
22
|
+
)
|
|
23
|
+
from swarmauri_base.live_models.events.UsageEvent import UsageEvent
|
|
24
|
+
from swarmauri_base.live_models.LiveEventBase import LiveEventBase
|
|
25
|
+
from swarmauri_base.live_models.LiveInputBase import LiveInputBase
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class OpenAIRealtimeCodec:
|
|
29
|
+
def encode(self, input_data: LiveInputBase) -> list[str]:
|
|
30
|
+
if input_data.kind == "text":
|
|
31
|
+
return [
|
|
32
|
+
json.dumps(
|
|
33
|
+
{
|
|
34
|
+
"type": "conversation.item.create",
|
|
35
|
+
"item": {
|
|
36
|
+
"type": "message",
|
|
37
|
+
"role": "user",
|
|
38
|
+
"content": [
|
|
39
|
+
{
|
|
40
|
+
"type": "input_text",
|
|
41
|
+
"text": input_data.payload,
|
|
42
|
+
}
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
}
|
|
46
|
+
),
|
|
47
|
+
json.dumps({"type": "response.create"}),
|
|
48
|
+
]
|
|
49
|
+
if input_data.kind == "audio":
|
|
50
|
+
return [
|
|
51
|
+
json.dumps(
|
|
52
|
+
{
|
|
53
|
+
"type": "input_audio_buffer.append",
|
|
54
|
+
"audio": base64.b64encode(input_data.payload).decode(),
|
|
55
|
+
}
|
|
56
|
+
)
|
|
57
|
+
]
|
|
58
|
+
if input_data.kind == "image":
|
|
59
|
+
encoded = base64.b64encode(input_data.payload).decode()
|
|
60
|
+
image_url = f"data:{input_data.mime_type};base64,{encoded}"
|
|
61
|
+
return [
|
|
62
|
+
json.dumps(
|
|
63
|
+
{
|
|
64
|
+
"type": "conversation.item.create",
|
|
65
|
+
"item": {
|
|
66
|
+
"type": "message",
|
|
67
|
+
"role": "user",
|
|
68
|
+
"content": [
|
|
69
|
+
{
|
|
70
|
+
"type": "input_image",
|
|
71
|
+
"image_url": image_url,
|
|
72
|
+
}
|
|
73
|
+
],
|
|
74
|
+
},
|
|
75
|
+
}
|
|
76
|
+
)
|
|
77
|
+
]
|
|
78
|
+
if input_data.kind == "tool_result":
|
|
79
|
+
return [
|
|
80
|
+
json.dumps(
|
|
81
|
+
{
|
|
82
|
+
"type": "conversation.item.create",
|
|
83
|
+
"item": {
|
|
84
|
+
"type": "function_call_output",
|
|
85
|
+
"call_id": input_data.call_id,
|
|
86
|
+
"output": json.dumps(input_data.payload),
|
|
87
|
+
},
|
|
88
|
+
}
|
|
89
|
+
),
|
|
90
|
+
json.dumps({"type": "response.create"}),
|
|
91
|
+
]
|
|
92
|
+
if input_data.kind == "commit_turn":
|
|
93
|
+
return [
|
|
94
|
+
json.dumps({"type": "input_audio_buffer.commit"}),
|
|
95
|
+
json.dumps({"type": "response.create"}),
|
|
96
|
+
]
|
|
97
|
+
if input_data.kind == "interrupt":
|
|
98
|
+
return [json.dumps({"type": "response.cancel"})]
|
|
99
|
+
raise ValueError(
|
|
100
|
+
f"Unsupported OpenAI realtime input: {input_data.kind}"
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
def decode(self, message: str | bytes) -> list[LiveEventBase]:
|
|
104
|
+
data: dict[str, Any] = json.loads(message)
|
|
105
|
+
kind = data.get("type", "")
|
|
106
|
+
correlation = {
|
|
107
|
+
"provider_event_id": data.get("event_id"),
|
|
108
|
+
"response_id": data.get("response_id")
|
|
109
|
+
or data.get("response", {}).get("id"),
|
|
110
|
+
"item_id": data.get("item_id"),
|
|
111
|
+
"call_id": data.get("call_id"),
|
|
112
|
+
}
|
|
113
|
+
if kind in {"response.output_text.delta", "response.text.delta"}:
|
|
114
|
+
return [
|
|
115
|
+
TextDeltaEvent(
|
|
116
|
+
payload=data.get("delta", ""), correlation=correlation
|
|
117
|
+
)
|
|
118
|
+
]
|
|
119
|
+
if kind in {"response.output_audio.delta", "response.audio.delta"}:
|
|
120
|
+
return [
|
|
121
|
+
AudioDeltaEvent(
|
|
122
|
+
payload=base64.b64decode(data.get("delta", "")),
|
|
123
|
+
correlation=correlation,
|
|
124
|
+
)
|
|
125
|
+
]
|
|
126
|
+
if kind in {
|
|
127
|
+
"response.output_audio_transcript.delta",
|
|
128
|
+
"response.audio_transcript.delta",
|
|
129
|
+
}:
|
|
130
|
+
return [
|
|
131
|
+
OutputTranscriptDeltaEvent(
|
|
132
|
+
payload=data.get("delta", ""), correlation=correlation
|
|
133
|
+
)
|
|
134
|
+
]
|
|
135
|
+
if "input_audio_transcription" in kind:
|
|
136
|
+
text = data.get("delta") or data.get("transcript", "")
|
|
137
|
+
return [
|
|
138
|
+
InputTranscriptDeltaEvent(
|
|
139
|
+
payload=text, correlation=correlation
|
|
140
|
+
)
|
|
141
|
+
]
|
|
142
|
+
if kind == "response.function_call_arguments.done":
|
|
143
|
+
arguments = data.get("arguments", {})
|
|
144
|
+
if isinstance(arguments, str):
|
|
145
|
+
arguments = json.loads(arguments or "{}")
|
|
146
|
+
return [
|
|
147
|
+
ToolCallEvent(
|
|
148
|
+
call_id=data.get("call_id", ""),
|
|
149
|
+
tool_name=data.get("name", ""),
|
|
150
|
+
arguments=arguments,
|
|
151
|
+
correlation=correlation,
|
|
152
|
+
)
|
|
153
|
+
]
|
|
154
|
+
if kind == "input_audio_buffer.speech_started":
|
|
155
|
+
return [
|
|
156
|
+
InterruptionEvent(
|
|
157
|
+
reason="speech_started", correlation=correlation
|
|
158
|
+
)
|
|
159
|
+
]
|
|
160
|
+
if kind == "response.done":
|
|
161
|
+
events: list[LiveEventBase] = [
|
|
162
|
+
TurnCompleteEvent(correlation=correlation)
|
|
163
|
+
]
|
|
164
|
+
usage = data.get("response", {}).get("usage")
|
|
165
|
+
if usage:
|
|
166
|
+
events.append(
|
|
167
|
+
UsageEvent(
|
|
168
|
+
payload={
|
|
169
|
+
key: int(value)
|
|
170
|
+
for key, value in usage.items()
|
|
171
|
+
if isinstance(value, int)
|
|
172
|
+
},
|
|
173
|
+
correlation=correlation,
|
|
174
|
+
)
|
|
175
|
+
)
|
|
176
|
+
return events
|
|
177
|
+
if kind == "error":
|
|
178
|
+
return [
|
|
179
|
+
SessionErrorEvent(
|
|
180
|
+
message=str(data.get("error", data)),
|
|
181
|
+
correlation=correlation,
|
|
182
|
+
)
|
|
183
|
+
]
|
|
184
|
+
return []
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from typing import Any
|
|
2
|
+
|
|
3
|
+
from swarmauri_base.live_models.LiveConfigBase import LiveConfigBase
|
|
4
|
+
from swarmauri_provider_openai import OpenAIToolSchemaConverter
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class OpenAIRealtimeConfigMapper:
|
|
8
|
+
def map(self, config: LiveConfigBase) -> dict[str, Any]:
|
|
9
|
+
session: dict[str, Any] = {
|
|
10
|
+
"type": "realtime",
|
|
11
|
+
"output_modalities": config.requested_modalities,
|
|
12
|
+
}
|
|
13
|
+
if config.tools:
|
|
14
|
+
converter = OpenAIToolSchemaConverter()
|
|
15
|
+
session["tools"] = [
|
|
16
|
+
converter.convert(tool) for tool in config.tools
|
|
17
|
+
]
|
|
18
|
+
session.update(config.provider_options.get("session", {}))
|
|
19
|
+
return {"type": "session.update", "session": session}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
from typing import Any, Literal
|
|
2
|
+
from pydantic import ConfigDict, Field
|
|
3
|
+
from swarmauri_base.ComponentBase import ComponentBase
|
|
4
|
+
from swarmauri_base.live_models.LiveCapabilitiesBase import (
|
|
5
|
+
LiveCapabilitiesBase,
|
|
6
|
+
)
|
|
7
|
+
from swarmauri_base.live_models.LiveConfigBase import LiveConfigBase
|
|
8
|
+
from swarmauri_base.live_models.LiveModelBase import LiveModelBase
|
|
9
|
+
from swarmauri_provider_openai import OpenAIProvider
|
|
10
|
+
from swarmauri_transport_websocket import WebSocketClient
|
|
11
|
+
|
|
12
|
+
from .OpenAIRealtimeConfigMapper import OpenAIRealtimeConfigMapper
|
|
13
|
+
from .OpenAIRealtimeSession import OpenAIRealtimeSession
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@ComponentBase.register_type(LiveModelBase, "OpenAIRealtimeModel")
|
|
17
|
+
class OpenAIRealtimeModel(LiveModelBase):
|
|
18
|
+
name: str = "gpt-realtime"
|
|
19
|
+
provider: OpenAIProvider = Field(default_factory=OpenAIProvider)
|
|
20
|
+
transport: Any = Field(default_factory=WebSocketClient, exclude=True)
|
|
21
|
+
capabilities: LiveCapabilitiesBase = Field(
|
|
22
|
+
default_factory=lambda: LiveCapabilitiesBase(
|
|
23
|
+
input_modalities=frozenset({"text", "audio", "image"}),
|
|
24
|
+
output_modalities=frozenset({"text", "audio"}),
|
|
25
|
+
features=frozenset({"tools", "transcription"}),
|
|
26
|
+
session_features=frozenset({"realtime", "interruption"}),
|
|
27
|
+
)
|
|
28
|
+
)
|
|
29
|
+
type: Literal["OpenAIRealtimeModel"] = "OpenAIRealtimeModel"
|
|
30
|
+
model_config = ConfigDict(arbitrary_types_allowed=True, extra="allow")
|
|
31
|
+
|
|
32
|
+
async def aconnect(self, config: LiveConfigBase) -> OpenAIRealtimeSession:
|
|
33
|
+
connection_config = self.provider.prepare_connection(
|
|
34
|
+
"realtime.connect", model=self.name
|
|
35
|
+
)
|
|
36
|
+
connection = await self.transport.aconnect(
|
|
37
|
+
connection_config.resolved_url(),
|
|
38
|
+
headers=connection_config.headers,
|
|
39
|
+
)
|
|
40
|
+
return await OpenAIRealtimeSession.create(
|
|
41
|
+
connection, OpenAIRealtimeConfigMapper().map(config)
|
|
42
|
+
)
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import asyncio
|
|
2
|
+
import json
|
|
3
|
+
from contextlib import suppress
|
|
4
|
+
from typing import Any, Literal
|
|
5
|
+
|
|
6
|
+
from pydantic import PrivateAttr
|
|
7
|
+
from swarmauri_base.live_models.events.SessionErrorEvent import (
|
|
8
|
+
SessionErrorEvent,
|
|
9
|
+
)
|
|
10
|
+
from swarmauri_base.live_models.LiveInputBase import LiveInputBase
|
|
11
|
+
from swarmauri_base.live_models.LiveSessionBase import LiveSessionBase
|
|
12
|
+
from swarmauri_base.ComponentBase import ComponentBase
|
|
13
|
+
from swarmauri_core.transports import IWebSocketConnection
|
|
14
|
+
|
|
15
|
+
from .OpenAIRealtimeCodec import OpenAIRealtimeCodec
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@ComponentBase.register_type(LiveSessionBase, "OpenAIRealtimeSession")
|
|
19
|
+
class OpenAIRealtimeSession(LiveSessionBase):
|
|
20
|
+
type: Literal["OpenAIRealtimeSession"] = "OpenAIRealtimeSession"
|
|
21
|
+
_connection: IWebSocketConnection = PrivateAttr()
|
|
22
|
+
_codec: OpenAIRealtimeCodec = PrivateAttr(
|
|
23
|
+
default_factory=OpenAIRealtimeCodec
|
|
24
|
+
)
|
|
25
|
+
_receiver: Any = PrivateAttr(default=None)
|
|
26
|
+
|
|
27
|
+
@classmethod
|
|
28
|
+
async def create(
|
|
29
|
+
cls, connection, setup: dict | None = None
|
|
30
|
+
) -> "OpenAIRealtimeSession":
|
|
31
|
+
session = cls()
|
|
32
|
+
session._connection = connection
|
|
33
|
+
if setup:
|
|
34
|
+
await connection.asend(json.dumps(setup))
|
|
35
|
+
session.mark_open()
|
|
36
|
+
session._receiver = asyncio.create_task(session._receive_loop())
|
|
37
|
+
return session
|
|
38
|
+
|
|
39
|
+
async def _receive_loop(self) -> None:
|
|
40
|
+
try:
|
|
41
|
+
async for message in self._connection.aiter_messages():
|
|
42
|
+
for event in self._codec.decode(message):
|
|
43
|
+
await self.emit(event)
|
|
44
|
+
except asyncio.CancelledError:
|
|
45
|
+
raise
|
|
46
|
+
except Exception as exc:
|
|
47
|
+
await self.emit(SessionErrorEvent(message=str(exc)))
|
|
48
|
+
await self.fail(exc)
|
|
49
|
+
else:
|
|
50
|
+
await self.finish()
|
|
51
|
+
|
|
52
|
+
async def _asend_impl(self, input_data: LiveInputBase) -> None:
|
|
53
|
+
for message in self._codec.encode(input_data):
|
|
54
|
+
await self._connection.asend(message)
|
|
55
|
+
|
|
56
|
+
async def _aclose_impl(self) -> None:
|
|
57
|
+
if (
|
|
58
|
+
self._receiver is not None
|
|
59
|
+
and self._receiver is not asyncio.current_task()
|
|
60
|
+
):
|
|
61
|
+
self._receiver.cancel()
|
|
62
|
+
with suppress(asyncio.CancelledError):
|
|
63
|
+
await self._receiver
|
|
64
|
+
await self._connection.aclose()
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
from swarmauri_base.live_models.inputs.ToolResultInput import ToolResultInput
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class OpenAIRealtimeToolAdapter:
|
|
5
|
+
def result(
|
|
6
|
+
self, call_id: str, value: object, *, is_error: bool = False
|
|
7
|
+
) -> ToolResultInput:
|
|
8
|
+
return ToolResultInput(
|
|
9
|
+
call_id=call_id, payload=value, is_error=is_error
|
|
10
|
+
)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from typing import Literal
|
|
2
|
+
|
|
3
|
+
from swarmauri_base.ComponentBase import ComponentBase
|
|
4
|
+
from swarmauri_base.live_models.LiveConfigBase import LiveConfigBase
|
|
5
|
+
from swarmauri_base.live_models.LiveModelBase import LiveModelBase
|
|
6
|
+
|
|
7
|
+
from .OpenAIRealtimeModel import OpenAIRealtimeModel
|
|
8
|
+
from .OpenAIRealtimeSession import OpenAIRealtimeSession
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@ComponentBase.register_type(LiveModelBase, "OpenAIResponsesWSModel")
|
|
12
|
+
class OpenAIResponsesWSModel(OpenAIRealtimeModel):
|
|
13
|
+
type: Literal["OpenAIResponsesWSModel"] = "OpenAIResponsesWSModel"
|
|
14
|
+
|
|
15
|
+
async def aconnect(self, config: LiveConfigBase) -> OpenAIRealtimeSession:
|
|
16
|
+
connection_config = self.provider.prepare_connection(
|
|
17
|
+
"responses.connect", model=self.name
|
|
18
|
+
)
|
|
19
|
+
connection = await self.transport.aconnect(
|
|
20
|
+
connection_config.resolved_url(),
|
|
21
|
+
headers=connection_config.headers,
|
|
22
|
+
)
|
|
23
|
+
return await OpenAIRealtimeSession.create(connection)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from .OpenAIRealtimeCodec import OpenAIRealtimeCodec
|
|
2
|
+
from .OpenAIRealtimeConfigMapper import OpenAIRealtimeConfigMapper
|
|
3
|
+
from .OpenAIRealtimeModel import OpenAIRealtimeModel
|
|
4
|
+
from .OpenAIRealtimeSession import OpenAIRealtimeSession
|
|
5
|
+
from .OpenAIRealtimeToolAdapter import OpenAIRealtimeToolAdapter
|
|
6
|
+
from .OpenAIResponsesWSModel import OpenAIResponsesWSModel
|
|
7
|
+
|
|
8
|
+
__all__ = [
|
|
9
|
+
"OpenAIRealtimeCodec",
|
|
10
|
+
"OpenAIRealtimeConfigMapper",
|
|
11
|
+
"OpenAIRealtimeModel",
|
|
12
|
+
"OpenAIRealtimeSession",
|
|
13
|
+
"OpenAIRealtimeToolAdapter",
|
|
14
|
+
"OpenAIResponsesWSModel",
|
|
15
|
+
]
|