fastembed-cloud 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.
- fastembed_cloud-0.1.0/LICENSE +21 -0
- fastembed_cloud-0.1.0/PKG-INFO +236 -0
- fastembed_cloud-0.1.0/README.md +199 -0
- fastembed_cloud-0.1.0/fastembed_cloud/__init__.py +24 -0
- fastembed_cloud-0.1.0/fastembed_cloud/embedding.py +300 -0
- fastembed_cloud-0.1.0/fastembed_cloud/provision.py +175 -0
- fastembed_cloud-0.1.0/fastembed_cloud.egg-info/PKG-INFO +236 -0
- fastembed_cloud-0.1.0/fastembed_cloud.egg-info/SOURCES.txt +12 -0
- fastembed_cloud-0.1.0/fastembed_cloud.egg-info/dependency_links.txt +1 -0
- fastembed_cloud-0.1.0/fastembed_cloud.egg-info/requires.txt +12 -0
- fastembed_cloud-0.1.0/fastembed_cloud.egg-info/top_level.txt +1 -0
- fastembed_cloud-0.1.0/pyproject.toml +77 -0
- fastembed_cloud-0.1.0/setup.cfg +4 -0
- fastembed_cloud-0.1.0/tests/test_embedding.py +335 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 AINative Studio
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: fastembed-cloud
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Cloud embeddings via AINative API — drop-in fastembed replacement, no model downloads
|
|
5
|
+
Author-email: AINative Studio <support@ainative.studio>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/AINative-Studio/fastembed-cloud
|
|
8
|
+
Project-URL: Documentation, https://docs.ainative.studio/embeddings
|
|
9
|
+
Project-URL: Repository, https://github.com/AINative-Studio/fastembed-cloud
|
|
10
|
+
Project-URL: Issues, https://github.com/AINative-Studio/fastembed-cloud/issues
|
|
11
|
+
Keywords: fastembed,fastembed-alternative,embeddings,text-embeddings,cloud-embeddings,free-embeddings,ainative,zerodb,bge,baai,onnx-alternative,vector-embeddings,semantic-search,similarity-search,sentence-transformers-alternative,auto-provisioning,serverless,no-download,claude,cursor,windsurf,rag,retrieval-augmented-generation
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
23
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
24
|
+
Requires-Python: >=3.8
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
Requires-Dist: requests>=2.28
|
|
28
|
+
Provides-Extra: local
|
|
29
|
+
Requires-Dist: fastembed>=0.3.0; extra == "local"
|
|
30
|
+
Provides-Extra: numpy
|
|
31
|
+
Requires-Dist: numpy>=1.20; extra == "numpy"
|
|
32
|
+
Provides-Extra: dev
|
|
33
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
34
|
+
Requires-Dist: pytest-cov>=4.0; extra == "dev"
|
|
35
|
+
Requires-Dist: responses>=0.23; extra == "dev"
|
|
36
|
+
Dynamic: license-file
|
|
37
|
+
|
|
38
|
+
# fastembed-cloud
|
|
39
|
+
|
|
40
|
+
Cloud text embeddings via AINative API. Drop-in replacement for [fastembed](https://github.com/qdrant/fastembed) — same interface, no model downloads, no ONNX runtime.
|
|
41
|
+
|
|
42
|
+
## Why?
|
|
43
|
+
|
|
44
|
+
fastembed is great, but requires downloading 100MB+ ONNX models locally. `fastembed-cloud` gives you the same API backed by a free cloud service — zero setup, zero downloads.
|
|
45
|
+
|
|
46
|
+
| | fastembed | fastembed-cloud |
|
|
47
|
+
|---|---|---|
|
|
48
|
+
| First-run latency | 30-120s (model download) | 0s |
|
|
49
|
+
| Disk usage | 100MB-1GB per model | 0 |
|
|
50
|
+
| ONNX runtime | Required | Not needed |
|
|
51
|
+
| Offline support | Yes | No (cloud API) |
|
|
52
|
+
| Cost | Free (local compute) | Free (AINative API) |
|
|
53
|
+
|
|
54
|
+
## Install
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
pip install fastembed-cloud
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Quick Start
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
from fastembed_cloud import CloudTextEmbedding
|
|
64
|
+
|
|
65
|
+
# Auto-provisions a free API key on first run
|
|
66
|
+
model = CloudTextEmbedding()
|
|
67
|
+
|
|
68
|
+
# Single query
|
|
69
|
+
embedding = model.query_embed("What is semantic search?")
|
|
70
|
+
print(f"Dimensions: {len(embedding)}") # 384
|
|
71
|
+
|
|
72
|
+
# Batch embedding
|
|
73
|
+
docs = ["First document", "Second document", "Third document"]
|
|
74
|
+
embeddings = model.embed(docs)
|
|
75
|
+
print(f"Embedded {len(embeddings)} documents")
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Models
|
|
79
|
+
|
|
80
|
+
| Model | Dimensions | ID |
|
|
81
|
+
|---|---|---|
|
|
82
|
+
| BGE-small-en-v1.5 | 384 | `BAAI/bge-small-en-v1.5` (default) |
|
|
83
|
+
| BGE-base-en-v1.5 | 768 | `BAAI/bge-base-en-v1.5` |
|
|
84
|
+
| BGE-large-en-v1.5 | 1024 | `BAAI/bge-large-en-v1.5` |
|
|
85
|
+
| BGE-M3 (multilingual) | 1024 | `bge-m3` |
|
|
86
|
+
|
|
87
|
+
```python
|
|
88
|
+
model = CloudTextEmbedding(model_name="bge-m3")
|
|
89
|
+
embedding = model.query_embed("Multilingual embedding")
|
|
90
|
+
print(len(embedding)) # 1024
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Smart Hybrid: Local + Cloud
|
|
94
|
+
|
|
95
|
+
`TextEmbedding` automatically uses local fastembed if installed, cloud otherwise:
|
|
96
|
+
|
|
97
|
+
```python
|
|
98
|
+
from fastembed_cloud import TextEmbedding
|
|
99
|
+
|
|
100
|
+
model = TextEmbedding()
|
|
101
|
+
print(model.is_cloud) # True if fastembed not installed
|
|
102
|
+
|
|
103
|
+
embeddings = model.embed(["works either way"])
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Install fastembed alongside for local-first with cloud fallback:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
pip install fastembed-cloud[local]
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Authentication
|
|
113
|
+
|
|
114
|
+
Credentials are resolved in this order:
|
|
115
|
+
|
|
116
|
+
1. `api_key` parameter: `CloudTextEmbedding(api_key="your-key")`
|
|
117
|
+
2. `AINATIVE_API_KEY` environment variable
|
|
118
|
+
3. `ZERODB_API_KEY` environment variable (shared with ZeroDB ecosystem)
|
|
119
|
+
4. `~/.zerodb/credentials.json` (auto-saved from any ZeroDB tool)
|
|
120
|
+
5. Auto-provisioning (free 72-hour account, claim to keep permanently)
|
|
121
|
+
|
|
122
|
+
### Auto-Provisioning
|
|
123
|
+
|
|
124
|
+
On first use with no credentials, fastembed-cloud automatically provisions a free account:
|
|
125
|
+
|
|
126
|
+
```
|
|
127
|
+
$ python -c "from fastembed_cloud import CloudTextEmbedding; CloudTextEmbedding().query_embed('test')"
|
|
128
|
+
|
|
129
|
+
No API key found — provisioning a free AINative account for embeddings...
|
|
130
|
+
|
|
131
|
+
Auto-provisioned! Free embeddings API ready.
|
|
132
|
+
|
|
133
|
+
API Key: zdb_abc12345...
|
|
134
|
+
Expires: 72 hours
|
|
135
|
+
Saved to: ~/.zerodb/credentials.json
|
|
136
|
+
|
|
137
|
+
To keep access permanently, claim your account:
|
|
138
|
+
https://ainative.studio/signup
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Batch Embedding
|
|
142
|
+
|
|
143
|
+
Handles large datasets efficiently with automatic batching:
|
|
144
|
+
|
|
145
|
+
```python
|
|
146
|
+
model = CloudTextEmbedding(batch_size=100)
|
|
147
|
+
|
|
148
|
+
# Automatically batches into chunks of 100
|
|
149
|
+
large_dataset = ["document " + str(i) for i in range(10000)]
|
|
150
|
+
embeddings = model.embed(large_dataset)
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Use with Vector Databases
|
|
154
|
+
|
|
155
|
+
### Qdrant
|
|
156
|
+
|
|
157
|
+
```python
|
|
158
|
+
from qdrant_client import QdrantClient
|
|
159
|
+
from fastembed_cloud import CloudTextEmbedding
|
|
160
|
+
|
|
161
|
+
client = QdrantClient(":memory:")
|
|
162
|
+
model = CloudTextEmbedding()
|
|
163
|
+
|
|
164
|
+
docs = ["AI is transforming healthcare", "Machine learning for finance"]
|
|
165
|
+
embeddings = model.embed(docs)
|
|
166
|
+
|
|
167
|
+
client.add(
|
|
168
|
+
collection_name="my_docs",
|
|
169
|
+
documents=docs,
|
|
170
|
+
embeddings=embeddings,
|
|
171
|
+
)
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### ChromaDB
|
|
175
|
+
|
|
176
|
+
```python
|
|
177
|
+
import chromadb
|
|
178
|
+
from fastembed_cloud import CloudTextEmbedding
|
|
179
|
+
|
|
180
|
+
client = chromadb.Client()
|
|
181
|
+
collection = client.create_collection("my_docs")
|
|
182
|
+
model = CloudTextEmbedding()
|
|
183
|
+
|
|
184
|
+
docs = ["First doc", "Second doc"]
|
|
185
|
+
embeddings = model.embed(docs)
|
|
186
|
+
|
|
187
|
+
collection.add(
|
|
188
|
+
documents=docs,
|
|
189
|
+
embeddings=embeddings,
|
|
190
|
+
ids=["id1", "id2"],
|
|
191
|
+
)
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
## API Reference
|
|
195
|
+
|
|
196
|
+
### CloudTextEmbedding
|
|
197
|
+
|
|
198
|
+
Always uses the cloud API.
|
|
199
|
+
|
|
200
|
+
```python
|
|
201
|
+
CloudTextEmbedding(
|
|
202
|
+
model_name="BAAI/bge-small-en-v1.5", # Model to use
|
|
203
|
+
api_key=None, # API key (auto-resolved)
|
|
204
|
+
base_url=None, # API URL (default: api.ainative.studio)
|
|
205
|
+
batch_size=64, # Max texts per API call
|
|
206
|
+
normalize=True, # Normalize to unit vectors
|
|
207
|
+
)
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
**Methods:**
|
|
211
|
+
- `embed(documents, batch_size=None)` — Embed a list of texts. Returns `list[list[float]]`.
|
|
212
|
+
- `query_embed(query)` — Embed a single query. Returns `list[float]`.
|
|
213
|
+
- `passage_embed(texts)` — Alias for `embed()` (fastembed compatibility).
|
|
214
|
+
|
|
215
|
+
**Properties:**
|
|
216
|
+
- `dim` — Embedding dimensions (e.g., 384 for bge-small).
|
|
217
|
+
- `model_name` — Resolved model name.
|
|
218
|
+
|
|
219
|
+
### TextEmbedding
|
|
220
|
+
|
|
221
|
+
Smart hybrid: local fastembed if available, cloud otherwise.
|
|
222
|
+
|
|
223
|
+
```python
|
|
224
|
+
TextEmbedding(
|
|
225
|
+
model_name="BAAI/bge-small-en-v1.5",
|
|
226
|
+
api_key=None,
|
|
227
|
+
**kwargs,
|
|
228
|
+
)
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
**Properties:**
|
|
232
|
+
- `is_cloud` — `True` if using cloud API, `False` if using local fastembed.
|
|
233
|
+
|
|
234
|
+
## License
|
|
235
|
+
|
|
236
|
+
MIT
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
# fastembed-cloud
|
|
2
|
+
|
|
3
|
+
Cloud text embeddings via AINative API. Drop-in replacement for [fastembed](https://github.com/qdrant/fastembed) — same interface, no model downloads, no ONNX runtime.
|
|
4
|
+
|
|
5
|
+
## Why?
|
|
6
|
+
|
|
7
|
+
fastembed is great, but requires downloading 100MB+ ONNX models locally. `fastembed-cloud` gives you the same API backed by a free cloud service — zero setup, zero downloads.
|
|
8
|
+
|
|
9
|
+
| | fastembed | fastembed-cloud |
|
|
10
|
+
|---|---|---|
|
|
11
|
+
| First-run latency | 30-120s (model download) | 0s |
|
|
12
|
+
| Disk usage | 100MB-1GB per model | 0 |
|
|
13
|
+
| ONNX runtime | Required | Not needed |
|
|
14
|
+
| Offline support | Yes | No (cloud API) |
|
|
15
|
+
| Cost | Free (local compute) | Free (AINative API) |
|
|
16
|
+
|
|
17
|
+
## Install
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pip install fastembed-cloud
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Quick Start
|
|
24
|
+
|
|
25
|
+
```python
|
|
26
|
+
from fastembed_cloud import CloudTextEmbedding
|
|
27
|
+
|
|
28
|
+
# Auto-provisions a free API key on first run
|
|
29
|
+
model = CloudTextEmbedding()
|
|
30
|
+
|
|
31
|
+
# Single query
|
|
32
|
+
embedding = model.query_embed("What is semantic search?")
|
|
33
|
+
print(f"Dimensions: {len(embedding)}") # 384
|
|
34
|
+
|
|
35
|
+
# Batch embedding
|
|
36
|
+
docs = ["First document", "Second document", "Third document"]
|
|
37
|
+
embeddings = model.embed(docs)
|
|
38
|
+
print(f"Embedded {len(embeddings)} documents")
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Models
|
|
42
|
+
|
|
43
|
+
| Model | Dimensions | ID |
|
|
44
|
+
|---|---|---|
|
|
45
|
+
| BGE-small-en-v1.5 | 384 | `BAAI/bge-small-en-v1.5` (default) |
|
|
46
|
+
| BGE-base-en-v1.5 | 768 | `BAAI/bge-base-en-v1.5` |
|
|
47
|
+
| BGE-large-en-v1.5 | 1024 | `BAAI/bge-large-en-v1.5` |
|
|
48
|
+
| BGE-M3 (multilingual) | 1024 | `bge-m3` |
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
model = CloudTextEmbedding(model_name="bge-m3")
|
|
52
|
+
embedding = model.query_embed("Multilingual embedding")
|
|
53
|
+
print(len(embedding)) # 1024
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Smart Hybrid: Local + Cloud
|
|
57
|
+
|
|
58
|
+
`TextEmbedding` automatically uses local fastembed if installed, cloud otherwise:
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
from fastembed_cloud import TextEmbedding
|
|
62
|
+
|
|
63
|
+
model = TextEmbedding()
|
|
64
|
+
print(model.is_cloud) # True if fastembed not installed
|
|
65
|
+
|
|
66
|
+
embeddings = model.embed(["works either way"])
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Install fastembed alongside for local-first with cloud fallback:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
pip install fastembed-cloud[local]
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Authentication
|
|
76
|
+
|
|
77
|
+
Credentials are resolved in this order:
|
|
78
|
+
|
|
79
|
+
1. `api_key` parameter: `CloudTextEmbedding(api_key="your-key")`
|
|
80
|
+
2. `AINATIVE_API_KEY` environment variable
|
|
81
|
+
3. `ZERODB_API_KEY` environment variable (shared with ZeroDB ecosystem)
|
|
82
|
+
4. `~/.zerodb/credentials.json` (auto-saved from any ZeroDB tool)
|
|
83
|
+
5. Auto-provisioning (free 72-hour account, claim to keep permanently)
|
|
84
|
+
|
|
85
|
+
### Auto-Provisioning
|
|
86
|
+
|
|
87
|
+
On first use with no credentials, fastembed-cloud automatically provisions a free account:
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
$ python -c "from fastembed_cloud import CloudTextEmbedding; CloudTextEmbedding().query_embed('test')"
|
|
91
|
+
|
|
92
|
+
No API key found — provisioning a free AINative account for embeddings...
|
|
93
|
+
|
|
94
|
+
Auto-provisioned! Free embeddings API ready.
|
|
95
|
+
|
|
96
|
+
API Key: zdb_abc12345...
|
|
97
|
+
Expires: 72 hours
|
|
98
|
+
Saved to: ~/.zerodb/credentials.json
|
|
99
|
+
|
|
100
|
+
To keep access permanently, claim your account:
|
|
101
|
+
https://ainative.studio/signup
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Batch Embedding
|
|
105
|
+
|
|
106
|
+
Handles large datasets efficiently with automatic batching:
|
|
107
|
+
|
|
108
|
+
```python
|
|
109
|
+
model = CloudTextEmbedding(batch_size=100)
|
|
110
|
+
|
|
111
|
+
# Automatically batches into chunks of 100
|
|
112
|
+
large_dataset = ["document " + str(i) for i in range(10000)]
|
|
113
|
+
embeddings = model.embed(large_dataset)
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Use with Vector Databases
|
|
117
|
+
|
|
118
|
+
### Qdrant
|
|
119
|
+
|
|
120
|
+
```python
|
|
121
|
+
from qdrant_client import QdrantClient
|
|
122
|
+
from fastembed_cloud import CloudTextEmbedding
|
|
123
|
+
|
|
124
|
+
client = QdrantClient(":memory:")
|
|
125
|
+
model = CloudTextEmbedding()
|
|
126
|
+
|
|
127
|
+
docs = ["AI is transforming healthcare", "Machine learning for finance"]
|
|
128
|
+
embeddings = model.embed(docs)
|
|
129
|
+
|
|
130
|
+
client.add(
|
|
131
|
+
collection_name="my_docs",
|
|
132
|
+
documents=docs,
|
|
133
|
+
embeddings=embeddings,
|
|
134
|
+
)
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### ChromaDB
|
|
138
|
+
|
|
139
|
+
```python
|
|
140
|
+
import chromadb
|
|
141
|
+
from fastembed_cloud import CloudTextEmbedding
|
|
142
|
+
|
|
143
|
+
client = chromadb.Client()
|
|
144
|
+
collection = client.create_collection("my_docs")
|
|
145
|
+
model = CloudTextEmbedding()
|
|
146
|
+
|
|
147
|
+
docs = ["First doc", "Second doc"]
|
|
148
|
+
embeddings = model.embed(docs)
|
|
149
|
+
|
|
150
|
+
collection.add(
|
|
151
|
+
documents=docs,
|
|
152
|
+
embeddings=embeddings,
|
|
153
|
+
ids=["id1", "id2"],
|
|
154
|
+
)
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## API Reference
|
|
158
|
+
|
|
159
|
+
### CloudTextEmbedding
|
|
160
|
+
|
|
161
|
+
Always uses the cloud API.
|
|
162
|
+
|
|
163
|
+
```python
|
|
164
|
+
CloudTextEmbedding(
|
|
165
|
+
model_name="BAAI/bge-small-en-v1.5", # Model to use
|
|
166
|
+
api_key=None, # API key (auto-resolved)
|
|
167
|
+
base_url=None, # API URL (default: api.ainative.studio)
|
|
168
|
+
batch_size=64, # Max texts per API call
|
|
169
|
+
normalize=True, # Normalize to unit vectors
|
|
170
|
+
)
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
**Methods:**
|
|
174
|
+
- `embed(documents, batch_size=None)` — Embed a list of texts. Returns `list[list[float]]`.
|
|
175
|
+
- `query_embed(query)` — Embed a single query. Returns `list[float]`.
|
|
176
|
+
- `passage_embed(texts)` — Alias for `embed()` (fastembed compatibility).
|
|
177
|
+
|
|
178
|
+
**Properties:**
|
|
179
|
+
- `dim` — Embedding dimensions (e.g., 384 for bge-small).
|
|
180
|
+
- `model_name` — Resolved model name.
|
|
181
|
+
|
|
182
|
+
### TextEmbedding
|
|
183
|
+
|
|
184
|
+
Smart hybrid: local fastembed if available, cloud otherwise.
|
|
185
|
+
|
|
186
|
+
```python
|
|
187
|
+
TextEmbedding(
|
|
188
|
+
model_name="BAAI/bge-small-en-v1.5",
|
|
189
|
+
api_key=None,
|
|
190
|
+
**kwargs,
|
|
191
|
+
)
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
**Properties:**
|
|
195
|
+
- `is_cloud` — `True` if using cloud API, `False` if using local fastembed.
|
|
196
|
+
|
|
197
|
+
## License
|
|
198
|
+
|
|
199
|
+
MIT
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"""
|
|
2
|
+
fastembed-cloud — Cloud embeddings via AINative API.
|
|
3
|
+
|
|
4
|
+
Drop-in replacement for fastembed that generates embeddings via API
|
|
5
|
+
instead of downloading and running ONNX models locally.
|
|
6
|
+
|
|
7
|
+
Usage:
|
|
8
|
+
from fastembed_cloud import CloudTextEmbedding
|
|
9
|
+
|
|
10
|
+
model = CloudTextEmbedding()
|
|
11
|
+
embeddings = model.embed(["hello world", "semantic search"])
|
|
12
|
+
|
|
13
|
+
Or use the smart TextEmbedding that prefers local fastembed when installed:
|
|
14
|
+
|
|
15
|
+
from fastembed_cloud import TextEmbedding
|
|
16
|
+
|
|
17
|
+
model = TextEmbedding()
|
|
18
|
+
embeddings = model.embed(["hello world"])
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
from fastembed_cloud.embedding import CloudTextEmbedding, TextEmbedding
|
|
22
|
+
|
|
23
|
+
__version__ = "0.1.0"
|
|
24
|
+
__all__ = ["CloudTextEmbedding", "TextEmbedding"]
|