swarmauri_live_model_gemini 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_gemini-0.1.0/LICENSE +13 -0
- swarmauri_live_model_gemini-0.1.0/NOTICE +7 -0
- swarmauri_live_model_gemini-0.1.0/PKG-INFO +327 -0
- swarmauri_live_model_gemini-0.1.0/README.md +303 -0
- swarmauri_live_model_gemini-0.1.0/pyproject.toml +86 -0
- swarmauri_live_model_gemini-0.1.0/swarmauri_live_model_gemini/GeminiLiveCodec.py +150 -0
- swarmauri_live_model_gemini-0.1.0/swarmauri_live_model_gemini/GeminiLiveConfigMapper.py +30 -0
- swarmauri_live_model_gemini-0.1.0/swarmauri_live_model_gemini/GeminiLiveModel.py +43 -0
- swarmauri_live_model_gemini-0.1.0/swarmauri_live_model_gemini/GeminiLiveSession.py +58 -0
- swarmauri_live_model_gemini-0.1.0/swarmauri_live_model_gemini/GeminiLiveToolAdapter.py +12 -0
- swarmauri_live_model_gemini-0.1.0/swarmauri_live_model_gemini/__init__.py +13 -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,327 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: swarmauri_live_model_gemini
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Gemini Live bidirectional multimodal model adapter for Swarmauri.
|
|
5
|
+
License-Expression: Apache-2.0
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
License-File: NOTICE
|
|
8
|
+
Keywords: swarmauri,gemini live,realtime,audio,multimodal,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_gemini (>=0.1.0)
|
|
21
|
+
Requires-Dist: swarmauri_transport_websocket (>=0.1.0)
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
|
|
24
|
+
# swarmauri_live_model_gemini
|
|
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_gemini</strong></p>
|
|
29
|
+
<p align="center">Gemini Live bidirectional multimodal model adapter for Swarmauri.</p>
|
|
30
|
+
<p align="center">
|
|
31
|
+
<a href="https://pypi.org/project/swarmauri_live_model_gemini/"><img alt="pypi: swarmauri_live_model_gemini" src="https://img.shields.io/pypi/v/swarmauri_live_model_gemini?labelColor=1E293B&color=1D4ED8"></a>
|
|
32
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_gemini/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_gemini/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_gemini/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_gemini/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_gemini/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_gemini/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_gemini/"><img alt="Monthly PyPI downloads: swarmauri_live_model_gemini" src="https://img.shields.io/pypi/dm/swarmauri_live_model_gemini?labelColor=1E293B&color=0E7490"></a>
|
|
41
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_gemini/README.md"><img alt="README hits: swarmauri_live_model_gemini" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/pkgs/50-community/swarmauri_live_model_gemini/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_gemini/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_gemini/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_gemini/) [](https://pypi.org/project/swarmauri_live_model_gemini/) [](LICENSE) [](https://pepy.tech/project/swarmauri_live_model_gemini) [](https://hits.sh/github.com/swarmauri/swarmauri-sdk/)
|
|
60
|
+
|
|
61
|
+
### Why This Package
|
|
62
|
+
|
|
63
|
+
`swarmauri_live_model_gemini` isolates this responsibility: Gemini Live bidirectional multimodal model adapter for Swarmauri. Its [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_gemini/swarmauri_live_model_gemini/__init__.py) exposes `GeminiLiveCodec`, `GeminiLiveConfigMapper`, `GeminiLiveModel`, `GeminiLiveSession`, `GeminiLiveToolAdapter`, 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_gemini` when your integration needs gemini Live bidirectional multimodal model adapter for Swarmauri. Match the imports below to your application boundary and install its declared dependencies before using the example.
|
|
68
|
+
|
|
69
|
+
### Features
|
|
70
|
+
|
|
71
|
+
- Text, audio, image, and video input.
|
|
72
|
+
- Audio and transcript output as independent event streams.
|
|
73
|
+
- Function calls, VAD/interruption events, usage, and session resumption.
|
|
74
|
+
- Synchronous façade and canonical asynchronous WebSocket session.
|
|
75
|
+
|
|
76
|
+
### Non-Goals
|
|
77
|
+
|
|
78
|
+
`swarmauri_live_model_gemini` owns gemini Live bidirectional multimodal model adapter 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.
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Getting Started
|
|
83
|
+
|
|
84
|
+
### Prerequisites
|
|
85
|
+
|
|
86
|
+
Python `>=3.10,<3.15` is required. The [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_gemini/pyproject.toml) declares runtime dependencies including `swarmauri-core`, `swarmauri-base`, `swarmauri-provider-gemini`, `swarmauri-transport-websocket`. Read the example’s inputs and service requirements before execution.
|
|
87
|
+
|
|
88
|
+
### Installation
|
|
89
|
+
|
|
90
|
+
`uv add swarmauri_live_model_gemini` or `pip install swarmauri_live_model_gemini`.
|
|
91
|
+
|
|
92
|
+
#### uv
|
|
93
|
+
|
|
94
|
+
<!-- readme-standards:begin installation.uv -->
|
|
95
|
+
```bash
|
|
96
|
+
uv add swarmauri_live_model_gemini
|
|
97
|
+
```
|
|
98
|
+
<!-- readme-standards:end installation.uv -->
|
|
99
|
+
|
|
100
|
+
#### pip
|
|
101
|
+
|
|
102
|
+
<!-- readme-standards:begin installation.pip -->
|
|
103
|
+
```bash
|
|
104
|
+
python -m pip install swarmauri_live_model_gemini
|
|
105
|
+
```
|
|
106
|
+
<!-- readme-standards:end installation.pip -->
|
|
107
|
+
|
|
108
|
+
#### Poetry
|
|
109
|
+
|
|
110
|
+
<!-- readme-standards:begin installation.poetry -->
|
|
111
|
+
```bash
|
|
112
|
+
poetry add swarmauri_live_model_gemini
|
|
113
|
+
```
|
|
114
|
+
<!-- readme-standards:end installation.poetry -->
|
|
115
|
+
|
|
116
|
+
### Quick Start
|
|
117
|
+
|
|
118
|
+
#### Example
|
|
119
|
+
|
|
120
|
+
<!-- readme-standards:begin example.quick-start -->
|
|
121
|
+
Source: [docs/readme/quick_start.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_gemini/docs/readme/quick_start.py).
|
|
122
|
+
|
|
123
|
+
```python
|
|
124
|
+
import importlib
|
|
125
|
+
|
|
126
|
+
package = importlib.import_module("swarmauri_live_model_gemini")
|
|
127
|
+
assert package.__name__ == "swarmauri_live_model_gemini"
|
|
128
|
+
```
|
|
129
|
+
<!-- readme-standards:end example.quick-start -->
|
|
130
|
+
|
|
131
|
+
#### Expected Result
|
|
132
|
+
|
|
133
|
+
This quick start is explicitly an import smoke check for `swarmauri_live_model_gemini`. 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.
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## Usage
|
|
138
|
+
|
|
139
|
+
### Common Workflows
|
|
140
|
+
|
|
141
|
+
<!-- readme-standards:begin example.usage -->
|
|
142
|
+
Source: [docs/readme/usage.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_gemini/docs/readme/usage.py).
|
|
143
|
+
|
|
144
|
+
```python
|
|
145
|
+
import importlib
|
|
146
|
+
|
|
147
|
+
package = importlib.import_module("swarmauri_live_model_gemini")
|
|
148
|
+
assert package.__name__ == "swarmauri_live_model_gemini"
|
|
149
|
+
```
|
|
150
|
+
<!-- readme-standards:end example.usage -->
|
|
151
|
+
|
|
152
|
+
Create `GeminiLiveModel(provider=GeminiProvider(api_key=...))`, connect with `LiveConfigBase`, send typed inputs, and consume typed events.
|
|
153
|
+
|
|
154
|
+
### Configuration
|
|
155
|
+
|
|
156
|
+
Configure `swarmauri_live_model_gemini` through the APIs in [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_gemini/swarmauri_live_model_gemini/__init__.py); its [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_gemini/pyproject.toml) describes installation requirements, not an implicit service configuration. No additional package-global configuration contract is inferred from dependencies.
|
|
157
|
+
|
|
158
|
+
### Error Handling
|
|
159
|
+
|
|
160
|
+
The inspected `swarmauri_live_model_gemini` source raises `ValueError`. Handle these at the calling boundary and consult the implementation for the triggering conditions.
|
|
161
|
+
|
|
162
|
+
### Best Practices
|
|
163
|
+
|
|
164
|
+
Use the explicit `swarmauri_live_model_gemini` imports documented below and keep collaborator configuration with the caller. Run the package’s relevant tests after changing `GeminiLiveCodec`, `GeminiLiveConfigMapper`, `GeminiLiveModel`, `GeminiLiveSession`, `GeminiLiveToolAdapter`; an import or successful installation alone does not establish its runtime guarantees.
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## Package Boundary
|
|
169
|
+
|
|
170
|
+
### What It Owns
|
|
171
|
+
|
|
172
|
+
`swarmauri_live_model_gemini` is located in `community` and owns gemini Live bidirectional multimodal model adapter for Swarmauri. Source-declared APIs include `GeminiLiveCodec`, `GeminiLiveConfigMapper`, `GeminiLiveModel`, `GeminiLiveSession`, `GeminiLiveToolAdapter`. The [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_gemini/pyproject.toml) records its direct dependency boundary.
|
|
173
|
+
|
|
174
|
+
### Public API and Import Surfaces
|
|
175
|
+
|
|
176
|
+
Import namespace: `swarmauri_live_model_gemini`.
|
|
177
|
+
|
|
178
|
+
Source-declared exports or types: `GeminiLiveCodec`, `GeminiLiveConfigMapper`, `GeminiLiveModel`, `GeminiLiveSession`, `GeminiLiveToolAdapter`.
|
|
179
|
+
|
|
180
|
+
Inspect [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_gemini/swarmauri_live_model_gemini/__init__.py) for exact signatures; this inventory does not designate every internal module as stable.
|
|
181
|
+
|
|
182
|
+
### Entry Points
|
|
183
|
+
|
|
184
|
+
<!-- readme-standards:begin entry-points -->
|
|
185
|
+
- `swarmauri.live_models` → `GeminiLiveModel` → `swarmauri_live_model_gemini:GeminiLiveModel`
|
|
186
|
+
<!-- readme-standards:end entry-points -->
|
|
187
|
+
|
|
188
|
+
### Injected Dependencies
|
|
189
|
+
|
|
190
|
+
The direct installation dependencies of `swarmauri_live_model_gemini` are `swarmauri-core`, `swarmauri-base`, `swarmauri-provider-gemini`, `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_gemini/swarmauri_live_model_gemini/__init__.py).
|
|
191
|
+
|
|
192
|
+
### Protocol Consumers
|
|
193
|
+
|
|
194
|
+
No direct package-manifest dependency on `swarmauri_live_model_gemini` 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_gemini`, use the source-declared public interfaces (`GeminiLiveCodec`, `GeminiLiveConfigMapper`, `GeminiLiveModel`, `GeminiLiveSession`, `GeminiLiveToolAdapter`) 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_gemini` 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_gemini/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_gemini`. 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_gemini/swarmauri_live_model_gemini/__init__.py). The `swarmauri_live_model_gemini` 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_gemini` 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_gemini` package directory for the maintained example source checks (Python compilation and non-Python file presence). Existing package tests include:
|
|
227
|
+
|
|
228
|
+
- [tests/unit/test_gemini_live_codec.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_gemini/tests/unit/test_gemini_live_codec.py)
|
|
229
|
+
- [tests/unit/test_gemini_live_model.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_gemini/tests/unit/test_gemini_live_model.py)
|
|
230
|
+
- [tests/unit/test_helper_methods.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_gemini/tests/unit/test_helper_methods.py)
|
|
231
|
+
- [tests/unit/test_package_contract.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_gemini/tests/unit/test_package_contract.py)
|
|
232
|
+
|
|
233
|
+
The repository README gate also checks the required heading tree, metadata, managed fragments, and referenced files.
|
|
234
|
+
|
|
235
|
+
### Certification Status
|
|
236
|
+
|
|
237
|
+
No external certification is asserted for `swarmauri_live_model_gemini` by this documentation migration. README conformance, example syntax, runtime tests, and protocol or security certification are distinct evidence scopes.
|
|
238
|
+
|
|
239
|
+
### Evidence
|
|
240
|
+
|
|
241
|
+
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_gemini/swarmauri_live_model_gemini/__init__.py) and example sources support the package-boundary description; external runtime behavior requires its own test evidence.
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
## FAQ
|
|
246
|
+
|
|
247
|
+
### Why
|
|
248
|
+
|
|
249
|
+
**Why select this package?** `swarmauri_live_model_gemini` provides gemini Live bidirectional multimodal model adapter for Swarmauri; use its own API boundary rather than assuming neighboring packages are bundled or configured automatically.
|
|
250
|
+
|
|
251
|
+
### How
|
|
252
|
+
|
|
253
|
+
**How do I start?** Install or synchronize the environment under Getting Started, follow the maintained example for `swarmauri_live_model_gemini`, and consult [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_gemini/swarmauri_live_model_gemini/__init__.py) for the exact types and signatures involved.
|
|
254
|
+
|
|
255
|
+
### When
|
|
256
|
+
|
|
257
|
+
**When should I validate an upgrade?** Recheck `swarmauri_live_model_gemini` whenever its source version, declared collaborators, configuration, or caller changes. Run relevant behavioral tests in addition to the README gate before promotion.
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
## Documentation and Related Packages
|
|
262
|
+
|
|
263
|
+
### More Documentation
|
|
264
|
+
|
|
265
|
+
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_gemini/swarmauri_live_model_gemini/__init__.py), and [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_gemini/pyproject.toml) provide the supporting context for `swarmauri_live_model_gemini`. The [README policy](https://github.com/groupsum/readme-standards/blob/master/docs/outline.md) defines the common document structure.
|
|
266
|
+
|
|
267
|
+
### Related Packages
|
|
268
|
+
|
|
269
|
+
- [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.
|
|
270
|
+
- [swarmauri_provider_gemini](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_provider_gemini/README.md): Aggregated Google Gemini provider resources for Swarmauri models.
|
|
271
|
+
- [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.
|
|
272
|
+
- [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.
|
|
273
|
+
|
|
274
|
+
### Project Links
|
|
275
|
+
|
|
276
|
+
<!-- readme-standards:begin project-links -->
|
|
277
|
+
- [pypi: swarmauri_live_model_gemini](https://pypi.org/project/swarmauri_live_model_gemini/)
|
|
278
|
+
<!-- readme-standards:end project-links -->
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
## Contributing
|
|
283
|
+
|
|
284
|
+
### How to Contribute
|
|
285
|
+
|
|
286
|
+
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_gemini`. Keep package behavior, its documented boundary, and its tests aligned.
|
|
287
|
+
|
|
288
|
+
### Development Setup
|
|
289
|
+
|
|
290
|
+
Work from the `pkgs/50-community/swarmauri_live_model_gemini` 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.
|
|
291
|
+
|
|
292
|
+
### Notes for Maintainers
|
|
293
|
+
|
|
294
|
+
Edit authored prose directly in this `swarmauri_live_model_gemini` 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.
|
|
295
|
+
|
|
296
|
+
---
|
|
297
|
+
|
|
298
|
+
## Governance
|
|
299
|
+
|
|
300
|
+
### Ownership and Decision Making
|
|
301
|
+
|
|
302
|
+
Changes to `swarmauri_live_model_gemini` 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_gemini/pyproject.toml); this README does not assign new publishing or administrative authority.
|
|
303
|
+
|
|
304
|
+
### Standards and Policies
|
|
305
|
+
|
|
306
|
+
`swarmauri_live_model_gemini` 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.
|
|
307
|
+
|
|
308
|
+
### Lifecycle and Migration
|
|
309
|
+
|
|
310
|
+
The `swarmauri_live_model_gemini` source version is `0.1.0`.
|
|
311
|
+
|
|
312
|
+
---
|
|
313
|
+
|
|
314
|
+
## License and Attribution
|
|
315
|
+
|
|
316
|
+
### License
|
|
317
|
+
|
|
318
|
+
<!-- readme-standards:begin license -->
|
|
319
|
+
Licensed under `Apache-2.0`. See [LICENSE](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_gemini/LICENSE).
|
|
320
|
+
<!-- readme-standards:end license -->
|
|
321
|
+
|
|
322
|
+
### Notices
|
|
323
|
+
|
|
324
|
+
<!-- readme-standards:begin notices -->
|
|
325
|
+
See [NOTICE](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_gemini/NOTICE) for attribution.
|
|
326
|
+
<!-- readme-standards:end notices -->
|
|
327
|
+
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
# swarmauri_live_model_gemini
|
|
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_gemini</strong></p>
|
|
6
|
+
<p align="center">Gemini Live bidirectional multimodal model adapter for Swarmauri.</p>
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://pypi.org/project/swarmauri_live_model_gemini/"><img alt="pypi: swarmauri_live_model_gemini" src="https://img.shields.io/pypi/v/swarmauri_live_model_gemini?labelColor=1E293B&color=1D4ED8"></a>
|
|
9
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_gemini/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_gemini/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_gemini/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_gemini/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_gemini/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_gemini/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_gemini/"><img alt="Monthly PyPI downloads: swarmauri_live_model_gemini" src="https://img.shields.io/pypi/dm/swarmauri_live_model_gemini?labelColor=1E293B&color=0E7490"></a>
|
|
18
|
+
<a href="https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_gemini/README.md"><img alt="README hits: swarmauri_live_model_gemini" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/pkgs/50-community/swarmauri_live_model_gemini/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_gemini/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_gemini/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_gemini/) [](https://pypi.org/project/swarmauri_live_model_gemini/) [](LICENSE) [](https://pepy.tech/project/swarmauri_live_model_gemini) [](https://hits.sh/github.com/swarmauri/swarmauri-sdk/)
|
|
37
|
+
|
|
38
|
+
### Why This Package
|
|
39
|
+
|
|
40
|
+
`swarmauri_live_model_gemini` isolates this responsibility: Gemini Live bidirectional multimodal model adapter for Swarmauri. Its [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_gemini/swarmauri_live_model_gemini/__init__.py) exposes `GeminiLiveCodec`, `GeminiLiveConfigMapper`, `GeminiLiveModel`, `GeminiLiveSession`, `GeminiLiveToolAdapter`, 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_gemini` when your integration needs gemini Live bidirectional multimodal model adapter for Swarmauri. Match the imports below to your application boundary and install its declared dependencies before using the example.
|
|
45
|
+
|
|
46
|
+
### Features
|
|
47
|
+
|
|
48
|
+
- Text, audio, image, and video input.
|
|
49
|
+
- Audio and transcript output as independent event streams.
|
|
50
|
+
- Function calls, VAD/interruption events, usage, and session resumption.
|
|
51
|
+
- Synchronous façade and canonical asynchronous WebSocket session.
|
|
52
|
+
|
|
53
|
+
### Non-Goals
|
|
54
|
+
|
|
55
|
+
`swarmauri_live_model_gemini` owns gemini Live bidirectional multimodal model adapter 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.
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Getting Started
|
|
60
|
+
|
|
61
|
+
### Prerequisites
|
|
62
|
+
|
|
63
|
+
Python `>=3.10,<3.15` is required. The [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_gemini/pyproject.toml) declares runtime dependencies including `swarmauri-core`, `swarmauri-base`, `swarmauri-provider-gemini`, `swarmauri-transport-websocket`. Read the example’s inputs and service requirements before execution.
|
|
64
|
+
|
|
65
|
+
### Installation
|
|
66
|
+
|
|
67
|
+
`uv add swarmauri_live_model_gemini` or `pip install swarmauri_live_model_gemini`.
|
|
68
|
+
|
|
69
|
+
#### uv
|
|
70
|
+
|
|
71
|
+
<!-- readme-standards:begin installation.uv -->
|
|
72
|
+
```bash
|
|
73
|
+
uv add swarmauri_live_model_gemini
|
|
74
|
+
```
|
|
75
|
+
<!-- readme-standards:end installation.uv -->
|
|
76
|
+
|
|
77
|
+
#### pip
|
|
78
|
+
|
|
79
|
+
<!-- readme-standards:begin installation.pip -->
|
|
80
|
+
```bash
|
|
81
|
+
python -m pip install swarmauri_live_model_gemini
|
|
82
|
+
```
|
|
83
|
+
<!-- readme-standards:end installation.pip -->
|
|
84
|
+
|
|
85
|
+
#### Poetry
|
|
86
|
+
|
|
87
|
+
<!-- readme-standards:begin installation.poetry -->
|
|
88
|
+
```bash
|
|
89
|
+
poetry add swarmauri_live_model_gemini
|
|
90
|
+
```
|
|
91
|
+
<!-- readme-standards:end installation.poetry -->
|
|
92
|
+
|
|
93
|
+
### Quick Start
|
|
94
|
+
|
|
95
|
+
#### Example
|
|
96
|
+
|
|
97
|
+
<!-- readme-standards:begin example.quick-start -->
|
|
98
|
+
Source: [docs/readme/quick_start.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_gemini/docs/readme/quick_start.py).
|
|
99
|
+
|
|
100
|
+
```python
|
|
101
|
+
import importlib
|
|
102
|
+
|
|
103
|
+
package = importlib.import_module("swarmauri_live_model_gemini")
|
|
104
|
+
assert package.__name__ == "swarmauri_live_model_gemini"
|
|
105
|
+
```
|
|
106
|
+
<!-- readme-standards:end example.quick-start -->
|
|
107
|
+
|
|
108
|
+
#### Expected Result
|
|
109
|
+
|
|
110
|
+
This quick start is explicitly an import smoke check for `swarmauri_live_model_gemini`. 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.
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## Usage
|
|
115
|
+
|
|
116
|
+
### Common Workflows
|
|
117
|
+
|
|
118
|
+
<!-- readme-standards:begin example.usage -->
|
|
119
|
+
Source: [docs/readme/usage.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_gemini/docs/readme/usage.py).
|
|
120
|
+
|
|
121
|
+
```python
|
|
122
|
+
import importlib
|
|
123
|
+
|
|
124
|
+
package = importlib.import_module("swarmauri_live_model_gemini")
|
|
125
|
+
assert package.__name__ == "swarmauri_live_model_gemini"
|
|
126
|
+
```
|
|
127
|
+
<!-- readme-standards:end example.usage -->
|
|
128
|
+
|
|
129
|
+
Create `GeminiLiveModel(provider=GeminiProvider(api_key=...))`, connect with `LiveConfigBase`, send typed inputs, and consume typed events.
|
|
130
|
+
|
|
131
|
+
### Configuration
|
|
132
|
+
|
|
133
|
+
Configure `swarmauri_live_model_gemini` through the APIs in [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_gemini/swarmauri_live_model_gemini/__init__.py); its [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_gemini/pyproject.toml) describes installation requirements, not an implicit service configuration. No additional package-global configuration contract is inferred from dependencies.
|
|
134
|
+
|
|
135
|
+
### Error Handling
|
|
136
|
+
|
|
137
|
+
The inspected `swarmauri_live_model_gemini` source raises `ValueError`. Handle these at the calling boundary and consult the implementation for the triggering conditions.
|
|
138
|
+
|
|
139
|
+
### Best Practices
|
|
140
|
+
|
|
141
|
+
Use the explicit `swarmauri_live_model_gemini` imports documented below and keep collaborator configuration with the caller. Run the package’s relevant tests after changing `GeminiLiveCodec`, `GeminiLiveConfigMapper`, `GeminiLiveModel`, `GeminiLiveSession`, `GeminiLiveToolAdapter`; an import or successful installation alone does not establish its runtime guarantees.
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## Package Boundary
|
|
146
|
+
|
|
147
|
+
### What It Owns
|
|
148
|
+
|
|
149
|
+
`swarmauri_live_model_gemini` is located in `community` and owns gemini Live bidirectional multimodal model adapter for Swarmauri. Source-declared APIs include `GeminiLiveCodec`, `GeminiLiveConfigMapper`, `GeminiLiveModel`, `GeminiLiveSession`, `GeminiLiveToolAdapter`. The [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_gemini/pyproject.toml) records its direct dependency boundary.
|
|
150
|
+
|
|
151
|
+
### Public API and Import Surfaces
|
|
152
|
+
|
|
153
|
+
Import namespace: `swarmauri_live_model_gemini`.
|
|
154
|
+
|
|
155
|
+
Source-declared exports or types: `GeminiLiveCodec`, `GeminiLiveConfigMapper`, `GeminiLiveModel`, `GeminiLiveSession`, `GeminiLiveToolAdapter`.
|
|
156
|
+
|
|
157
|
+
Inspect [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_gemini/swarmauri_live_model_gemini/__init__.py) for exact signatures; this inventory does not designate every internal module as stable.
|
|
158
|
+
|
|
159
|
+
### Entry Points
|
|
160
|
+
|
|
161
|
+
<!-- readme-standards:begin entry-points -->
|
|
162
|
+
- `swarmauri.live_models` → `GeminiLiveModel` → `swarmauri_live_model_gemini:GeminiLiveModel`
|
|
163
|
+
<!-- readme-standards:end entry-points -->
|
|
164
|
+
|
|
165
|
+
### Injected Dependencies
|
|
166
|
+
|
|
167
|
+
The direct installation dependencies of `swarmauri_live_model_gemini` are `swarmauri-core`, `swarmauri-base`, `swarmauri-provider-gemini`, `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_gemini/swarmauri_live_model_gemini/__init__.py).
|
|
168
|
+
|
|
169
|
+
### Protocol Consumers
|
|
170
|
+
|
|
171
|
+
No direct package-manifest dependency on `swarmauri_live_model_gemini` 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_gemini`, use the source-declared public interfaces (`GeminiLiveCodec`, `GeminiLiveConfigMapper`, `GeminiLiveModel`, `GeminiLiveSession`, `GeminiLiveToolAdapter`) 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_gemini` 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_gemini/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_gemini`. 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_gemini/swarmauri_live_model_gemini/__init__.py). The `swarmauri_live_model_gemini` 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_gemini` 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_gemini` package directory for the maintained example source checks (Python compilation and non-Python file presence). Existing package tests include:
|
|
204
|
+
|
|
205
|
+
- [tests/unit/test_gemini_live_codec.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_gemini/tests/unit/test_gemini_live_codec.py)
|
|
206
|
+
- [tests/unit/test_gemini_live_model.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_gemini/tests/unit/test_gemini_live_model.py)
|
|
207
|
+
- [tests/unit/test_helper_methods.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_gemini/tests/unit/test_helper_methods.py)
|
|
208
|
+
- [tests/unit/test_package_contract.py](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_gemini/tests/unit/test_package_contract.py)
|
|
209
|
+
|
|
210
|
+
The repository README gate also checks the required heading tree, metadata, managed fragments, and referenced files.
|
|
211
|
+
|
|
212
|
+
### Certification Status
|
|
213
|
+
|
|
214
|
+
No external certification is asserted for `swarmauri_live_model_gemini` by this documentation migration. README conformance, example syntax, runtime tests, and protocol or security certification are distinct evidence scopes.
|
|
215
|
+
|
|
216
|
+
### Evidence
|
|
217
|
+
|
|
218
|
+
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_gemini/swarmauri_live_model_gemini/__init__.py) and example sources support the package-boundary description; external runtime behavior requires its own test evidence.
|
|
219
|
+
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
## FAQ
|
|
223
|
+
|
|
224
|
+
### Why
|
|
225
|
+
|
|
226
|
+
**Why select this package?** `swarmauri_live_model_gemini` provides gemini Live bidirectional multimodal model adapter for Swarmauri; use its own API boundary rather than assuming neighboring packages are bundled or configured automatically.
|
|
227
|
+
|
|
228
|
+
### How
|
|
229
|
+
|
|
230
|
+
**How do I start?** Install or synchronize the environment under Getting Started, follow the maintained example for `swarmauri_live_model_gemini`, and consult [package source](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_gemini/swarmauri_live_model_gemini/__init__.py) for the exact types and signatures involved.
|
|
231
|
+
|
|
232
|
+
### When
|
|
233
|
+
|
|
234
|
+
**When should I validate an upgrade?** Recheck `swarmauri_live_model_gemini` whenever its source version, declared collaborators, configuration, or caller changes. Run relevant behavioral tests in addition to the README gate before promotion.
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
## Documentation and Related Packages
|
|
239
|
+
|
|
240
|
+
### More Documentation
|
|
241
|
+
|
|
242
|
+
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_gemini/swarmauri_live_model_gemini/__init__.py), and [manifest](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_gemini/pyproject.toml) provide the supporting context for `swarmauri_live_model_gemini`. The [README policy](https://github.com/groupsum/readme-standards/blob/master/docs/outline.md) defines the common document structure.
|
|
243
|
+
|
|
244
|
+
### Related Packages
|
|
245
|
+
|
|
246
|
+
- [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.
|
|
247
|
+
- [swarmauri_provider_gemini](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_provider_gemini/README.md): Aggregated Google Gemini provider resources for Swarmauri models.
|
|
248
|
+
- [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.
|
|
249
|
+
- [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.
|
|
250
|
+
|
|
251
|
+
### Project Links
|
|
252
|
+
|
|
253
|
+
<!-- readme-standards:begin project-links -->
|
|
254
|
+
- [pypi: swarmauri_live_model_gemini](https://pypi.org/project/swarmauri_live_model_gemini/)
|
|
255
|
+
<!-- readme-standards:end project-links -->
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
## Contributing
|
|
260
|
+
|
|
261
|
+
### How to Contribute
|
|
262
|
+
|
|
263
|
+
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_gemini`. Keep package behavior, its documented boundary, and its tests aligned.
|
|
264
|
+
|
|
265
|
+
### Development Setup
|
|
266
|
+
|
|
267
|
+
Work from the `pkgs/50-community/swarmauri_live_model_gemini` 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.
|
|
268
|
+
|
|
269
|
+
### Notes for Maintainers
|
|
270
|
+
|
|
271
|
+
Edit authored prose directly in this `swarmauri_live_model_gemini` 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.
|
|
272
|
+
|
|
273
|
+
---
|
|
274
|
+
|
|
275
|
+
## Governance
|
|
276
|
+
|
|
277
|
+
### Ownership and Decision Making
|
|
278
|
+
|
|
279
|
+
Changes to `swarmauri_live_model_gemini` 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_gemini/pyproject.toml); this README does not assign new publishing or administrative authority.
|
|
280
|
+
|
|
281
|
+
### Standards and Policies
|
|
282
|
+
|
|
283
|
+
`swarmauri_live_model_gemini` 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.
|
|
284
|
+
|
|
285
|
+
### Lifecycle and Migration
|
|
286
|
+
|
|
287
|
+
The `swarmauri_live_model_gemini` source version is `0.1.0`.
|
|
288
|
+
|
|
289
|
+
---
|
|
290
|
+
|
|
291
|
+
## License and Attribution
|
|
292
|
+
|
|
293
|
+
### License
|
|
294
|
+
|
|
295
|
+
<!-- readme-standards:begin license -->
|
|
296
|
+
Licensed under `Apache-2.0`. See [LICENSE](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_gemini/LICENSE).
|
|
297
|
+
<!-- readme-standards:end license -->
|
|
298
|
+
|
|
299
|
+
### Notices
|
|
300
|
+
|
|
301
|
+
<!-- readme-standards:begin notices -->
|
|
302
|
+
See [NOTICE](https://github.com/swarmauri/swarmauri-sdk/blob/master/pkgs/50-community/swarmauri_live_model_gemini/NOTICE) for attribution.
|
|
303
|
+
<!-- readme-standards:end notices -->
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "swarmauri_live_model_gemini"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Gemini Live bidirectional multimodal model adapter 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_gemini>=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", "gemini live", "realtime", "audio", "multimodal", "tools"]
|
|
19
|
+
license-files = ["LICENSE", "NOTICE"]
|
|
20
|
+
[tool.uv.sources]
|
|
21
|
+
swarmauri_core = { workspace = true }
|
|
22
|
+
swarmauri_base = { workspace = true }
|
|
23
|
+
swarmauri_provider_gemini = { 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_gemini"
|
|
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_gemini"
|
|
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_gemini/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_gemini/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
|
+
GeminiLiveModel = "swarmauri_live_model_gemini:GeminiLiveModel"
|
|
76
|
+
[build-system]
|
|
77
|
+
requires = ["poetry-core>=1.8.0"]
|
|
78
|
+
build-backend = "poetry.core.masonry.api"
|
|
79
|
+
[dependency-groups]
|
|
80
|
+
dev = ["pytest>=8.0", "pytest-asyncio>=0.24", "ruff>=0.9.9", "swarmauri_tests_component", "readme-standards==0.1.3; python_version >= \"3.11\""]
|
|
81
|
+
|
|
82
|
+
[tool.ruff]
|
|
83
|
+
extend = "../../pyproject.toml"
|
|
84
|
+
|
|
85
|
+
[tool.ruff.lint]
|
|
86
|
+
ignore = ["BLE001", "N999"]
|
|
@@ -0,0 +1,150 @@
|
|
|
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.OutputTranscriptDeltaEvent import (
|
|
10
|
+
OutputTranscriptDeltaEvent,
|
|
11
|
+
)
|
|
12
|
+
from swarmauri_base.live_models.events.SessionErrorEvent import (
|
|
13
|
+
SessionErrorEvent,
|
|
14
|
+
)
|
|
15
|
+
from swarmauri_base.live_models.events.SessionLifecycleEvent import (
|
|
16
|
+
SessionLifecycleEvent,
|
|
17
|
+
)
|
|
18
|
+
from swarmauri_base.live_models.events.SessionResumptionEvent import (
|
|
19
|
+
SessionResumptionEvent,
|
|
20
|
+
)
|
|
21
|
+
from swarmauri_base.live_models.events.TextDeltaEvent import TextDeltaEvent
|
|
22
|
+
from swarmauri_base.live_models.events.ToolCallEvent import ToolCallEvent
|
|
23
|
+
from swarmauri_base.live_models.events.TurnCompleteEvent import (
|
|
24
|
+
TurnCompleteEvent,
|
|
25
|
+
)
|
|
26
|
+
from swarmauri_base.live_models.events.UsageEvent import UsageEvent
|
|
27
|
+
from swarmauri_base.live_models.LiveEventBase import LiveEventBase
|
|
28
|
+
from swarmauri_base.live_models.LiveInputBase import LiveInputBase
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class GeminiLiveCodec:
|
|
32
|
+
def encode(self, input_data: LiveInputBase) -> str:
|
|
33
|
+
if input_data.kind == "text":
|
|
34
|
+
payload = {"realtimeInput": {"text": input_data.payload}}
|
|
35
|
+
elif input_data.kind in {"audio", "image", "video"}:
|
|
36
|
+
payload = {
|
|
37
|
+
"realtimeInput": {
|
|
38
|
+
"mediaChunks": [
|
|
39
|
+
{
|
|
40
|
+
"mimeType": input_data.mime_type,
|
|
41
|
+
"data": base64.b64encode(
|
|
42
|
+
input_data.payload
|
|
43
|
+
).decode(),
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
elif input_data.kind == "tool_result":
|
|
49
|
+
payload = {
|
|
50
|
+
"toolResponse": {
|
|
51
|
+
"functionResponses": [
|
|
52
|
+
{
|
|
53
|
+
"id": input_data.call_id,
|
|
54
|
+
"name": input_data.correlation_id or "tool",
|
|
55
|
+
"response": {"output": input_data.payload},
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
elif input_data.kind == "commit_turn":
|
|
61
|
+
payload = {"realtimeInput": {"activityEnd": {}}}
|
|
62
|
+
elif input_data.kind == "interrupt":
|
|
63
|
+
payload = {"realtimeInput": {"activityStart": {}}}
|
|
64
|
+
else:
|
|
65
|
+
raise ValueError(
|
|
66
|
+
f"Unsupported Gemini live input: {input_data.kind}"
|
|
67
|
+
)
|
|
68
|
+
return json.dumps(payload)
|
|
69
|
+
|
|
70
|
+
def decode(self, message: str | bytes) -> list[LiveEventBase]:
|
|
71
|
+
data: dict[str, Any] = json.loads(message)
|
|
72
|
+
events: list[LiveEventBase] = []
|
|
73
|
+
server = data.get("serverContent", {})
|
|
74
|
+
model_turn = server.get("modelTurn", {})
|
|
75
|
+
correlation = {"provider_event_id": data.get("id")}
|
|
76
|
+
|
|
77
|
+
for part in model_turn.get("parts", []):
|
|
78
|
+
if "text" in part:
|
|
79
|
+
events.append(
|
|
80
|
+
TextDeltaEvent(
|
|
81
|
+
payload=part["text"], correlation=correlation
|
|
82
|
+
)
|
|
83
|
+
)
|
|
84
|
+
inline = part.get("inlineData") or part.get("inline_data")
|
|
85
|
+
if inline and str(inline.get("mimeType", "")).startswith("audio/"):
|
|
86
|
+
events.append(
|
|
87
|
+
AudioDeltaEvent(
|
|
88
|
+
payload=base64.b64decode(inline["data"]),
|
|
89
|
+
mime_type=inline.get("mimeType", "audio/pcm"),
|
|
90
|
+
correlation=correlation,
|
|
91
|
+
)
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
input_tx = server.get("inputTranscription", {})
|
|
95
|
+
if input_tx.get("text"):
|
|
96
|
+
events.append(
|
|
97
|
+
InputTranscriptDeltaEvent(
|
|
98
|
+
payload=input_tx["text"], correlation=correlation
|
|
99
|
+
)
|
|
100
|
+
)
|
|
101
|
+
output_tx = server.get("outputTranscription", {})
|
|
102
|
+
if output_tx.get("text"):
|
|
103
|
+
events.append(
|
|
104
|
+
OutputTranscriptDeltaEvent(
|
|
105
|
+
payload=output_tx["text"], correlation=correlation
|
|
106
|
+
)
|
|
107
|
+
)
|
|
108
|
+
if server.get("turnComplete"):
|
|
109
|
+
events.append(TurnCompleteEvent(correlation=correlation))
|
|
110
|
+
|
|
111
|
+
for call in data.get("toolCall", {}).get("functionCalls", []):
|
|
112
|
+
events.append(
|
|
113
|
+
ToolCallEvent(
|
|
114
|
+
call_id=call.get("id", call.get("name", "")),
|
|
115
|
+
tool_name=call["name"],
|
|
116
|
+
arguments=call.get("args", {}),
|
|
117
|
+
correlation=correlation,
|
|
118
|
+
)
|
|
119
|
+
)
|
|
120
|
+
if data.get("usageMetadata"):
|
|
121
|
+
usage = {
|
|
122
|
+
key: int(value)
|
|
123
|
+
for key, value in data["usageMetadata"].items()
|
|
124
|
+
if isinstance(value, int)
|
|
125
|
+
}
|
|
126
|
+
events.append(UsageEvent(payload=usage, correlation=correlation))
|
|
127
|
+
if data.get("sessionResumptionUpdate"):
|
|
128
|
+
update = data["sessionResumptionUpdate"]
|
|
129
|
+
events.append(
|
|
130
|
+
SessionResumptionEvent(
|
|
131
|
+
token=update.get("newHandle"),
|
|
132
|
+
resumable=bool(update.get("resumable", True)),
|
|
133
|
+
correlation=correlation,
|
|
134
|
+
)
|
|
135
|
+
)
|
|
136
|
+
if data.get("goAway"):
|
|
137
|
+
events.append(
|
|
138
|
+
SessionLifecycleEvent(
|
|
139
|
+
state="closing",
|
|
140
|
+
payload=data["goAway"],
|
|
141
|
+
correlation=correlation,
|
|
142
|
+
)
|
|
143
|
+
)
|
|
144
|
+
if data.get("error"):
|
|
145
|
+
events.append(
|
|
146
|
+
SessionErrorEvent(
|
|
147
|
+
message=str(data["error"]), correlation=correlation
|
|
148
|
+
)
|
|
149
|
+
)
|
|
150
|
+
return events
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
from typing import Any
|
|
2
|
+
|
|
3
|
+
from swarmauri_base.live_models.LiveConfigBase import LiveConfigBase
|
|
4
|
+
from swarmauri_provider_gemini import GeminiToolSchemaConverter
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class GeminiLiveConfigMapper:
|
|
8
|
+
def __init__(self) -> None:
|
|
9
|
+
self._tools = GeminiToolSchemaConverter()
|
|
10
|
+
|
|
11
|
+
def map(self, model: str, config: LiveConfigBase) -> dict[str, Any]:
|
|
12
|
+
generation = {
|
|
13
|
+
"responseModalities": [
|
|
14
|
+
modality.upper() for modality in config.requested_modalities
|
|
15
|
+
]
|
|
16
|
+
}
|
|
17
|
+
setup: dict[str, Any] = {
|
|
18
|
+
"model": f"models/{model}",
|
|
19
|
+
"generationConfig": generation,
|
|
20
|
+
}
|
|
21
|
+
if config.tools:
|
|
22
|
+
setup["tools"] = [
|
|
23
|
+
{
|
|
24
|
+
"functionDeclarations": [
|
|
25
|
+
self._tools.convert(tool) for tool in config.tools
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
setup.update(config.provider_options.get("setup", {}))
|
|
30
|
+
return {"setup": setup}
|
|
@@ -0,0 +1,43 @@
|
|
|
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_gemini import GeminiProvider
|
|
10
|
+
from swarmauri_transport_websocket import WebSocketClient
|
|
11
|
+
|
|
12
|
+
from .GeminiLiveConfigMapper import GeminiLiveConfigMapper
|
|
13
|
+
from .GeminiLiveSession import GeminiLiveSession
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@ComponentBase.register_type(LiveModelBase, "GeminiLiveModel")
|
|
17
|
+
class GeminiLiveModel(LiveModelBase):
|
|
18
|
+
name: str = "gemini-3.1-flash-live-preview"
|
|
19
|
+
provider: GeminiProvider = Field(default_factory=GeminiProvider)
|
|
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", "video"}),
|
|
24
|
+
output_modalities=frozenset({"text", "audio"}),
|
|
25
|
+
features=frozenset({"tools", "transcription"}),
|
|
26
|
+
session_features=frozenset(
|
|
27
|
+
{"realtime", "interruption", "session_resumption"}
|
|
28
|
+
),
|
|
29
|
+
)
|
|
30
|
+
)
|
|
31
|
+
type: Literal["GeminiLiveModel"] = "GeminiLiveModel"
|
|
32
|
+
model_config = ConfigDict(arbitrary_types_allowed=True, extra="allow")
|
|
33
|
+
|
|
34
|
+
async def aconnect(self, config: LiveConfigBase) -> GeminiLiveSession:
|
|
35
|
+
connection_config = self.provider.prepare_connection(
|
|
36
|
+
"live.connect", model=self.name
|
|
37
|
+
)
|
|
38
|
+
connection = await self.transport.aconnect(
|
|
39
|
+
connection_config.resolved_url(),
|
|
40
|
+
headers=connection_config.headers,
|
|
41
|
+
)
|
|
42
|
+
setup = GeminiLiveConfigMapper().map(self.name, config)
|
|
43
|
+
return await GeminiLiveSession.create(connection, setup)
|
|
@@ -0,0 +1,58 @@
|
|
|
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 .GeminiLiveCodec import GeminiLiveCodec
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@ComponentBase.register_type(LiveSessionBase, "GeminiLiveSession")
|
|
19
|
+
class GeminiLiveSession(LiveSessionBase):
|
|
20
|
+
type: Literal["GeminiLiveSession"] = "GeminiLiveSession"
|
|
21
|
+
_connection: IWebSocketConnection = PrivateAttr()
|
|
22
|
+
_codec: GeminiLiveCodec = PrivateAttr(default_factory=GeminiLiveCodec)
|
|
23
|
+
_receiver: Any = PrivateAttr(default=None)
|
|
24
|
+
|
|
25
|
+
@classmethod
|
|
26
|
+
async def create(cls, connection, setup: dict) -> "GeminiLiveSession":
|
|
27
|
+
session = cls()
|
|
28
|
+
session._connection = connection
|
|
29
|
+
await connection.asend(json.dumps(setup))
|
|
30
|
+
session.mark_open()
|
|
31
|
+
session._receiver = asyncio.create_task(session._receive_loop())
|
|
32
|
+
return session
|
|
33
|
+
|
|
34
|
+
async def _receive_loop(self) -> None:
|
|
35
|
+
try:
|
|
36
|
+
async for message in self._connection.aiter_messages():
|
|
37
|
+
for event in self._codec.decode(message):
|
|
38
|
+
await self.emit(event)
|
|
39
|
+
except asyncio.CancelledError:
|
|
40
|
+
raise
|
|
41
|
+
except Exception as exc:
|
|
42
|
+
await self.emit(SessionErrorEvent(message=str(exc)))
|
|
43
|
+
await self.fail(exc)
|
|
44
|
+
else:
|
|
45
|
+
await self.finish()
|
|
46
|
+
|
|
47
|
+
async def _asend_impl(self, input_data: LiveInputBase) -> None:
|
|
48
|
+
await self._connection.asend(self._codec.encode(input_data))
|
|
49
|
+
|
|
50
|
+
async def _aclose_impl(self) -> None:
|
|
51
|
+
if (
|
|
52
|
+
self._receiver is not None
|
|
53
|
+
and self._receiver is not asyncio.current_task()
|
|
54
|
+
):
|
|
55
|
+
self._receiver.cancel()
|
|
56
|
+
with suppress(asyncio.CancelledError):
|
|
57
|
+
await self._receiver
|
|
58
|
+
await self._connection.aclose()
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from swarmauri_base.live_models.inputs.ToolResultInput import ToolResultInput
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class GeminiLiveToolAdapter:
|
|
5
|
+
def result(
|
|
6
|
+
self, call_id: str, name: str, value: object
|
|
7
|
+
) -> ToolResultInput:
|
|
8
|
+
return ToolResultInput(
|
|
9
|
+
call_id=call_id,
|
|
10
|
+
correlation_id=name,
|
|
11
|
+
payload=value,
|
|
12
|
+
)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from .GeminiLiveCodec import GeminiLiveCodec
|
|
2
|
+
from .GeminiLiveConfigMapper import GeminiLiveConfigMapper
|
|
3
|
+
from .GeminiLiveModel import GeminiLiveModel
|
|
4
|
+
from .GeminiLiveSession import GeminiLiveSession
|
|
5
|
+
from .GeminiLiveToolAdapter import GeminiLiveToolAdapter
|
|
6
|
+
|
|
7
|
+
__all__ = [
|
|
8
|
+
"GeminiLiveCodec",
|
|
9
|
+
"GeminiLiveConfigMapper",
|
|
10
|
+
"GeminiLiveModel",
|
|
11
|
+
"GeminiLiveSession",
|
|
12
|
+
"GeminiLiveToolAdapter",
|
|
13
|
+
]
|