yapwrap 0.0.1a1__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.
- yapwrap-0.0.1a1/.github/workflows/publish.yml +78 -0
- yapwrap-0.0.1a1/.gitignore +14 -0
- yapwrap-0.0.1a1/.python-version +1 -0
- yapwrap-0.0.1a1/LICENSE +201 -0
- yapwrap-0.0.1a1/PKG-INFO +339 -0
- yapwrap-0.0.1a1/README.md +285 -0
- yapwrap-0.0.1a1/examples/README.md +143 -0
- yapwrap-0.0.1a1/examples/__init__.py +1 -0
- yapwrap-0.0.1a1/examples/custom_components.py +81 -0
- yapwrap-0.0.1a1/examples/frameworks/__init__.py +1 -0
- yapwrap-0.0.1a1/examples/frameworks/agno_agent.py +40 -0
- yapwrap-0.0.1a1/examples/frameworks/callable_agent.py +34 -0
- yapwrap-0.0.1a1/examples/frameworks/claude_agent_sdk.py +39 -0
- yapwrap-0.0.1a1/examples/frameworks/crewai_agent.py +49 -0
- yapwrap-0.0.1a1/examples/frameworks/google_adk_agent.py +51 -0
- yapwrap-0.0.1a1/examples/frameworks/langgraph_agent.py +43 -0
- yapwrap-0.0.1a1/examples/frameworks/llamaindex_agent.py +42 -0
- yapwrap-0.0.1a1/examples/frameworks/microsoft_agent.py +36 -0
- yapwrap-0.0.1a1/examples/frameworks/openai_agents_sdk.py +37 -0
- yapwrap-0.0.1a1/examples/frameworks/pydantic_ai_agent.py +39 -0
- yapwrap-0.0.1a1/examples/frameworks/smolagents_agent.py +43 -0
- yapwrap-0.0.1a1/examples/transports/__init__.py +1 -0
- yapwrap-0.0.1a1/examples/transports/fastapi_websocket.py +78 -0
- yapwrap-0.0.1a1/examples/transports/local.py +41 -0
- yapwrap-0.0.1a1/examples/transports/voice-client.html +276 -0
- yapwrap-0.0.1a1/examples/transports/webrtc.py +114 -0
- yapwrap-0.0.1a1/examples/transports/websocket.py +49 -0
- yapwrap-0.0.1a1/main.py +21 -0
- yapwrap-0.0.1a1/pyproject.toml +65 -0
- yapwrap-0.0.1a1/src/yapwrap/__init__.py +36 -0
- yapwrap-0.0.1a1/src/yapwrap/agents/__init__.py +30 -0
- yapwrap-0.0.1a1/src/yapwrap/agents/agno.py +54 -0
- yapwrap-0.0.1a1/src/yapwrap/agents/callable.py +57 -0
- yapwrap-0.0.1a1/src/yapwrap/agents/claude.py +49 -0
- yapwrap-0.0.1a1/src/yapwrap/agents/crewai.py +25 -0
- yapwrap-0.0.1a1/src/yapwrap/agents/google_adk.py +47 -0
- yapwrap-0.0.1a1/src/yapwrap/agents/langgraph.py +59 -0
- yapwrap-0.0.1a1/src/yapwrap/agents/llamaindex.py +27 -0
- yapwrap-0.0.1a1/src/yapwrap/agents/microsoft_agent.py +20 -0
- yapwrap-0.0.1a1/src/yapwrap/agents/openai_agents.py +34 -0
- yapwrap-0.0.1a1/src/yapwrap/agents/pydantic_ai.py +27 -0
- yapwrap-0.0.1a1/src/yapwrap/agents/smolagents.py +37 -0
- yapwrap-0.0.1a1/src/yapwrap/core/__init__.py +27 -0
- yapwrap-0.0.1a1/src/yapwrap/core/audio.py +168 -0
- yapwrap-0.0.1a1/src/yapwrap/core/base.py +113 -0
- yapwrap-0.0.1a1/src/yapwrap/core/events.py +57 -0
- yapwrap-0.0.1a1/src/yapwrap/core/memory.py +73 -0
- yapwrap-0.0.1a1/src/yapwrap/core/phrases.py +89 -0
- yapwrap-0.0.1a1/src/yapwrap/core/protocols.py +18 -0
- yapwrap-0.0.1a1/src/yapwrap/core/session.py +256 -0
- yapwrap-0.0.1a1/src/yapwrap/core/yapwrap.py +113 -0
- yapwrap-0.0.1a1/src/yapwrap/stt/__init__.py +24 -0
- yapwrap-0.0.1a1/src/yapwrap/stt/assemblyai.py +68 -0
- yapwrap-0.0.1a1/src/yapwrap/stt/deepgram.py +98 -0
- yapwrap-0.0.1a1/src/yapwrap/stt/elevenlabs.py +63 -0
- yapwrap-0.0.1a1/src/yapwrap/stt/gladia.py +77 -0
- yapwrap-0.0.1a1/src/yapwrap/stt/google_chirp.py +66 -0
- yapwrap-0.0.1a1/src/yapwrap/stt/openai_realtime.py +85 -0
- yapwrap-0.0.1a1/src/yapwrap/stt/soniox.py +80 -0
- yapwrap-0.0.1a1/src/yapwrap/stt/speechmatics.py +81 -0
- yapwrap-0.0.1a1/src/yapwrap/transports/__init__.py +14 -0
- yapwrap-0.0.1a1/src/yapwrap/transports/local.py +121 -0
- yapwrap-0.0.1a1/src/yapwrap/transports/webrtc.py +132 -0
- yapwrap-0.0.1a1/src/yapwrap/transports/websocket.py +86 -0
- yapwrap-0.0.1a1/src/yapwrap/tts/__init__.py +28 -0
- yapwrap-0.0.1a1/src/yapwrap/tts/azure.py +59 -0
- yapwrap-0.0.1a1/src/yapwrap/tts/cartesia.py +77 -0
- yapwrap-0.0.1a1/src/yapwrap/tts/deepgram.py +57 -0
- yapwrap-0.0.1a1/src/yapwrap/tts/elevenlabs.py +69 -0
- yapwrap-0.0.1a1/src/yapwrap/tts/gemini.py +62 -0
- yapwrap-0.0.1a1/src/yapwrap/tts/hume.py +62 -0
- yapwrap-0.0.1a1/src/yapwrap/tts/inworld.py +58 -0
- yapwrap-0.0.1a1/src/yapwrap/tts/openai.py +61 -0
- yapwrap-0.0.1a1/src/yapwrap/tts/rime.py +64 -0
- yapwrap-0.0.1a1/src/yapwrap/tts/sarvam.py +71 -0
- yapwrap-0.0.1a1/src/yapwrap/vad/__init__.py +18 -0
- yapwrap-0.0.1a1/src/yapwrap/vad/cobra.py +70 -0
- yapwrap-0.0.1a1/src/yapwrap/vad/energy.py +55 -0
- yapwrap-0.0.1a1/src/yapwrap/vad/silero.py +74 -0
- yapwrap-0.0.1a1/src/yapwrap/vad/smart_turn.py +55 -0
- yapwrap-0.0.1a1/src/yapwrap/vad/webrtc.py +72 -0
- yapwrap-0.0.1a1/tests/__init__.py +2 -0
- yapwrap-0.0.1a1/tests/browser_client.test.cjs +192 -0
- yapwrap-0.0.1a1/tests/conftest.py +81 -0
- yapwrap-0.0.1a1/tests/test_agents.py +129 -0
- yapwrap-0.0.1a1/tests/test_audio.py +88 -0
- yapwrap-0.0.1a1/tests/test_base_classes.py +89 -0
- yapwrap-0.0.1a1/tests/test_framework_adapters.py +256 -0
- yapwrap-0.0.1a1/tests/test_memory.py +39 -0
- yapwrap-0.0.1a1/tests/test_package.py +25 -0
- yapwrap-0.0.1a1/tests/test_phrases.py +51 -0
- yapwrap-0.0.1a1/tests/test_protocols.py +86 -0
- yapwrap-0.0.1a1/tests/test_providers.py +101 -0
- yapwrap-0.0.1a1/tests/test_session.py +80 -0
- yapwrap-0.0.1a1/tests/test_session_lifecycle.py +230 -0
- yapwrap-0.0.1a1/tests/test_silero.py +37 -0
- yapwrap-0.0.1a1/tests/test_transports.py +176 -0
- yapwrap-0.0.1a1/tests/test_web_example.py +106 -0
- yapwrap-0.0.1a1/tests/test_webrtc.py +93 -0
- yapwrap-0.0.1a1/tests/test_yapwrap.py +51 -0
- yapwrap-0.0.1a1/uv.lock +2882 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
build:
|
|
12
|
+
name: Test and build distributions
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v7
|
|
16
|
+
with:
|
|
17
|
+
persist-credentials: false
|
|
18
|
+
|
|
19
|
+
- uses: actions/setup-python@v7
|
|
20
|
+
with:
|
|
21
|
+
python-version: "3.12"
|
|
22
|
+
|
|
23
|
+
- name: Install test and build dependencies
|
|
24
|
+
run: python -m pip install ".[dev,web]" build twine
|
|
25
|
+
|
|
26
|
+
- name: Check the release tag matches the package version
|
|
27
|
+
env:
|
|
28
|
+
RELEASE_TAG: ${{ github.event.release.tag_name }}
|
|
29
|
+
run: |
|
|
30
|
+
python - <<'PY'
|
|
31
|
+
import os
|
|
32
|
+
from pathlib import Path
|
|
33
|
+
import tomllib
|
|
34
|
+
|
|
35
|
+
import yapwrap
|
|
36
|
+
|
|
37
|
+
project = tomllib.loads(Path("pyproject.toml").read_text(encoding="utf-8"))["project"]
|
|
38
|
+
version = project["version"]
|
|
39
|
+
tag = os.environ["RELEASE_TAG"]
|
|
40
|
+
if tag != f"v{version}":
|
|
41
|
+
raise SystemExit(f"Release tag {tag!r} must be v{version} to match pyproject.toml")
|
|
42
|
+
if yapwrap.__version__ != version:
|
|
43
|
+
raise SystemExit("Update yapwrap.__version__ to match pyproject.toml")
|
|
44
|
+
PY
|
|
45
|
+
|
|
46
|
+
- name: Run tests
|
|
47
|
+
run: python -m pytest -q -p no:cacheprovider
|
|
48
|
+
|
|
49
|
+
- name: Build and validate distributions
|
|
50
|
+
run: |
|
|
51
|
+
python -m build
|
|
52
|
+
python -m twine check --strict dist/*
|
|
53
|
+
|
|
54
|
+
- uses: actions/upload-artifact@v7
|
|
55
|
+
with:
|
|
56
|
+
name: python-distributions
|
|
57
|
+
path: dist/
|
|
58
|
+
if-no-files-found: error
|
|
59
|
+
|
|
60
|
+
publish:
|
|
61
|
+
name: Upload to PyPI
|
|
62
|
+
needs: build
|
|
63
|
+
runs-on: ubuntu-latest
|
|
64
|
+
environment:
|
|
65
|
+
name: pypi
|
|
66
|
+
url: https://pypi.org/p/yapwrap
|
|
67
|
+
permissions:
|
|
68
|
+
id-token: write
|
|
69
|
+
steps:
|
|
70
|
+
- uses: actions/download-artifact@v8
|
|
71
|
+
with:
|
|
72
|
+
name: python-distributions
|
|
73
|
+
path: dist/
|
|
74
|
+
|
|
75
|
+
# Register the PyPI project yapwrap with this GitHub repository,
|
|
76
|
+
# workflow publish.yml, and environment pypi as its Trusted Publisher.
|
|
77
|
+
- name: Publish with Trusted Publishing
|
|
78
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.14
|
yapwrap-0.0.1a1/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
yapwrap-0.0.1a1/PKG-INFO
ADDED
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: yapwrap
|
|
3
|
+
Version: 0.0.1a1
|
|
4
|
+
Summary: Framework-agnostic streaming voice pipeline for AI agents
|
|
5
|
+
Author: YapWrap Contributors
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Keywords: agent,llm,realtime,streaming,stt,tts,vad,voice
|
|
9
|
+
Requires-Python: >=3.10
|
|
10
|
+
Requires-Dist: httpx>=0.27.0
|
|
11
|
+
Requires-Dist: typing-extensions>=4.8.0
|
|
12
|
+
Provides-Extra: all
|
|
13
|
+
Requires-Dist: aiortc>=1.9.0; extra == 'all'
|
|
14
|
+
Requires-Dist: fastapi>=0.115.0; extra == 'all'
|
|
15
|
+
Requires-Dist: httpx>=0.27.0; extra == 'all'
|
|
16
|
+
Requires-Dist: numpy>=1.24.0; extra == 'all'
|
|
17
|
+
Requires-Dist: onnxruntime>=1.16.0; extra == 'all'
|
|
18
|
+
Requires-Dist: openai>=1.50.0; extra == 'all'
|
|
19
|
+
Requires-Dist: silero-vad>=6.0.0; extra == 'all'
|
|
20
|
+
Requires-Dist: sounddevice>=0.5.0; extra == 'all'
|
|
21
|
+
Requires-Dist: uvicorn>=0.30.0; extra == 'all'
|
|
22
|
+
Requires-Dist: websockets>=13.0; extra == 'all'
|
|
23
|
+
Provides-Extra: audio
|
|
24
|
+
Requires-Dist: numpy>=1.24.0; extra == 'audio'
|
|
25
|
+
Provides-Extra: cartesia
|
|
26
|
+
Requires-Dist: websockets>=13.0; extra == 'cartesia'
|
|
27
|
+
Provides-Extra: deepgram
|
|
28
|
+
Requires-Dist: websockets>=13.0; extra == 'deepgram'
|
|
29
|
+
Provides-Extra: dev
|
|
30
|
+
Requires-Dist: pytest-asyncio>=0.23.0; extra == 'dev'
|
|
31
|
+
Requires-Dist: pytest>=8.0.0; extra == 'dev'
|
|
32
|
+
Provides-Extra: elevenlabs
|
|
33
|
+
Requires-Dist: httpx>=0.27.0; extra == 'elevenlabs'
|
|
34
|
+
Requires-Dist: websockets>=13.0; extra == 'elevenlabs'
|
|
35
|
+
Provides-Extra: local
|
|
36
|
+
Requires-Dist: sounddevice>=0.5.0; extra == 'local'
|
|
37
|
+
Provides-Extra: openai
|
|
38
|
+
Requires-Dist: openai>=1.50.0; extra == 'openai'
|
|
39
|
+
Provides-Extra: silero
|
|
40
|
+
Requires-Dist: numpy>=1.24.0; extra == 'silero'
|
|
41
|
+
Requires-Dist: onnxruntime>=1.16.0; extra == 'silero'
|
|
42
|
+
Requires-Dist: silero-vad>=6.0.0; extra == 'silero'
|
|
43
|
+
Provides-Extra: web
|
|
44
|
+
Requires-Dist: fastapi>=0.115.0; extra == 'web'
|
|
45
|
+
Requires-Dist: uvicorn>=0.30.0; extra == 'web'
|
|
46
|
+
Requires-Dist: websockets>=13.0; extra == 'web'
|
|
47
|
+
Provides-Extra: webrtc
|
|
48
|
+
Requires-Dist: aiortc>=1.9.0; extra == 'webrtc'
|
|
49
|
+
Provides-Extra: webrtc-vad
|
|
50
|
+
Requires-Dist: webrtcvad>=2.0.10; extra == 'webrtc-vad'
|
|
51
|
+
Provides-Extra: websockets
|
|
52
|
+
Requires-Dist: websockets>=13.0; extra == 'websockets'
|
|
53
|
+
Description-Content-Type: text/markdown
|
|
54
|
+
|
|
55
|
+
# Introducing YapWrap
|
|
56
|
+
|
|
57
|
+
**Make your agents yap.**
|
|
58
|
+
|
|
59
|
+
Give the agent you've already built a voice. YapWrap connects your existing
|
|
60
|
+
Python agent to speech recognition, speech synthesis, and live audio—so people
|
|
61
|
+
can talk to it.
|
|
62
|
+
|
|
63
|
+
You've chosen a framework, configured a model, connected tools, and worked out
|
|
64
|
+
memory and workflows. YapWrap starts with that agent. Wrap it in an adapter,
|
|
65
|
+
choose your speech providers, and turn it into a yapper.
|
|
66
|
+
|
|
67
|
+
Built-in adapters cover **Agno, Claude Agent SDK, CrewAI, Google ADK,
|
|
68
|
+
Hugging Face smolagents, LangGraph / LangChain agents, LlamaIndex,
|
|
69
|
+
Microsoft Agent Framework, OpenAI Agents SDK, and Pydantic AI**.
|
|
70
|
+
Custom Python agents can connect through `CallableAgent` or a `BaseAgent` subclass.
|
|
71
|
+
See [every adapter and its example](#bring-your-framework).
|
|
72
|
+
|
|
73
|
+
Start with any framework—or your own agent implementation. Here, `reply` is
|
|
74
|
+
your application's function that accepts user text and returns reply text or
|
|
75
|
+
a stream of text chunks:
|
|
76
|
+
|
|
77
|
+
```python
|
|
78
|
+
import asyncio
|
|
79
|
+
|
|
80
|
+
from yapwrap import YapWrap
|
|
81
|
+
from yapwrap.agents import CallableAgent
|
|
82
|
+
from yapwrap.stt import DeepgramSTT
|
|
83
|
+
from yapwrap.tts import CartesiaTTS
|
|
84
|
+
from yapwrap.vad import SileroVAD
|
|
85
|
+
|
|
86
|
+
from your_app import reply # Your existing agent's text-in, text-out entry point.
|
|
87
|
+
|
|
88
|
+
yapper = YapWrap(
|
|
89
|
+
agent=CallableAgent(reply),
|
|
90
|
+
stt=DeepgramSTT(),
|
|
91
|
+
tts=CartesiaTTS(),
|
|
92
|
+
vad=SileroVAD(),
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
asyncio.run(yapper.startlocal())
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Your function keeps calling your agent with its configured model, instructions,
|
|
99
|
+
tools, and session state. It can be synchronous or asynchronous. YapWrap handles
|
|
100
|
+
listening and speaking.
|
|
101
|
+
|
|
102
|
+
You can also wrap framework objects directly with a [built-in adapter](#bring-your-framework).
|
|
103
|
+
Install the voice dependencies below and keep your agent's own credentials and
|
|
104
|
+
session configuration.
|
|
105
|
+
|
|
106
|
+
**[Try it locally](#get-talking) · [Try it in your browser](#choose-where-your-agent-yaps) · [Find your framework](#bring-your-framework) · [Build an adapter](#make-it-your-own)**
|
|
107
|
+
|
|
108
|
+
## Why YapWrap?
|
|
109
|
+
|
|
110
|
+
Adding voice to an existing agent brings a new set of concerns: microphone
|
|
111
|
+
input, speech recognition, turn detection, audio playback, interruptions, and
|
|
112
|
+
keeping the conversation visible. Reusing an agent also means connecting its
|
|
113
|
+
input, output, and session state to that voice pipeline.
|
|
114
|
+
|
|
115
|
+
YapWrap puts that connection at the center of its API:
|
|
116
|
+
|
|
117
|
+
- **Bring your agent.** Use an adapter around your configured agent, graph,
|
|
118
|
+
runner, or client. Your framework continues to execute its tools and workflows.
|
|
119
|
+
- **Choose your speech stack.** Configure STT, TTS, and voice activity detection
|
|
120
|
+
independently of the agent.
|
|
121
|
+
- **Handle conversation turns.** Detect speech, turn reply text into spoken
|
|
122
|
+
phrases, and clear queued playback when the user interrupts.
|
|
123
|
+
- **Talk locally or in a browser.** Use microphone and speakers, WebSockets,
|
|
124
|
+
FastAPI, or WebRTC. The included clients show both sides of the conversation.
|
|
125
|
+
- **Extend through base classes.** Add an agent, provider, or transport by
|
|
126
|
+
implementing a small, explicit interface.
|
|
127
|
+
|
|
128
|
+
The core imports no agent framework, web framework, audio device, or model SDK.
|
|
129
|
+
Integrations are optional.
|
|
130
|
+
|
|
131
|
+
```text
|
|
132
|
+
Your voice → speech recognition → your existing agent → speech synthesis → its voice
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Get talking
|
|
136
|
+
|
|
137
|
+
Python 3.10+ is required by YapWrap; individual framework SDKs can require a newer
|
|
138
|
+
version. From the repository root, install the example dependencies:
|
|
139
|
+
|
|
140
|
+
```sh
|
|
141
|
+
uv sync --group examples --extra local --extra web --extra silero --extra deepgram --extra cartesia
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Set your provider keys. The demos use Agno with Gemini, Deepgram for recognition,
|
|
145
|
+
Cartesia for speech, and Silero for voice activity detection.
|
|
146
|
+
|
|
147
|
+
```sh
|
|
148
|
+
export GOOGLE_API_KEY="your-google-key"
|
|
149
|
+
export DEEPGRAM_API_KEY="your-deepgram-key"
|
|
150
|
+
export CARTESIA_API_KEY="your-cartesia-key"
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
<details>
|
|
154
|
+
<summary>PowerShell</summary>
|
|
155
|
+
|
|
156
|
+
```powershell
|
|
157
|
+
$env:GOOGLE_API_KEY = "your-google-key"
|
|
158
|
+
$env:DEEPGRAM_API_KEY = "your-deepgram-key"
|
|
159
|
+
$env:CARTESIA_API_KEY = "your-cartesia-key"
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
</details>
|
|
163
|
+
|
|
164
|
+
Start a local conversation:
|
|
165
|
+
|
|
166
|
+
```sh
|
|
167
|
+
uv run python -m examples.transports.local
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Wait for `Session online`, then speak. The terminal prints your recognized
|
|
171
|
+
words and streams the agent's reply. Press Ctrl+C to stop.
|
|
172
|
+
|
|
173
|
+
`GEMINI_API_KEY` is also accepted. Set `GEMINI_MODEL` to change the example model;
|
|
174
|
+
the default is `gemini-flash-lite-latest`. These are example defaults—you choose
|
|
175
|
+
the model and providers in your own application.
|
|
176
|
+
|
|
177
|
+
For an application using this checkout, install only the integrations you need:
|
|
178
|
+
|
|
179
|
+
```sh
|
|
180
|
+
python -m pip install -e ".[local,silero,deepgram,cartesia]"
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
Install your agent's framework and model SDK separately. This command installs
|
|
184
|
+
YapWrap's voice dependencies; the `examples` group above also installs Agno and
|
|
185
|
+
Google's model SDK. See the [example guide](examples/README.md) for other setups.
|
|
186
|
+
|
|
187
|
+
## Choose where your agent yaps
|
|
188
|
+
|
|
189
|
+
| Experience | Example | Run from the repository root |
|
|
190
|
+
| --- | --- | --- |
|
|
191
|
+
| Microphone, speakers, and terminal transcript | [Local audio](examples/transports/local.py) | `uv run python -m examples.transports.local` |
|
|
192
|
+
| Browser voice chat and transcript | [FastAPI WebSocket](examples/transports/fastapi_websocket.py) | `uv run python -m examples.transports.fastapi_websocket` |
|
|
193
|
+
| A socket for your own client | [Standalone WebSocket](examples/transports/websocket.py) | `uv run python -m examples.transports.websocket` |
|
|
194
|
+
| Browser audio over WebRTC | [WebRTC](examples/transports/webrtc.py) | `uv run --extra webrtc python -m examples.transports.webrtc` |
|
|
195
|
+
|
|
196
|
+
For either browser server, open <http://localhost:8000>, allow microphone access,
|
|
197
|
+
and start a call. Run one at a time; both use port 8000. The standalone socket
|
|
198
|
+
listens on port 8765; its [browser client instructions](examples/README.md#transport-examples)
|
|
199
|
+
show how to serve the HTML separately.
|
|
200
|
+
|
|
201
|
+
Every example contains an explicit `yapper = YapWrap(...)`. Server examples
|
|
202
|
+
construct it inside the connection handler, giving each call its own agent,
|
|
203
|
+
speech components, and conversation state.
|
|
204
|
+
|
|
205
|
+
In your application, choose the matching entry point:
|
|
206
|
+
|
|
207
|
+
- `await yapper.startlocal()` for microphone and speakers.
|
|
208
|
+
- `await yapper.server_ws(ws=websocket)` for an accepted WebSocket connection.
|
|
209
|
+
- `await yapper.run(transport)` for a `BaseTransport` implementation.
|
|
210
|
+
|
|
211
|
+
A single `YapWrap` instance serves one conversation at a time.
|
|
212
|
+
|
|
213
|
+
## Bring your framework
|
|
214
|
+
|
|
215
|
+
Built-in adapters connect these Python agent APIs. Each linked example shows
|
|
216
|
+
the required SDK dependencies, object types, and session setup.
|
|
217
|
+
|
|
218
|
+
| Your agent | YapWrap adapter | Example |
|
|
219
|
+
| --- | --- | --- |
|
|
220
|
+
| Agno | `AgnoAgent` | [Agno](examples/frameworks/agno_agent.py) |
|
|
221
|
+
| LangGraph / LangChain agents | `LangGraphAgent` | [LangGraph](examples/frameworks/langgraph_agent.py) |
|
|
222
|
+
| Pydantic AI | `PydanticAIAgent` | [Pydantic AI](examples/frameworks/pydantic_ai_agent.py) |
|
|
223
|
+
| OpenAI Agents SDK | `OpenAIAgentsSDKAgent` | [OpenAI Agents](examples/frameworks/openai_agents_sdk.py) |
|
|
224
|
+
| Google ADK | `GoogleADKAgent` | [Google ADK](examples/frameworks/google_adk_agent.py) |
|
|
225
|
+
| Claude Agent SDK | `ClaudeAgentSDKAgent` | [Claude Agent SDK](examples/frameworks/claude_agent_sdk.py) |
|
|
226
|
+
| CrewAI | `CrewAIAgent` | [CrewAI](examples/frameworks/crewai_agent.py) |
|
|
227
|
+
| LlamaIndex | `LlamaIndexAgent` | [LlamaIndex](examples/frameworks/llamaindex_agent.py) |
|
|
228
|
+
| Microsoft Agent Framework | `MicrosoftAgentFrameworkAgent` | [Microsoft Agent Framework](examples/frameworks/microsoft_agent.py) |
|
|
229
|
+
| Hugging Face smolagents | `SmolAgentsAgent` | [smolagents](examples/frameworks/smolagents_agent.py) |
|
|
230
|
+
| Your own Python function or stream | `CallableAgent` | [Callable](examples/frameworks/callable_agent.py) |
|
|
231
|
+
|
|
232
|
+
Adapters translate recognized text into framework calls and reply text into
|
|
233
|
+
YapWrap events. They work with the interfaces shown in the examples; arbitrary
|
|
234
|
+
graph inputs, structured outputs, or application-specific events may need a
|
|
235
|
+
custom adapter. CrewAI and smolagents currently speak the final answer.
|
|
236
|
+
|
|
237
|
+
### Keep your framework's memory
|
|
238
|
+
|
|
239
|
+
Continue using your framework's session, history, and persistence mechanisms.
|
|
240
|
+
Pass the relevant run options through its adapter—for example, an Agno
|
|
241
|
+
`session_id`, a LangGraph `config` with a `thread_id`, or a LlamaIndex `ctx`.
|
|
242
|
+
|
|
243
|
+
YapWrap does not automatically migrate or populate agent memory. Its
|
|
244
|
+
`yapper.memory` records generated conversation turns and interruptions.
|
|
245
|
+
Your application decides which framework session each voice conversation uses.
|
|
246
|
+
|
|
247
|
+
## Where YapWrap fits
|
|
248
|
+
|
|
249
|
+
Pipecat and LiveKit can also connect existing agent logic.
|
|
250
|
+
[Pipecat includes a LangChain processor](https://github.com/pipecat-ai/pipecat/blob/main/src/pipecat/processors/frameworks/langchain.py),
|
|
251
|
+
and [LiveKit provides a LangGraph/LangChain adapter](https://docs.livekit.io/agents/models/llm/langchain/).
|
|
252
|
+
|
|
253
|
+
YapWrap focuses on a direct Python integration: take an existing agent, wrap its
|
|
254
|
+
text interface, choose speech components, and run it through a transport.
|
|
255
|
+
It's built for developers who want to add voice while continuing to own their
|
|
256
|
+
agent's framework, tools, and session setup.
|
|
257
|
+
|
|
258
|
+
## Make it your own
|
|
259
|
+
|
|
260
|
+
Have an agent with a custom API? Use `CallableAgent` for a function that accepts
|
|
261
|
+
text and returns text or a stream of text. For more control, subclass `BaseAgent`:
|
|
262
|
+
|
|
263
|
+
```python
|
|
264
|
+
from collections.abc import AsyncIterator
|
|
265
|
+
|
|
266
|
+
from yapwrap import AgentEvent, BaseAgent
|
|
267
|
+
|
|
268
|
+
class MyAgent(BaseAgent):
|
|
269
|
+
def __init__(self, existing_agent):
|
|
270
|
+
self.existing_agent = existing_agent
|
|
271
|
+
|
|
272
|
+
async def respond(self, text: str) -> AsyncIterator[AgentEvent]:
|
|
273
|
+
# Adapt this call to your application's text-response API.
|
|
274
|
+
reply = await self.existing_agent.reply(text)
|
|
275
|
+
yield AgentEvent.text(reply)
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
Pass `MyAgent(existing_agent)` as the `agent` argument to `YapWrap`.
|
|
279
|
+
Stream `AgentEvent.text(delta)` as text arrives when your agent supports it.
|
|
280
|
+
|
|
281
|
+
The same approach applies to the rest of the pipeline:
|
|
282
|
+
|
|
283
|
+
| Base class | Implement |
|
|
284
|
+
| --- | --- |
|
|
285
|
+
| `BaseAgent` | `respond(text)` → async stream of agent events |
|
|
286
|
+
| `BaseSTT` | `transcribe(audio)` → async stream of transcripts |
|
|
287
|
+
| `BaseTTS` | `synthesize(text)` → async stream of PCM audio |
|
|
288
|
+
| `BaseVAD` | `process(pcm)` → `"start"`, `"stop"`, or `None` |
|
|
289
|
+
| `BaseTransport` | `audio_in()`, `send_audio(pcm)`, and `stop_playback()` |
|
|
290
|
+
|
|
291
|
+
All five classes are exported from `yapwrap`. Start with the
|
|
292
|
+
[interface contracts](src/yapwrap/core/base.py) or run the
|
|
293
|
+
[custom components walkthrough](examples/custom_components.py) without keys or hardware:
|
|
294
|
+
|
|
295
|
+
```sh
|
|
296
|
+
uv run python -m examples.custom_components
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
Choose dependencies per integration: `local`, `web`, `websockets`, `webrtc`,
|
|
300
|
+
`silero`, `webrtc-vad`, `deepgram`, `cartesia`, `openai`, and `elevenlabs`
|
|
301
|
+
are available as extras; `audio` adds NumPy acceleration. The `all` extra
|
|
302
|
+
covers the listed runtime extras except `webrtc-vad`. Framework SDKs and
|
|
303
|
+
additional provider SDKs are installed separately.
|
|
304
|
+
|
|
305
|
+
## Working with real conversations
|
|
306
|
+
|
|
307
|
+
- **Audio:** components exchange raw PCM16 mono at a matching sample rate,
|
|
308
|
+
defaulting to 16 kHz. Custom transports convert their audio at the boundary.
|
|
309
|
+
- **Transcripts:** local and browser clients display user and agent text.
|
|
310
|
+
Custom transports can implement `send_event()` to receive `transcript`,
|
|
311
|
+
`agent_delta`, and `agent_complete` events. The transcript records generated
|
|
312
|
+
text; it does not confirm which audio the listener heard.
|
|
313
|
+
- **Interruptions:** a speech start cancels the current reply and clears queued
|
|
314
|
+
playback. Synchronous work running in a Python thread cannot be forcibly
|
|
315
|
+
stopped. Cancellation does not undo tool actions already performed.
|
|
316
|
+
- **Deployment:** the browser examples target localhost. Your application owns
|
|
317
|
+
authentication, HTTPS, and any STUN/TURN configuration needed for WebRTC.
|
|
318
|
+
- **Validation:** automated checks cover the core, adapter behavior, provider
|
|
319
|
+
protocol messages with mock connections, browser playback, and a local WebRTC
|
|
320
|
+
exchange. Live provider compatibility and microphone/speaker quality still
|
|
321
|
+
need testing with your configuration. Response time depends on the agent,
|
|
322
|
+
speech providers, and network.
|
|
323
|
+
|
|
324
|
+
## Development
|
|
325
|
+
|
|
326
|
+
After installing the example dependencies:
|
|
327
|
+
|
|
328
|
+
```sh
|
|
329
|
+
uv run pytest -q -p no:cacheprovider
|
|
330
|
+
node tests/browser_client.test.cjs
|
|
331
|
+
uv build
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
Optional integration tests skip when their dependencies are absent. The build
|
|
335
|
+
produces a wheel and source archive that include the license.
|
|
336
|
+
|
|
337
|
+
## License
|
|
338
|
+
|
|
339
|
+
[Apache License, Version 2.0](LICENSE).
|