agentforge-voyage 0.2.3__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.
- agentforge_voyage-0.2.3/.gitignore +49 -0
- agentforge_voyage-0.2.3/LICENSE +202 -0
- agentforge_voyage-0.2.3/PKG-INFO +62 -0
- agentforge_voyage-0.2.3/README.md +36 -0
- agentforge_voyage-0.2.3/pyproject.toml +60 -0
- agentforge_voyage-0.2.3/src/agentforge_voyage/__init__.py +10 -0
- agentforge_voyage-0.2.3/src/agentforge_voyage/_inmem_runner.py +61 -0
- agentforge_voyage-0.2.3/src/agentforge_voyage/_runner.py +65 -0
- agentforge_voyage-0.2.3/src/agentforge_voyage/embedding.py +169 -0
- agentforge_voyage-0.2.3/src/agentforge_voyage/py.typed +0 -0
- agentforge_voyage-0.2.3/tests/conftest.py +17 -0
- agentforge_voyage-0.2.3/tests/integration/test_voyage_embedding_live.py +24 -0
- agentforge_voyage-0.2.3/tests/unit/test_voyage_embedding.py +101 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.so
|
|
6
|
+
|
|
7
|
+
# Distribution / packaging
|
|
8
|
+
.Python
|
|
9
|
+
build/
|
|
10
|
+
dist/
|
|
11
|
+
*.egg-info/
|
|
12
|
+
*.egg
|
|
13
|
+
wheels/
|
|
14
|
+
sdist/
|
|
15
|
+
share/python-wheels/
|
|
16
|
+
|
|
17
|
+
# uv
|
|
18
|
+
.venv/
|
|
19
|
+
uv-cache/
|
|
20
|
+
|
|
21
|
+
# Testing
|
|
22
|
+
.pytest_cache/
|
|
23
|
+
.coverage
|
|
24
|
+
.coverage.*
|
|
25
|
+
htmlcov/
|
|
26
|
+
coverage.xml
|
|
27
|
+
.tox/
|
|
28
|
+
.mypy_cache/
|
|
29
|
+
.ruff_cache/
|
|
30
|
+
.hypothesis/
|
|
31
|
+
|
|
32
|
+
# Environment
|
|
33
|
+
.env
|
|
34
|
+
.envrc
|
|
35
|
+
|
|
36
|
+
# Editors
|
|
37
|
+
.vscode/
|
|
38
|
+
.idea/
|
|
39
|
+
*.swp
|
|
40
|
+
*.swo
|
|
41
|
+
*~
|
|
42
|
+
|
|
43
|
+
# OS
|
|
44
|
+
.DS_Store
|
|
45
|
+
Thumbs.db
|
|
46
|
+
|
|
47
|
+
# Project-local
|
|
48
|
+
*.local
|
|
49
|
+
.agentforge-state/.session-cache
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: agentforge-voyage
|
|
3
|
+
Version: 0.2.3
|
|
4
|
+
Summary: Voyage AI embedding provider for AgentForge — voyage-3 / voyage-large / voyage-code
|
|
5
|
+
Project-URL: Homepage, https://github.com/Scaffoldic/agentforge-py
|
|
6
|
+
Project-URL: Repository, https://github.com/Scaffoldic/agentforge-py
|
|
7
|
+
Project-URL: Documentation, https://github.com/Scaffoldic/agentforge-py
|
|
8
|
+
Project-URL: Changelog, https://github.com/Scaffoldic/agentforge-py/blob/main/CHANGELOG.md
|
|
9
|
+
Project-URL: Issues, https://github.com/Scaffoldic/agentforge-py/issues
|
|
10
|
+
Author: The AgentForge Authors
|
|
11
|
+
License-Expression: Apache-2.0
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Keywords: agent,ai,embeddings,rag,voyage
|
|
14
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
20
|
+
Classifier: Typing :: Typed
|
|
21
|
+
Requires-Python: >=3.13
|
|
22
|
+
Requires-Dist: agentforge-core~=0.2.3
|
|
23
|
+
Provides-Extra: voyage
|
|
24
|
+
Requires-Dist: voyageai>=0.3; extra == 'voyage'
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
|
|
27
|
+
# agentforge-voyage
|
|
28
|
+
|
|
29
|
+
Voyage AI embedding provider for
|
|
30
|
+
[AgentForge](https://github.com/Scaffoldic/agentforge-py).
|
|
31
|
+
|
|
32
|
+
Implements `EmbeddingClient` over Voyage's `embeddings.create()`
|
|
33
|
+
API. Embedding-only — Voyage doesn't ship a chat model. Use it
|
|
34
|
+
when you want Voyage's RAG-optimised embeddings paired with any
|
|
35
|
+
chat provider (Anthropic, OpenAI, Bedrock).
|
|
36
|
+
|
|
37
|
+
## Install
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pip install "agentforge-voyage[voyage]"
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Use
|
|
44
|
+
|
|
45
|
+
```python
|
|
46
|
+
from agentforge_voyage import VoyageEmbeddingClient
|
|
47
|
+
|
|
48
|
+
emb = VoyageEmbeddingClient.from_config(
|
|
49
|
+
model="voyage-3-large",
|
|
50
|
+
api_key="pa-...", # or omit and use VOYAGE_API_KEY
|
|
51
|
+
)
|
|
52
|
+
resp = await emb.embed(["hello", "world"])
|
|
53
|
+
print(resp.vectors[0])
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Capabilities
|
|
57
|
+
|
|
58
|
+
`{"multimodal"}` for `voyage-multimodal-3`; empty set otherwise.
|
|
59
|
+
|
|
60
|
+
## License
|
|
61
|
+
|
|
62
|
+
Apache-2.0. See [LICENSE](./LICENSE).
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# agentforge-voyage
|
|
2
|
+
|
|
3
|
+
Voyage AI embedding provider for
|
|
4
|
+
[AgentForge](https://github.com/Scaffoldic/agentforge-py).
|
|
5
|
+
|
|
6
|
+
Implements `EmbeddingClient` over Voyage's `embeddings.create()`
|
|
7
|
+
API. Embedding-only — Voyage doesn't ship a chat model. Use it
|
|
8
|
+
when you want Voyage's RAG-optimised embeddings paired with any
|
|
9
|
+
chat provider (Anthropic, OpenAI, Bedrock).
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pip install "agentforge-voyage[voyage]"
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Use
|
|
18
|
+
|
|
19
|
+
```python
|
|
20
|
+
from agentforge_voyage import VoyageEmbeddingClient
|
|
21
|
+
|
|
22
|
+
emb = VoyageEmbeddingClient.from_config(
|
|
23
|
+
model="voyage-3-large",
|
|
24
|
+
api_key="pa-...", # or omit and use VOYAGE_API_KEY
|
|
25
|
+
)
|
|
26
|
+
resp = await emb.embed(["hello", "world"])
|
|
27
|
+
print(resp.vectors[0])
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Capabilities
|
|
31
|
+
|
|
32
|
+
`{"multimodal"}` for `voyage-multimodal-3`; empty set otherwise.
|
|
33
|
+
|
|
34
|
+
## License
|
|
35
|
+
|
|
36
|
+
Apache-2.0. See [LICENSE](./LICENSE).
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# agentforge-voyage — Voyage AI embedding provider for AgentForge.
|
|
2
|
+
#
|
|
3
|
+
# Tier-3 module per ADR-0003. Registers under
|
|
4
|
+
# `agentforge.embeddings:voyage`. Production runner wraps the
|
|
5
|
+
# `voyageai` Python SDK under `# pragma: no cover`; unit tests
|
|
6
|
+
# inject a fake runner.
|
|
7
|
+
|
|
8
|
+
[project]
|
|
9
|
+
name = "agentforge-voyage"
|
|
10
|
+
version = "0.2.3"
|
|
11
|
+
description = "Voyage AI embedding provider for AgentForge — voyage-3 / voyage-large / voyage-code"
|
|
12
|
+
readme = "README.md"
|
|
13
|
+
requires-python = ">=3.13"
|
|
14
|
+
license = "Apache-2.0"
|
|
15
|
+
license-files = ["LICENSE"]
|
|
16
|
+
authors = [
|
|
17
|
+
{name = "The AgentForge Authors"},
|
|
18
|
+
]
|
|
19
|
+
keywords = ["ai", "agent", "embeddings", "voyage", "rag"]
|
|
20
|
+
classifiers = [
|
|
21
|
+
"Development Status :: 2 - Pre-Alpha",
|
|
22
|
+
"Intended Audience :: Developers",
|
|
23
|
+
"License :: OSI Approved :: Apache Software License",
|
|
24
|
+
"Programming Language :: Python :: 3",
|
|
25
|
+
"Programming Language :: Python :: 3.13",
|
|
26
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
27
|
+
"Typing :: Typed",
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
dependencies = [
|
|
31
|
+
"agentforge-core ~= 0.2.3",
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
[project.optional-dependencies]
|
|
35
|
+
voyage = ["voyageai>=0.3"]
|
|
36
|
+
|
|
37
|
+
[project.urls]
|
|
38
|
+
Homepage = "https://github.com/Scaffoldic/agentforge-py"
|
|
39
|
+
Repository = "https://github.com/Scaffoldic/agentforge-py"
|
|
40
|
+
Documentation = "https://github.com/Scaffoldic/agentforge-py"
|
|
41
|
+
Changelog = "https://github.com/Scaffoldic/agentforge-py/blob/main/CHANGELOG.md"
|
|
42
|
+
Issues = "https://github.com/Scaffoldic/agentforge-py/issues"
|
|
43
|
+
|
|
44
|
+
[project.entry-points."agentforge.embeddings"]
|
|
45
|
+
voyage = "agentforge_voyage:VoyageEmbeddingClient"
|
|
46
|
+
|
|
47
|
+
[build-system]
|
|
48
|
+
requires = ["hatchling>=1.27"]
|
|
49
|
+
build-backend = "hatchling.build"
|
|
50
|
+
|
|
51
|
+
[tool.hatch.build.targets.wheel]
|
|
52
|
+
packages = ["src/agentforge_voyage"]
|
|
53
|
+
|
|
54
|
+
[tool.hatch.build.targets.sdist]
|
|
55
|
+
include = [
|
|
56
|
+
"src/agentforge_voyage",
|
|
57
|
+
"tests",
|
|
58
|
+
"README.md",
|
|
59
|
+
"LICENSE",
|
|
60
|
+
]
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"""`agentforge-voyage` — Voyage AI embedding provider."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from agentforge_voyage._runner import VoyageRunner
|
|
6
|
+
from agentforge_voyage.embedding import VoyageEmbeddingClient
|
|
7
|
+
|
|
8
|
+
__version__ = "0.2.3"
|
|
9
|
+
|
|
10
|
+
__all__ = ["VoyageEmbeddingClient", "VoyageRunner", "__version__"]
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"""In-memory `VoyageRunner` for unit tests."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from dataclasses import dataclass
|
|
6
|
+
from typing import Any
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@dataclass
|
|
10
|
+
class _EmbedCall:
|
|
11
|
+
texts: list[str]
|
|
12
|
+
model: str
|
|
13
|
+
input_type: str | None
|
|
14
|
+
output_dimension: int | None
|
|
15
|
+
timeout_s: float
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class FakeVoyageRunner:
|
|
19
|
+
"""In-memory recorder."""
|
|
20
|
+
|
|
21
|
+
def __init__(self, dim: int = 1024) -> None:
|
|
22
|
+
self._dim = dim
|
|
23
|
+
self._tokens = 0
|
|
24
|
+
self.embed_calls: list[_EmbedCall] = []
|
|
25
|
+
self.closed = False
|
|
26
|
+
|
|
27
|
+
def set_response_dim(self, dim: int) -> None:
|
|
28
|
+
self._dim = dim
|
|
29
|
+
|
|
30
|
+
def set_response_tokens(self, tokens: int) -> None:
|
|
31
|
+
self._tokens = tokens
|
|
32
|
+
|
|
33
|
+
async def embed(
|
|
34
|
+
self,
|
|
35
|
+
*,
|
|
36
|
+
texts: list[str],
|
|
37
|
+
model: str,
|
|
38
|
+
input_type: str | None,
|
|
39
|
+
output_dimension: int | None,
|
|
40
|
+
timeout_s: float,
|
|
41
|
+
) -> dict[str, Any]:
|
|
42
|
+
self.embed_calls.append(
|
|
43
|
+
_EmbedCall(
|
|
44
|
+
texts=list(texts),
|
|
45
|
+
model=model,
|
|
46
|
+
input_type=input_type,
|
|
47
|
+
output_dimension=output_dimension,
|
|
48
|
+
timeout_s=timeout_s,
|
|
49
|
+
),
|
|
50
|
+
)
|
|
51
|
+
dim = output_dimension or self._dim
|
|
52
|
+
return {
|
|
53
|
+
"embeddings": [[0.0] * dim for _ in texts],
|
|
54
|
+
"total_tokens": self._tokens,
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
async def close(self) -> None:
|
|
58
|
+
self.closed = True
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
__all__ = ["FakeVoyageRunner"]
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"""Voyage runner Protocol + production SDK wrapper."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any, Protocol
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class VoyageRunner(Protocol):
|
|
9
|
+
"""Lifecycle Protocol for one Voyage embed call."""
|
|
10
|
+
|
|
11
|
+
async def embed(
|
|
12
|
+
self,
|
|
13
|
+
*,
|
|
14
|
+
texts: list[str],
|
|
15
|
+
model: str,
|
|
16
|
+
input_type: str | None,
|
|
17
|
+
output_dimension: int | None,
|
|
18
|
+
timeout_s: float,
|
|
19
|
+
) -> dict[str, Any]: # pragma: no cover
|
|
20
|
+
"""Embed a batch of texts. Returns `{"embeddings": [[...], ...],
|
|
21
|
+
"total_tokens": int}` shape."""
|
|
22
|
+
...
|
|
23
|
+
|
|
24
|
+
async def close(self) -> None: # pragma: no cover
|
|
25
|
+
...
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class _VoyageSDKRunner: # pragma: no cover — exercised only with `-m live`.
|
|
29
|
+
"""Production runner wrapping ``voyageai.AsyncClient``."""
|
|
30
|
+
|
|
31
|
+
def __init__(self, client: Any) -> None:
|
|
32
|
+
self._client = client
|
|
33
|
+
|
|
34
|
+
async def embed(
|
|
35
|
+
self,
|
|
36
|
+
*,
|
|
37
|
+
texts: list[str],
|
|
38
|
+
model: str,
|
|
39
|
+
input_type: str | None,
|
|
40
|
+
output_dimension: int | None,
|
|
41
|
+
timeout_s: float,
|
|
42
|
+
) -> dict[str, Any]:
|
|
43
|
+
kwargs: dict[str, Any] = {"texts": texts, "model": model}
|
|
44
|
+
if input_type is not None:
|
|
45
|
+
kwargs["input_type"] = input_type
|
|
46
|
+
if output_dimension is not None:
|
|
47
|
+
kwargs["output_dimension"] = output_dimension
|
|
48
|
+
# voyageai AsyncClient doesn't expose a per-call timeout kwarg
|
|
49
|
+
# in its current API; the SDK's client-level timeout governs.
|
|
50
|
+
_ = timeout_s
|
|
51
|
+
result = await self._client.embed(**kwargs)
|
|
52
|
+
return {
|
|
53
|
+
"embeddings": list(result.embeddings),
|
|
54
|
+
"total_tokens": int(getattr(result, "total_tokens", 0) or 0),
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
async def close(self) -> None:
|
|
58
|
+
close = getattr(self._client, "close", None)
|
|
59
|
+
if callable(close):
|
|
60
|
+
maybe = close()
|
|
61
|
+
if hasattr(maybe, "__await__"):
|
|
62
|
+
await maybe
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
__all__ = ["VoyageRunner"]
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
"""`VoyageEmbeddingClient` — `EmbeddingClient` over Voyage AI.
|
|
2
|
+
|
|
3
|
+
Voyage's embedding API supports input-type optimisation
|
|
4
|
+
(`query` vs `document`) and Matryoshka truncation
|
|
5
|
+
(`output_dimension`) for selected models.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
import logging
|
|
11
|
+
from typing import TYPE_CHECKING
|
|
12
|
+
|
|
13
|
+
from agentforge_core.contracts.embedding import EmbeddingClient
|
|
14
|
+
from agentforge_core.production.exceptions import ModuleError
|
|
15
|
+
from agentforge_core.resolver import register_embedding_provider
|
|
16
|
+
from agentforge_core.values.messages import EmbeddingResponse, TokenUsage
|
|
17
|
+
|
|
18
|
+
if TYPE_CHECKING:
|
|
19
|
+
from agentforge_voyage._runner import VoyageRunner
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
log = logging.getLogger(__name__)
|
|
23
|
+
|
|
24
|
+
_PROVIDER_NAME = "voyage"
|
|
25
|
+
_DEFAULT_TIMEOUT_SECONDS = 30.0
|
|
26
|
+
|
|
27
|
+
_MODEL_INFO: dict[str, tuple[int, bool, bool]] = {
|
|
28
|
+
# Each entry: (native_dim, supports_matryoshka, multimodal).
|
|
29
|
+
"voyage-3-large": (1024, True, False),
|
|
30
|
+
"voyage-3": (1024, True, False),
|
|
31
|
+
"voyage-3-lite": (512, False, False),
|
|
32
|
+
"voyage-code-3": (1024, True, False),
|
|
33
|
+
"voyage-finance-2": (1024, False, False),
|
|
34
|
+
"voyage-law-2": (1024, False, False),
|
|
35
|
+
"voyage-multimodal-3": (1024, False, True),
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
# Per-million-token USD prices snapshotted 2026-05-14.
|
|
39
|
+
_PRICES: dict[str, float] = {
|
|
40
|
+
"voyage-3-large": 0.18,
|
|
41
|
+
"voyage-3": 0.06,
|
|
42
|
+
"voyage-3-lite": 0.02,
|
|
43
|
+
"voyage-code-3": 0.18,
|
|
44
|
+
"voyage-finance-2": 0.12,
|
|
45
|
+
"voyage-law-2": 0.12,
|
|
46
|
+
"voyage-multimodal-3": 0.18,
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
@register_embedding_provider("voyage")
|
|
51
|
+
class VoyageEmbeddingClient(EmbeddingClient):
|
|
52
|
+
"""`EmbeddingClient` over Voyage AI."""
|
|
53
|
+
|
|
54
|
+
def __init__(
|
|
55
|
+
self,
|
|
56
|
+
*,
|
|
57
|
+
runner: VoyageRunner,
|
|
58
|
+
model: str,
|
|
59
|
+
dimensions: int | None = None,
|
|
60
|
+
input_type: str | None = None,
|
|
61
|
+
timeout_seconds: float = _DEFAULT_TIMEOUT_SECONDS,
|
|
62
|
+
) -> None:
|
|
63
|
+
if not model:
|
|
64
|
+
raise ValueError("model must be a non-empty string")
|
|
65
|
+
if timeout_seconds <= 0:
|
|
66
|
+
raise ValueError("timeout_seconds must be > 0")
|
|
67
|
+
if input_type is not None and input_type not in {"query", "document"}:
|
|
68
|
+
raise ValueError("input_type must be 'query', 'document', or None")
|
|
69
|
+
info = _MODEL_INFO.get(model)
|
|
70
|
+
native_dim = info[0] if info else 1024
|
|
71
|
+
if dimensions is not None:
|
|
72
|
+
if dimensions < 1:
|
|
73
|
+
raise ValueError("dimensions must be >= 1")
|
|
74
|
+
if info is not None:
|
|
75
|
+
if dimensions > native_dim:
|
|
76
|
+
raise ValueError(
|
|
77
|
+
f"dimensions={dimensions} exceeds native={native_dim} for {model}",
|
|
78
|
+
)
|
|
79
|
+
if dimensions != native_dim and not info[1]:
|
|
80
|
+
raise ValueError(f"{model} does not support dimension override")
|
|
81
|
+
self._runner = runner
|
|
82
|
+
self._model = model
|
|
83
|
+
self._dimensions = dimensions or native_dim
|
|
84
|
+
self._dim_arg: int | None = dimensions if dimensions != native_dim else None
|
|
85
|
+
self._input_type = input_type
|
|
86
|
+
self._timeout_seconds = timeout_seconds
|
|
87
|
+
|
|
88
|
+
@classmethod
|
|
89
|
+
def from_config(
|
|
90
|
+
cls,
|
|
91
|
+
*,
|
|
92
|
+
model: str,
|
|
93
|
+
api_key: str | None = None,
|
|
94
|
+
dimensions: int | None = None,
|
|
95
|
+
input_type: str | None = None,
|
|
96
|
+
timeout_seconds: float = _DEFAULT_TIMEOUT_SECONDS,
|
|
97
|
+
) -> VoyageEmbeddingClient: # pragma: no cover — `-m live` only.
|
|
98
|
+
runner = _build_sdk_runner(api_key=api_key)
|
|
99
|
+
return cls(
|
|
100
|
+
runner=runner,
|
|
101
|
+
model=model,
|
|
102
|
+
dimensions=dimensions,
|
|
103
|
+
input_type=input_type,
|
|
104
|
+
timeout_seconds=timeout_seconds,
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
def dimensions(self) -> int:
|
|
108
|
+
return self._dimensions
|
|
109
|
+
|
|
110
|
+
def capabilities(self) -> set[str]:
|
|
111
|
+
info = _MODEL_INFO.get(self._model)
|
|
112
|
+
caps: set[str] = set()
|
|
113
|
+
if info and info[1]:
|
|
114
|
+
caps.add("matryoshka")
|
|
115
|
+
if info and info[2]:
|
|
116
|
+
caps.add("multimodal")
|
|
117
|
+
return caps
|
|
118
|
+
|
|
119
|
+
async def embed(self, texts: list[str]) -> EmbeddingResponse:
|
|
120
|
+
if not texts:
|
|
121
|
+
raise ValueError("texts must contain at least one item")
|
|
122
|
+
raw = await self._runner.embed(
|
|
123
|
+
texts=texts,
|
|
124
|
+
model=self._model,
|
|
125
|
+
input_type=self._input_type,
|
|
126
|
+
output_dimension=self._dim_arg,
|
|
127
|
+
timeout_s=self._timeout_seconds,
|
|
128
|
+
)
|
|
129
|
+
embeddings_raw = raw.get("embeddings") or []
|
|
130
|
+
vectors = tuple(tuple(float(v) for v in emb) for emb in embeddings_raw)
|
|
131
|
+
if any(len(v) != self._dimensions for v in vectors):
|
|
132
|
+
raise ValueError(
|
|
133
|
+
f"Voyage returned vector with unexpected dimensionality; "
|
|
134
|
+
f"expected {self._dimensions}, got {[len(v) for v in vectors]}",
|
|
135
|
+
)
|
|
136
|
+
tokens = int(raw.get("total_tokens", 0) or 0)
|
|
137
|
+
usage = TokenUsage(input_tokens=tokens, output_tokens=0)
|
|
138
|
+
price = _PRICES.get(self._model, 0.0)
|
|
139
|
+
cost = (tokens / 1_000_000) * price
|
|
140
|
+
return EmbeddingResponse(
|
|
141
|
+
vectors=vectors,
|
|
142
|
+
dimensions=self._dimensions,
|
|
143
|
+
usage=usage,
|
|
144
|
+
cost_usd=cost,
|
|
145
|
+
model=self._model,
|
|
146
|
+
provider=_PROVIDER_NAME,
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
async def close(self) -> None:
|
|
150
|
+
await self._runner.close()
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
def _build_sdk_runner(*, api_key: str | None) -> VoyageRunner: # pragma: no cover — `-m live` only.
|
|
154
|
+
try:
|
|
155
|
+
import voyageai # noqa: PLC0415
|
|
156
|
+
except ImportError as exc:
|
|
157
|
+
msg = (
|
|
158
|
+
"voyageai is not installed. Install via "
|
|
159
|
+
"`pip install agentforge-voyage[voyage]` to use the production runner."
|
|
160
|
+
)
|
|
161
|
+
raise ModuleError(msg) from exc
|
|
162
|
+
|
|
163
|
+
from agentforge_voyage._runner import _VoyageSDKRunner # noqa: PLC0415
|
|
164
|
+
|
|
165
|
+
client = voyageai.AsyncClient(api_key=api_key) if api_key else voyageai.AsyncClient()
|
|
166
|
+
return _VoyageSDKRunner(client)
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
__all__ = ["VoyageEmbeddingClient"]
|
|
File without changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"""Pytest fixtures for `agentforge-voyage` unit tests."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import pytest
|
|
6
|
+
from agentforge_voyage import VoyageEmbeddingClient
|
|
7
|
+
from agentforge_voyage._inmem_runner import FakeVoyageRunner
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@pytest.fixture
|
|
11
|
+
def fake_runner() -> FakeVoyageRunner:
|
|
12
|
+
return FakeVoyageRunner()
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@pytest.fixture
|
|
16
|
+
def client(fake_runner: FakeVoyageRunner) -> VoyageEmbeddingClient:
|
|
17
|
+
return VoyageEmbeddingClient(runner=fake_runner, model="voyage-3-large")
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"""Live integration tests for `agentforge-voyage`. Gated behind `-m live`."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import os
|
|
6
|
+
|
|
7
|
+
import pytest
|
|
8
|
+
from agentforge_voyage import VoyageEmbeddingClient
|
|
9
|
+
|
|
10
|
+
pytestmark = pytest.mark.live
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@pytest.mark.asyncio
|
|
14
|
+
async def test_live_embed_returns_vector() -> None: # pragma: no cover — live-only.
|
|
15
|
+
key = os.environ.get("VOYAGE_API_KEY")
|
|
16
|
+
if not key:
|
|
17
|
+
pytest.skip("VOYAGE_API_KEY not set")
|
|
18
|
+
client = VoyageEmbeddingClient.from_config(model="voyage-3-lite", api_key=key)
|
|
19
|
+
try:
|
|
20
|
+
resp = await client.embed(["hello"])
|
|
21
|
+
assert len(resp.vectors) == 1
|
|
22
|
+
assert resp.dimensions == 512
|
|
23
|
+
finally:
|
|
24
|
+
await client.close()
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"""Unit tests for `VoyageEmbeddingClient`."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import pytest
|
|
6
|
+
from agentforge_voyage import VoyageEmbeddingClient
|
|
7
|
+
from agentforge_voyage._inmem_runner import FakeVoyageRunner
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def test_constructor_rejects_empty_model(fake_runner: FakeVoyageRunner) -> None:
|
|
11
|
+
with pytest.raises(ValueError, match="model"):
|
|
12
|
+
VoyageEmbeddingClient(runner=fake_runner, model="")
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def test_constructor_rejects_zero_timeout(fake_runner: FakeVoyageRunner) -> None:
|
|
16
|
+
with pytest.raises(ValueError, match="timeout"):
|
|
17
|
+
VoyageEmbeddingClient(runner=fake_runner, model="voyage-3", timeout_seconds=0)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def test_constructor_rejects_invalid_input_type(fake_runner: FakeVoyageRunner) -> None:
|
|
21
|
+
with pytest.raises(ValueError, match="input_type"):
|
|
22
|
+
VoyageEmbeddingClient(runner=fake_runner, model="voyage-3", input_type="passage")
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def test_dimensions_default_to_native(fake_runner: FakeVoyageRunner) -> None:
|
|
26
|
+
c = VoyageEmbeddingClient(runner=fake_runner, model="voyage-3-lite")
|
|
27
|
+
assert c.dimensions() == 512
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def test_matryoshka_dim_override_supported(fake_runner: FakeVoyageRunner) -> None:
|
|
31
|
+
c = VoyageEmbeddingClient(runner=fake_runner, model="voyage-3-large", dimensions=512)
|
|
32
|
+
assert c.dimensions() == 512
|
|
33
|
+
assert "matryoshka" in c.capabilities()
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def test_dim_override_rejected_on_non_matryoshka(fake_runner: FakeVoyageRunner) -> None:
|
|
37
|
+
with pytest.raises(ValueError, match="dimension override"):
|
|
38
|
+
VoyageEmbeddingClient(runner=fake_runner, model="voyage-3-lite", dimensions=256)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def test_dim_override_exceeds_native_rejected(fake_runner: FakeVoyageRunner) -> None:
|
|
42
|
+
with pytest.raises(ValueError, match="exceeds native"):
|
|
43
|
+
VoyageEmbeddingClient(runner=fake_runner, model="voyage-3-large", dimensions=99999)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def test_multimodal_capability_set(fake_runner: FakeVoyageRunner) -> None:
|
|
47
|
+
c = VoyageEmbeddingClient(runner=fake_runner, model="voyage-multimodal-3")
|
|
48
|
+
assert "multimodal" in c.capabilities()
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
@pytest.mark.asyncio
|
|
52
|
+
async def test_embed_rejects_empty(client: VoyageEmbeddingClient) -> None:
|
|
53
|
+
with pytest.raises(ValueError, match="texts"):
|
|
54
|
+
await client.embed([])
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
@pytest.mark.asyncio
|
|
58
|
+
async def test_embed_returns_vectors_at_declared_dim(
|
|
59
|
+
client: VoyageEmbeddingClient,
|
|
60
|
+
fake_runner: FakeVoyageRunner,
|
|
61
|
+
) -> None:
|
|
62
|
+
fake_runner.set_response_dim(1024)
|
|
63
|
+
fake_runner.set_response_tokens(20)
|
|
64
|
+
resp = await client.embed(["hello", "world"])
|
|
65
|
+
assert len(resp.vectors) == 2
|
|
66
|
+
assert all(len(v) == 1024 for v in resp.vectors)
|
|
67
|
+
assert resp.usage.input_tokens == 20
|
|
68
|
+
assert resp.cost_usd > 0
|
|
69
|
+
assert resp.provider == "voyage"
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
@pytest.mark.asyncio
|
|
73
|
+
async def test_embed_propagates_dim_override(fake_runner: FakeVoyageRunner) -> None:
|
|
74
|
+
c = VoyageEmbeddingClient(runner=fake_runner, model="voyage-3-large", dimensions=512)
|
|
75
|
+
await c.embed(["x"])
|
|
76
|
+
assert fake_runner.embed_calls[-1].output_dimension == 512
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
@pytest.mark.asyncio
|
|
80
|
+
async def test_embed_propagates_input_type(fake_runner: FakeVoyageRunner) -> None:
|
|
81
|
+
c = VoyageEmbeddingClient(runner=fake_runner, model="voyage-3", input_type="query")
|
|
82
|
+
await c.embed(["x"])
|
|
83
|
+
assert fake_runner.embed_calls[-1].input_type == "query"
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
@pytest.mark.asyncio
|
|
87
|
+
async def test_embed_unknown_model_zero_cost(fake_runner: FakeVoyageRunner) -> None:
|
|
88
|
+
fake_runner.set_response_dim(1024)
|
|
89
|
+
fake_runner.set_response_tokens(50)
|
|
90
|
+
c = VoyageEmbeddingClient(runner=fake_runner, model="voyage-future")
|
|
91
|
+
resp = await c.embed(["hi"])
|
|
92
|
+
assert resp.cost_usd == 0.0
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
@pytest.mark.asyncio
|
|
96
|
+
async def test_close_propagates(
|
|
97
|
+
client: VoyageEmbeddingClient,
|
|
98
|
+
fake_runner: FakeVoyageRunner,
|
|
99
|
+
) -> None:
|
|
100
|
+
await client.close()
|
|
101
|
+
assert fake_runner.closed
|